Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,14 @@ def assistant(state:State):
|
|
| 29 |
return {
|
| 30 |
"messages": [llm_with_tools.invoke([system_message] + state["messages"])]
|
| 31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# (Keep Constants as is)
|
| 34 |
# --- Constants ---
|
|
@@ -38,13 +46,6 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 38 |
# ----- THIS IS WHERE YOU CAN BUILD WHAT YOU WANT ------
|
| 39 |
class BasicAgent:
|
| 40 |
def __init__(self):
|
| 41 |
-
workflow = StateGraph(State)
|
| 42 |
-
workflow.add_node("assistant", assistant)
|
| 43 |
-
workflow.add_node("tools", ToolNode(tools))
|
| 44 |
-
workflow.add_edge(START, "assistant")
|
| 45 |
-
workflow.add_conditional_edges("assistant", tools_condition)
|
| 46 |
-
workflow.add_edge("tools", "assistant")
|
| 47 |
-
app = workflow.compile()
|
| 48 |
print("BasicAgent initialized.")
|
| 49 |
def __call__(self, question: str) -> str:
|
| 50 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 29 |
return {
|
| 30 |
"messages": [llm_with_tools.invoke([system_message] + state["messages"])]
|
| 31 |
}
|
| 32 |
+
|
| 33 |
+
workflow = StateGraph(State)
|
| 34 |
+
workflow.add_node("assistant", assistant)
|
| 35 |
+
workflow.add_node("tools", ToolNode(tools))
|
| 36 |
+
workflow.add_edge(START, "assistant")
|
| 37 |
+
workflow.add_conditional_edges("assistant", tools_condition)
|
| 38 |
+
workflow.add_edge("tools", "assistant")
|
| 39 |
+
app = workflow.compile()
|
| 40 |
|
| 41 |
# (Keep Constants as is)
|
| 42 |
# --- Constants ---
|
|
|
|
| 46 |
# ----- THIS IS WHERE YOU CAN BUILD WHAT YOU WANT ------
|
| 47 |
class BasicAgent:
|
| 48 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
print("BasicAgent initialized.")
|
| 50 |
def __call__(self, question: str) -> str:
|
| 51 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|