julep-ai / julep

A new DSL and server for AI agents and multi-step tasks
https://julep.ai
Apache License 2.0
2.67k stars 904 forks source link

[Bug]: `chat` endpoint fails when the agent has an `integration` tool #825

Open HamadaSalhab opened 2 weeks ago

HamadaSalhab commented 2 weeks ago

πŸ“œ Description

When an integration tool is added to the model, and the chat endpoint is called, it returns a 500: Internal server error.

To reproduce:


agent = client.agents.create(name="test agent", about="", model="gpt-4o")

tool = client.agents.tools.create(
    agent_id=agent.id,
    **{
        "name": "weatherx",
        "type": "integration",
        "integration": {
            "provider": "weather",
            "setup": {
                "openweathermap_api_key": "OPENWEATHERMAP_API_KEY"
            }
        }
    }
)

session = client.sessions.create(agent=agent.id)
session.id

client.sessions.chat(
    session_id=session.id,
    messages=[
        {"role": "user", "content": "What is the weather in London?"}
    ],
    recall=False
)

Error log:

agents-api-multi-tenant-1      | litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - Error code: 400 - {'error': {'message': 'litellm.BadRequestError: OpenAIException - Error code: 400 - {\'error\': {\'message\': "Invalid type for \'tools[0].function\': expected a function definition, but got null instead.", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function\', \'code\': \'invalid_type\'}}\nReceived Model Group=gpt-4o\nAvailable Model Group Fallbacks=None', 'type': None, 'param': None, 'code': '400'}}

πŸ‘Ÿ Reproduction steps

No response

πŸ‘€ Have you spent some time to check if this bug has been raised before?