openai / openai-dotnet

The official .NET library for the OpenAI API
https://www.nuget.org/packages/OpenAI
MIT License
707 stars 60 forks source link

OpenAI.Assistants.ToolsOverride is readonly #60

Closed dmeyeroc closed 2 weeks ago

dmeyeroc commented 2 weeks ago

The ToolsOverride property in OpenAI.Assistants appears to be defined as readonly. I'd like to use the property as I believe it is intended, which is to override the tools of my chosen assistant on a per-run basis.

Perhaps this is merely a fact of the setter/init not being implemented yet, or perhaps this is a mistake. Please add support or update the documentation to better demonstrate how this is to be done.

    //
    // Summary:
    //     A run-specific collection of tool definitions that will override the assistant-level
    //     defaults. If not provided, the assistant's defined tools will be used. Available
    //     tools include:
    //
    //     • code_interpreter - OpenAI.Assistants.CodeInterpreterToolDefinition - works
    //     with data, math, and computer code
    //     • file_search - OpenAI.Assistants.FileSearchToolDefinition - dynamically enriches
    //     an Run's context with content from vector stores
    //     • function - OpenAI.Assistants.FunctionToolDefinition - enables caller-provided
    //     custom functions for actions and enrichment
    [CodeGenMember("Tools")]
    public IList<ToolDefinition> ToolsOverride { get; } = new ChangeTrackingList<ToolDefinition>();
dspear commented 2 weeks ago

@dmeyeroc You should be able to initialize it with a static list, like { tool1, tool2 }, or by explicitly using Add, like x.ToolsOverride.Add(tool1), etc.

dmeyeroc commented 2 weeks ago

Ahh yes I see that now. Thanks for the quick response!

KrzysztofCwalina commented 2 weeks ago

@dmeyeroc, It seems like you have a resolution. I will close the issue then. Please feel free to reopen if you still run into problems.