azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[QUERY] OpenAI not accepting tools

Open sabbadino opened this issue 1 year ago • 14 comments

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

sabbadino avatar Dec 13 '23 17:12 sabbadino

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

github-actions[bot] avatar Dec 13 '23 17:12 github-actions[bot]

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

github-actions[bot] avatar Dec 13 '23 17:12 github-actions[bot]

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,

  • If the model+version you're using can use Tools, and especially if it's a newer 1106 model that supports parallel tool calling, we encourage you to use Tools, and this is the longer-term "client callback" mechanism that's also reflected in e.g. the brand-new Assistants surface from OpenAI.
  • If the model+version you're using can't use Tools yet or you need to support a combination of models+versions with some not yet able to use Tools, you can continue to use Functions just as before -- Functions will not work with parallel calling like Tools can with newer models, but Functions continue to be fully supported in the interim.

trrwilson avatar Dec 13 '23 17:12 trrwilson

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.

sabbadino avatar Dec 13 '23 18:12 sabbadino

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?

feffe81 avatar Feb 15 '24 09:02 feffe81

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 avatar Feb 19 '24 06:02 panuoksala

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

panuoksala avatar Feb 19 '24 06:02 panuoksala

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?

feffe81 avatar Feb 19 '24 08:02 feffe81

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

panuoksala avatar Feb 19 '24 09:02 panuoksala

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....

feffe81 avatar Feb 19 '24 09:02 feffe81

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

panuoksala avatar Feb 19 '24 09:02 panuoksala

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

feffe81 avatar Feb 19 '24 10:02 feffe81

@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.

feffe81 avatar Feb 19 '24 15:02 feffe81

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 :)

sabbadino avatar Feb 19 '24 18:02 sabbadino