dlaima commited on
Commit
043dbe1
·
verified ·
1 Parent(s): 4faac3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -29,20 +29,16 @@ class MyAgent:
29
  )
30
 
31
  def __call__(self, question: str) -> str:
32
- # Manually prepend system prompt in the messages for chat completion
33
- messages = [
34
- {"role": "system", "content": SYSTEM_PROMPT},
35
- {"role": "user", "content": question}
36
- ]
37
- try:
38
- # Assuming your model supports a method like `complete` or `run` that accepts messages
39
- # If your agent.run expects just the question string, you must use model.complete yourself.
40
- # So call model.complete(messages=messages) instead:
41
- return self.model.complete(messages=messages)
42
- except Exception as e:
43
- import traceback
44
- traceback.print_exc()
45
- return f"AGENT ERROR: {e}"
46
 
47
 
48
  def run_and_submit_all(profile: gr.OAuthProfile | None):
 
29
  )
30
 
31
  def __call__(self, question: str) -> str:
32
+ messages = [
33
+ {"role": "system", "content": SYSTEM_PROMPT},
34
+ {"role": "user", "content": question}
35
+ ]
36
+ try:
37
+ return self.model.run(messages)
38
+ except Exception as e:
39
+ import traceback
40
+ traceback.print_exc()
41
+ return f"AGENT ERROR: {e}"
 
 
 
 
42
 
43
 
44
  def run_and_submit_all(profile: gr.OAuthProfile | None):