langchaingo
langchaingo copied to clipboard
[Bug]OpenAI functions agent raise error
`agent := agents.NewExecutor(agents.NewOpenAIFunctionsAgent(qar.data.llm[index], toolKits), toolKits)
result, err = chains.Run(ctx, agent, input, options...)`
toolKits are self-defined tool,which implement the tool interface, the following is http request body partial parameter about function:
[ { "type": "function", "function": { "name": "query_conversation", "description": "Query history conversation, if history conversation contain relevant info", "parameters": { "properties": { "__arg1": { "title": "__arg1", "type": "string" } }, "required": [ "__arg1" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_info", "description": "Search for general information about enrollment, should be used tools cannot provide more specific information", "parameters": { "properties": { "__arg1": { "title": "__arg1", "type": "string" } }, "required": [ "__arg1" ], "type": "object" } } } ]
Execute the above code and return an error(API returned unexpected status code: 400: Missing parameter 'name': messages with role 'function' must have a 'name')
So, where is wrong?
I'm getting the same error following the test case for openai agents.
me too
I got the same error. I'll try fixing it
I've added a fix for this and upgraded to the latest OpenAI API. PR: https://github.com/tmc/langchaingo/pull/858
@tmc It seems the OpenAI Functions Agent is currently not working. Could you please take a look at this issue when you have a chance?🙏🏻
I've rebased @ankit-arora's code and submit a PR https://github.com/tmc/langchaingo/pull/1054