test mcp agent

This commit is contained in:
Ishaan Jaff 2025-03-21 17:48:16 -07:00
parent d5765d0193
commit 19d6051dba

View file

@ -42,11 +42,12 @@ async def test_mcp_agent():
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.getenv("OPENAI_API_KEY"),
messages=messages, messages=messages,
tools=tools, tools=tools,
tool_choice="required",
) )
print("LLM RESPONSE: ", json.dumps(llm_response, indent=4, default=str)) print("LLM RESPONSE: ", json.dumps(llm_response, indent=4, default=str))
# Add assertions to verify the response # Add assertions to verify the response
assert llm_response["choices"][0]["message"]["tool_calls"] is not None assert llm_response["choices"][0]["message"]["tool_calls"] is not None
assert ( assert (
llm_response["choices"][0]["message"]["tool_calls"][0]["function"][ llm_response["choices"][0]["message"]["tool_calls"][0]["function"][
"name" "name"