Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +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.prebuilt import ToolNode
|
10 |
from tools import simple_search
|
11 |
from huggingface_hub import InferenceClient
|
@@ -19,12 +19,12 @@ 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(
|
23 |
question: Annotated[str, "input"]
|
24 |
current_step: Annotated[str, "input"]
|
25 |
tool_output: Annotated[str, "input"]
|
26 |
final_answer: Annotated[str, "input"]
|
27 |
-
history: Annotated[List[Dict[str, str]], "
|
28 |
needs_more_info: Annotated[bool, "input"]
|
29 |
search_query: Annotated[str, "input"]
|
30 |
|
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
import ast
|
7 |
+
from typing import List, Dict, Any, Optional, Annotated
|
8 |
+
from langgraph.graph import Graph, StateGraph, State
|
9 |
from langgraph.prebuilt import ToolNode
|
10 |
from tools import simple_search
|
11 |
from huggingface_hub import InferenceClient
|
|
|
19 |
HF_TOKEN = os.getenv("HF_TOKEN") # Make sure to set this environment variable
|
20 |
|
21 |
|
22 |
+
class AgentState(State):
|
23 |
question: Annotated[str, "input"]
|
24 |
current_step: Annotated[str, "input"]
|
25 |
tool_output: Annotated[str, "input"]
|
26 |
final_answer: Annotated[str, "input"]
|
27 |
+
history: Annotated[List[Dict[str, str]], "accumulate"]
|
28 |
needs_more_info: Annotated[bool, "input"]
|
29 |
search_query: Annotated[str, "input"]
|
30 |
|