naman1102 commited on
Commit
30a3abe
·
1 Parent(s): 29140cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -4,8 +4,8 @@ import requests
4
  import inspect
5
  import pandas as pd
6
  import ast
7
- from typing import Dict, Any, List, TypedDict, 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,13 +17,13 @@ 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):
 
4
  import inspect
5
  import pandas as pd
6
  import ast
7
+ from typing import Annotated, TypedDict, List, Dict, Any, Optional
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
 
17
  HF_TOKEN = os.getenv("HF_TOKEN") # Make sure to set this environment variable
18
 
19
  class AgentState(TypedDict):
20
+ question: Annotated[str, State.Immutable] # Fixed across steps
21
+ current_step: str # Mutable
22
+ tool_output: str # Mutable
23
+ final_answer: str # Mutable
24
+ history: Annotated[List[Dict[str, str]], State.MergingList] # Merged across steps
25
+ needs_more_info: bool # Mutable
26
+ search_query: str # Mutable
27
 
28
  class BasicAgent:
29
  def __init__(self):