acecalisto3 commited on
Commit
672e877
1 Parent(s): af96161

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +4 -4
agent.py CHANGED
@@ -30,12 +30,12 @@ READ_PROMPT = "read prompt"
30
  TASK_PROMPT = "task prompt"
31
  UNDERSTAND_TEST_RESULTS_PROMPT = "understand test results prompt"
32
 
33
- def format_prompt(message, history):
34
  prompt = "\n### Instruction:\n{}\n### History:\n{}".format(message, '\n'.join(history))
35
  return prompt
36
 
37
  def run_agent(instruction, history):
38
- prompt = format_prompt(instruction, history)
39
  response = ""
40
  for chunk in generate(prompt, history[-MAX_HISTORY:], temperature=0.7):
41
  response += chunk
@@ -59,7 +59,7 @@ def generate(prompt, history, temperature):
59
  "do_sample": True,
60
  "seed": seed,
61
  }
62
- formatted_prompt = format_prompt(f"{prompt}", history)
63
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
64
  output = ""
65
 
@@ -99,7 +99,7 @@ def _clear_history(history):
99
  __all__ = [
100
  "run_agent",
101
  "create_interface",
102
- "format_prompt",
103
  "generate",
104
  "MAX_HISTORY",
105
  "client",
 
30
  TASK_PROMPT = "task prompt"
31
  UNDERSTAND_TEST_RESULTS_PROMPT = "understand test results prompt"
32
 
33
+ def format_prompt_var(message, history):
34
  prompt = "\n### Instruction:\n{}\n### History:\n{}".format(message, '\n'.join(history))
35
  return prompt
36
 
37
  def run_agent(instruction, history):
38
+ prompt = format_prompt_var(instruction, history)
39
  response = ""
40
  for chunk in generate(prompt, history[-MAX_HISTORY:], temperature=0.7):
41
  response += chunk
 
59
  "do_sample": True,
60
  "seed": seed,
61
  }
62
+ formatted_prompt = format_prompt_var(f"{prompt}", history)
63
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
64
  output = ""
65
 
 
99
  __all__ = [
100
  "run_agent",
101
  "create_interface",
102
+ "format_prompt_var",
103
  "generate",
104
  "MAX_HISTORY",
105
  "client",