You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The json scrape graph example is not working, both as-is and with the boto3 client as the "client" key. v1.20.1 & 1.20.0-beta.2 To Reproduce
``python
client = boto3.client("bedrock-runtime", region_name="us-west-2")
graph_config = {
"llm": {
"client": client,
"model": "bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
"temperature": 0.0
}
}
************************************************
Create the JSONScraperGraph instance and run it
************************************************
json_scraper_graph = JSONScraperGraph(
prompt="List me all questions and options in the math section, no answers.",
source=json.dumps(items[:3]), # Pass the content of the file, not the file object
config=graph_config
)
result = json_scraper_graph.run()
print(json.dumps(result, indent=4))
Error instancing model: 1 validation error for ChatBedrock
temperature
extra fields not permitted (type=value_error.extra)
TypeError Traceback (most recent call last)
Cell In[98], line 19
9 # ************************************************
10 # Create the JSONScraperGraph instance and run it
11 # ************************************************
13 json_scraper_graph = JSONScraperGraph(
14 prompt="List me all questions and options in the math section, no answers.",
15 source=json.dumps(items[:3]), # Pass the content of the file, not the file object
16 config=graph_config
17 )
---> 19 result = json_scraper_graph.run()
20 print(json.dumps(result, indent=4))
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/scrapegraphai/graphs/json_scraper_graph.py:93, in JSONScraperGraph.run(self)
85 """
86 Executes the web scraping process and returns the answer to the prompt.
87
88 Returns:
89 str: The answer to the prompt.
90 """
92 inputs = {"user_prompt": self.prompt, self.input_key: self.source}
---> 93 self.final_state, self.execution_info = self.graph.execute(inputs)
95 return self.final_state.get("answer", "No answer found.")
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/langchain_core/runnables/base.py:436, in Runnable.or(self, other)
426 def or(
427 self,
428 other: Union[
(...)
433 ],
434 ) -> RunnableSerializable[Input, Other]:
435 """Compose this Runnable with another object to create a RunnableSequence."""
--> 436 return RunnableSequence(self, coerce_to_runnable(other))
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/langchain_core/runnables/base.py:5553, in coerce_to_runnable(thing)
5551 return cast(Runnable[Input, Output], RunnableParallel(thing))
5552 else:
-> 5553 raise TypeError(
5554 f"Expected a Runnable, callable or dict."
5555 f"Instead got an unsupported type: {type(thing)}"
5556 )
TypeError: Expected a Runnable, callable or dict.Instead got an unsupported type: <class 'NoneType'>
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS] macos
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
The json scrape graph example is not working, both as-is and with the boto3 client as the "client" key. v1.20.1 & 1.20.0-beta.2
To Reproduce
``python
client = boto3.client("bedrock-runtime", region_name="us-west-2")
graph_config = {
"llm": {
"client": client,
"model": "bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
"temperature": 0.0
}
}
************************************************
Create the JSONScraperGraph instance and run it
************************************************
json_scraper_graph = JSONScraperGraph(
prompt="List me all questions and options in the math section, no answers.",
source=json.dumps(items[:3]), # Pass the content of the file, not the file object
config=graph_config
)
result = json_scraper_graph.run()
print(json.dumps(result, indent=4))
Error instancing model: 1 validation error for ChatBedrock
temperature
extra fields not permitted (type=value_error.extra)
TypeError Traceback (most recent call last)
Cell In[98], line 19
9 # ************************************************
10 # Create the JSONScraperGraph instance and run it
11 # ************************************************
13 json_scraper_graph = JSONScraperGraph(
14 prompt="List me all questions and options in the math section, no answers.",
15 source=json.dumps(items[:3]), # Pass the content of the file, not the file object
16 config=graph_config
17 )
---> 19 result = json_scraper_graph.run()
20 print(json.dumps(result, indent=4))
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/scrapegraphai/graphs/json_scraper_graph.py:93, in JSONScraperGraph.run(self)
85 """
86 Executes the web scraping process and returns the answer to the prompt.
87
88 Returns:
89 str: The answer to the prompt.
90 """
92 inputs = {"user_prompt": self.prompt, self.input_key: self.source}
---> 93 self.final_state, self.execution_info = self.graph.execute(inputs)
95 return self.final_state.get("answer", "No answer found.")
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/scrapegraphai/graphs/base_graph.py:263, in BaseGraph.execute(self, initial_state)
261 return (result["_state"], [])
262 else:
--> 263 return self._execute_standard(initial_state)
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/scrapegraphai/graphs/base_graph.py:184, in BaseGraph._execute_standard(self, initial_state)
171 graph_execution_time = time.time() - start_time
172 log_graph_execution(
173 graph_name=self.graph_name,
174 source=source,
(...)
182 exception=str(e)
183 )
--> 184 raise e
185 node_exec_time = time.time() - curr_time
186 total_exec_time += node_exec_time
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/scrapegraphai/graphs/base_graph.py:168, in BaseGraph._execute_standard(self, initial_state)
166 with get_openai_callback() as cb:
167 try:
--> 168 result = current_node.execute(state)
169 except Exception as e:
170 error_node = current_node.node_name
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/scrapegraphai/nodes/generate_answer_node.py:133, in GenerateAnswerNode.execute(self, state)
127 if len(doc) == 1:
128 prompt = PromptTemplate(
129 template=template_no_chunks_prompt ,
130 input_variables=["question"],
131 partial_variables={"context": doc,
132 "format_instructions": format_instructions})
--> 133 chain = prompt | self.llm_model | output_parser
134 answer = chain.invoke({"question": user_prompt})
136 state.update({self.output[0]: answer})
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/langchain_core/runnables/base.py:436, in Runnable.or(self, other)
426 def or(
427 self,
428 other: Union[
(...)
433 ],
434 ) -> RunnableSerializable[Input, Other]:
435 """Compose this Runnable with another object to create a RunnableSequence."""
--> 436 return RunnableSequence(self, coerce_to_runnable(other))
File /opt/anaconda3/envs/med_device/lib/python3.12/site-packages/langchain_core/runnables/base.py:5553, in coerce_to_runnable(thing)
5551 return cast(Runnable[Input, Output], RunnableParallel(thing))
5552 else:
-> 5553 raise TypeError(
5554 f"Expected a Runnable, callable or dict."
5555 f"Instead got an unsupported type: {type(thing)}"
5556 )
TypeError: Expected a Runnable, callable or dict.Instead got an unsupported type: <class 'NoneType'>
The text was updated successfully, but these errors were encountered: