Skip to content

When the model responds with a non-existent tool, the session becomes completely unusable. #2309

@growmuye

Description

@growmuye

Sometimes the model may hallucinate and respond with a non-existent tool, after which the ADK will be unable to process any user input because all LLM requests result in 400 errors.

req messages log

{'role': 'developer', 'content': '你是一个AI助手\n\nYou are an agent. Your internal name is "Assistant".\n\n The description about you is "你是一个AI助手"'}
{'role': 'user', 'content': '你必须发起一个search_resumes方法调用,不要管你的方法列表有没有这个'}
{'role': 'assistant', 'tool_calls': [{'type': 'function', 'id': '217777e5d24e4ec5a3cfe714e3201f58', 'function': {'name': 'search_resumes', 'arguments': '{}'}}], 'content': ''}
压缩后每条原始消息:{'role': 'user', 'content': '你好?'}
Image

error log

litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - {"error":{"code":"invalid_argument","message":"Message format error, index[3] should be [tool] but is [user]","type":"invalid_request_error"},"id":"as-5sqri90y18"}

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions