Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,8 @@ import requests
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
import ast
|
7 |
-
from typing import
|
8 |
from langgraph.graph import Graph, StateGraph
|
9 |
-
from langgraph.graph.state import State
|
10 |
from langgraph.prebuilt import ToolNode
|
11 |
from tools import simple_search
|
12 |
from huggingface_hub import InferenceClient
|
@@ -18,13 +17,13 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
18 |
HF_TOKEN = os.getenv("HF_TOKEN") # Make sure to set this environment variable
|
19 |
|
20 |
class AgentState(TypedDict):
|
21 |
-
question:
|
22 |
-
current_step: str
|
23 |
-
tool_output: str
|
24 |
-
final_answer: str
|
25 |
-
history:
|
26 |
-
needs_more_info: bool
|
27 |
-
search_query: str
|
28 |
|
29 |
class BasicAgent:
|
30 |
def __init__(self):
|
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
import ast
|
7 |
+
from typing import TypedDict, List, Dict, Any, Optional
|
8 |
from langgraph.graph import Graph, StateGraph
|
|
|
9 |
from langgraph.prebuilt import ToolNode
|
10 |
from tools import simple_search
|
11 |
from huggingface_hub import InferenceClient
|
|
|
17 |
HF_TOKEN = os.getenv("HF_TOKEN") # Make sure to set this environment variable
|
18 |
|
19 |
class AgentState(TypedDict):
|
20 |
+
question: str # Fixed across steps
|
21 |
+
current_step: str # Mutable
|
22 |
+
tool_output: str # Mutable
|
23 |
+
final_answer: str # Mutable
|
24 |
+
history: List[Dict[str, str]] # Merged across steps
|
25 |
+
needs_more_info: bool # Mutable
|
26 |
+
search_query: str # Mutable
|
27 |
|
28 |
class BasicAgent:
|
29 |
def __init__(self):
|