fixed anthropic support. Anthropic has different format of response when it has tool calls. Explicit handling added
This commit is contained in:
@@ -47,9 +47,14 @@ def create_news_analyst(llm, toolkit):
|
||||
chain = prompt | llm.bind_tools(tools)
|
||||
result = chain.invoke(state["messages"])
|
||||
|
||||
report = ""
|
||||
|
||||
if len(result.tool_calls) == 0:
|
||||
report = result.content
|
||||
|
||||
return {
|
||||
"messages": [result],
|
||||
"news_report": result.content,
|
||||
"news_report": report,
|
||||
}
|
||||
|
||||
return news_analyst_node
|
||||
|
||||
Reference in New Issue
Block a user