OpenAI-DotNet icon indicating copy to clipboard operation
OpenAI-DotNet copied to clipboard

Enable Assistant Tool Function Methods to be updated

Open Bodekaer opened this issue 9 months ago • 1 comments

@StephenHodgson do you know how to assign local methods to Assistant functions when using the RetrieveAssistantAsync() method, where the OpenAI server-side assistant already has defined functions?

I find the documentation unclear on this, and so far been unable to find a way to assign a method to an existing list of tools.

E.g. I would have expected something like:

_assistant = await _openai.AssistantsEndpoint.RetrieveAssistantAsync(assistantId);
foreach (var tool in _assistant.Tools){
   tool.Function.Method = myLocalMethod;
}

Bodekaer avatar May 15 '24 13:05 Bodekaer

I'll add this along with ability to update tools to fix https://github.com/RageAgainstThePixel/OpenAI-DotNet/discussions/298 and https://github.com/RageAgainstThePixel/OpenAI-DotNet/discussions/303

StephenHodgson avatar May 15 '24 16:05 StephenHodgson

Ok, after looking into this more closely I don't feel like it is appropriate to be able to update the method to call.

I did add the ability to unregister a tool, and register a new one if you need to update it for some reason like this.

Don't forget you can always parse out the args/params yourself and then invoke it on the target/method directly.

StephenHodgson avatar Jun 10 '24 06:06 StephenHodgson