Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ class State(TypedDict):
|
|
| 24 |
messages = Annotated[list[AnyMessage], add_messages]
|
| 25 |
|
| 26 |
def assistant(state:State):
|
| 27 |
-
system_message = SystemMessage("You are a helpful assistant. Your job is to answer the questions asked of you as accurately as possible. You have access to search and browser tools, which you may use when needed to answer a question.")
|
| 28 |
print(state["messages"])
|
| 29 |
return {
|
| 30 |
"messages": [llm_with_tools.invoke([system_message] + state["messages"])]
|
|
@@ -50,7 +50,7 @@ class BasicAgent:
|
|
| 50 |
def __call__(self, question: str) -> str:
|
| 51 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 52 |
# fixed_answer = "This is a default answer."
|
| 53 |
-
messages = [HumanMessage(question)]
|
| 54 |
answer = app.invoke({"messages": messages})
|
| 55 |
answer = answer["messages"][-1].content
|
| 56 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
|
|
|
| 24 |
messages = Annotated[list[AnyMessage], add_messages]
|
| 25 |
|
| 26 |
def assistant(state:State):
|
| 27 |
+
system_message = SystemMessage(content="You are a helpful assistant. Your job is to answer the questions asked of you as accurately as possible. You have access to search and browser tools, which you may use when needed to answer a question.")
|
| 28 |
print(state["messages"])
|
| 29 |
return {
|
| 30 |
"messages": [llm_with_tools.invoke([system_message] + state["messages"])]
|
|
|
|
| 50 |
def __call__(self, question: str) -> str:
|
| 51 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 52 |
# fixed_answer = "This is a default answer."
|
| 53 |
+
messages = [HumanMessage(content=question)]
|
| 54 |
answer = app.invoke({"messages": messages})
|
| 55 |
answer = answer["messages"][-1].content
|
| 56 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|