Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Open AI Function Calling #936

Open
codedash07 opened this issue Jun 19, 2024 · 6 comments
Open

Issue with Open AI Function Calling #936

codedash07 opened this issue Jun 19, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@codedash07
Copy link

codedash07 commented Jun 19, 2024

Issue:
For a use case, I have data in multiple sources PDFs, excel files, 3rd party APIs. I have uploaded PDF data to AI Search and configured it in the bot app, it works fine with PDF data. Now when I try to add more data sources like 3rd party APIs using function calling feature, application throws error - "400 - Functions are not supported for this API version or this model version." while enabling function calling feature. Functions are working fine with 4/4o GPT versions when tried separately.

In code, I am trying to add tools & tool_call parameters:
tools = [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location"],
},
},
}
]
model_args['tools'] = tools
model_args['tool_choice'] = 'auto'

Configuration:
Tried with GPT 4 & 40
version: 2024-05-01-preview

Can anyone please suggest the right way to do it.

@codedash07 codedash07 added the bug Something isn't working label Jun 19, 2024
@sarah-widder
Copy link
Contributor

Hi @codedash07, we recently (last 24 hours) updated the model support for data sources + functions. Can you give it another try? If it's still not working, can you share the exact model names & versions you're using, and which region your AOAI resource is in?

@codedash07
Copy link
Author

codedash07 commented Jun 25, 2024

@sarah-widder The newer codebase does not throws error "400 - Functions are not supported for this API version or this model version", . Any specific change was made in latest codebase?
For streamed responses with this bot, can you please share a sample usage with function calls. It would be really helpful.
I am trying to connect this bot with multiple data sources (multiple AI search indexes/3rd party APIs).
Thanks in advance.

@sarah-widder
Copy link
Contributor

sarah-widder commented Jun 26, 2024

@codedash07 there was a change on the service side to update the supported model list for function calling with data. For more information on function calling, please reference the documentation here. Currently, only one data source can be used at a time through the data_sources parameter.

@codedash07
Copy link
Author

codedash07 commented Jun 27, 2024

@sarah-widder Thanks for this information.
Is function calling only supported with Assistants API currently? Unable to find any documentation around async chat completion calls with function calling.
For non-stream chat completion calls its works fine.

image
Uploading image.png…

@sarah-widder
Copy link
Contributor

@codedash07 function calling is supported with chat completions, both streaming and non-streaming. For an SDK example, it may help to look at posts in the openai discussion forums - like this one or similar - https://community.openai.com/t/streaming-function-calls-does-not-return-an-id-with-tool-calls/608510/3

If the SDK is not working, calling the chat completions API directly is also always an option.

@codedash07
Copy link
Author

codedash07 commented Jul 3, 2024

@sarah-widder It seems like "streamed responses on UI" has stopped working in the latest codebase version. Is there ongoing any issue in frontend code, backend seems to generate JSON lines when stream=True?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants