Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.25k stars 4.59k forks source link

[QUERY] OpenAI not accepting tools #40759

Open sabbadino opened 9 months ago

sabbadino commented 9 months ago

Library name and version

Azure.AI.OpenAI beta 0.11

Query/Question

here https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.openai-readme?view=azure-dotnet-preview#use-your-own-data-with-azure-openai

about tools , it appears that they are a concept that abstract the concept of functions .. and state "Chat Functions are a legacy form of chat tools"

but it looks like non being an abstraction .. if i replace functions with tolls I get (Calling azure open ai instance gpt-4-32k)

Azure.RequestFailedException: Unrecognized request argument supplied: tools Status: 400 (model_error)

Content: { "error": { "message": "Unrecognized request argument supplied: tools", "type": "invalid_request_error", "param": null, "code": null } }

Can you please clarify the scenario where i should use tools instead of function calling ?

thanks enrico

Environment

No response

github-actions[bot] commented 9 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @trrwilson.

github-actions[bot] commented 9 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @trrwilson.

trrwilson commented 9 months ago

Thanks for getting in touch!

Both Microsoft and OpenAI need to clarify this better: Tools conceptually replace Functions for chat completions, but -- as you've seen -- the specification of tools isn't accepted by all available model versions yet. Libraries continue to provide the ability to provide either Functions or Tools, and that'll continue to be the case until all available models accept the newer Tools format, at which point we can entirely remove the confusing co-existence problem of Tools and Functions.

In essence,

sabbadino commented 9 months ago

Thanks for the Clarifications.. I had assumed that 1106 models accepted tools only for assistant api.. But I was wrong.. I will review the documentation.

feffe81 commented 7 months ago

I get the same error when I follow this tutorial: https://learn.microsoft.com/en-us/semantic-kernel/overview/#how-many-agents-does-it-take-to-change-a-lightbulb

West Europe

Modellname: gpt-35-turbo Modellversion: 0301

So I understand the version is too low?

panuoksala commented 6 months ago

Getting this same error with Semantic Kernel and Semantic Kernel OpenAI Planner. Problem is that Azure OpenAI seems to offer only model version 0301. Any work around for this?

image

panuoksala commented 6 months ago

Well as work around I can use HandlebarsPlanner, not FunctionCallingStepwisePlanner.

feffe81 commented 6 months ago

I did not use planners at all so fas so I can not follow as I am quite new to this. Could you post an example how the ToggleLightBulb Plugin would be invoked with this workaround?

panuoksala commented 6 months ago

Have you tried to change ToolCallBehavior or implement own function there?

feffe81 commented 6 months ago

Neither. I just stopped following the tutorial and went back to other tasks :-)

Maybe I need to read more about all that and see what options I have. Initially I wanted to implement RAG and the functions seemed one option. But manually invoking them in the prompt does not seem like artificial intelligence....

panuoksala commented 6 months ago

I found these samples lot better: https://github.com/Azure/AI-in-a-Box/tree/main/gen-ai

feffe81 commented 6 months ago

THX. I just dived into the topic using https://blog.brakmic.com/intro-to-semantic-kernel-part-two/

feffe81 commented 6 months ago

@panuoksala Now I understood what you mean with "Well as work around I can use HandlebarsPlanner, not FunctionCallingStepwisePlanner." and it works! Thanks for providing me the gen-ai github examples.

sabbadino commented 6 months ago

The point is about the open ai chat completion version supporting tools calls . That is "bare metal".

This thread is not for ppl playing with ai using high level wrapper such as semantich kernel or lang chain :)