Update app.py
Browse files
app.py
CHANGED
@@ -9,21 +9,24 @@ from langgraph.graph import Graph, StateGraph
|
|
9 |
from langgraph.prebuilt import ToolNode
|
10 |
from tools import simple_search
|
11 |
from huggingface_hub import InferenceClient
|
12 |
-
|
|
|
|
|
13 |
print("trial")
|
14 |
# (Keep Constants as is)
|
15 |
# --- Constants ---
|
16 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
17 |
HF_TOKEN = os.getenv("HF_TOKEN") # Make sure to set this environment variable
|
18 |
|
|
|
19 |
class AgentState(TypedDict):
|
20 |
-
question: str
|
21 |
-
current_step: str
|
22 |
-
tool_output: str
|
23 |
-
final_answer: str
|
24 |
-
history: List[Dict[str, str]]
|
25 |
-
needs_more_info: bool
|
26 |
-
search_query: str
|
27 |
|
28 |
class BasicAgent:
|
29 |
def __init__(self):
|
|
|
9 |
from langgraph.prebuilt import ToolNode
|
10 |
from tools import simple_search
|
11 |
from huggingface_hub import InferenceClient
|
12 |
+
from langgraph.graph import State
|
13 |
+
from typing import Annotated
|
14 |
+
from typing_extensions import TypedDict
|
15 |
print("trial")
|
16 |
# (Keep Constants as is)
|
17 |
# --- Constants ---
|
18 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
19 |
HF_TOKEN = os.getenv("HF_TOKEN") # Make sure to set this environment variable
|
20 |
|
21 |
+
|
22 |
class AgentState(TypedDict):
|
23 |
+
question: Annotated[str, State.Immutable]
|
24 |
+
current_step: str
|
25 |
+
tool_output: str
|
26 |
+
final_answer: str
|
27 |
+
history: Annotated[List[Dict[str, str]], State.MergingList]
|
28 |
+
needs_more_info: bool
|
29 |
+
search_query: str
|
30 |
|
31 |
class BasicAgent:
|
32 |
def __init__(self):
|