Update tools.py
Browse files
tools.py
CHANGED
@@ -15,6 +15,10 @@ class CalculatorState(TypedDict):
|
|
15 |
input: CalculatorInput
|
16 |
output: Optional[CalculatorOutput]
|
17 |
|
|
|
|
|
|
|
|
|
18 |
class SearchResult(TypedDict):
|
19 |
title: str
|
20 |
link: str
|
@@ -25,7 +29,7 @@ class SearchOutput(TypedDict):
|
|
25 |
query: str
|
26 |
|
27 |
class SearchState(TypedDict):
|
28 |
-
input:
|
29 |
output: Optional[SearchOutput]
|
30 |
|
31 |
def create_calculator_tool() -> Graph:
|
@@ -80,7 +84,7 @@ def create_search_tool() -> Graph:
|
|
80 |
with DDGS() as ddgs:
|
81 |
raw_results = list(ddgs.text(
|
82 |
state["input"]["query"],
|
83 |
-
max_results=state["input"]
|
84 |
))
|
85 |
|
86 |
results = []
|
|
|
15 |
input: CalculatorInput
|
16 |
output: Optional[CalculatorOutput]
|
17 |
|
18 |
+
class SearchInput(TypedDict):
|
19 |
+
query: str
|
20 |
+
max_results: int
|
21 |
+
|
22 |
class SearchResult(TypedDict):
|
23 |
title: str
|
24 |
link: str
|
|
|
29 |
query: str
|
30 |
|
31 |
class SearchState(TypedDict):
|
32 |
+
input: SearchInput # Now typed correctly
|
33 |
output: Optional[SearchOutput]
|
34 |
|
35 |
def create_calculator_tool() -> Graph:
|
|
|
84 |
with DDGS() as ddgs:
|
85 |
raw_results = list(ddgs.text(
|
86 |
state["input"]["query"],
|
87 |
+
max_results=state["input"]["max_results"]
|
88 |
))
|
89 |
|
90 |
results = []
|