按照langchain官方文档Build an Agent的示例代码进行测试,使用deepseek模型,调用Tavily查询天气,报错:
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'code': 'invalid_parameter_error', 'param': None, 'message': '<400> InternalError.Algo.InvalidParameter: The tool call is not supported.', 'type': 'invalid_request_error'},
from langchain.chat_models import init_chat_model
from langchain_community.tools.tavily_search import TavilySearchResults
from dotenv import load_dotenv
load_dotenv()
model = init_chat_model('deepseek-r1',model_provider='openai')
search = TavilySearchResults(max_results=2)
tools = [search]
model_with_tools = model.bind_tools(tools)
response = model_with_tools.invoke("今天北京的天气如何?")
print(f"ContentString: {response.content}")
print(f"ToolCalls: {response.tool_calls}")
chatgpt提供的解决方案是手动调用工具,然后把工具返回的结果交给大模型

最低0.47元/天 解锁文章
2606

被折叠的 条评论
为什么被折叠?



