Skip to content

Tools in Response API should not be readonly #470

Closed
@gaspardpetit

Description

@gaspardpetit

Service

OpenAI

Describe the bug

Thank you for adding samples with the Response API (dcf3838).

I added a few changelist, I believe the documentation is incorrect in a few places.

In particular, I do not think it is currently possible to assign a Tool as described:

   new ResponseCreationOptions()
    {
        Tools = { ResponseTool.CreateWebSearchTool() },
    });

Since tools is only provided in the code with a getter, and no setter:

ResponseCreationOptions:

public IList<ResponseTool> Tools { get; }

Most likely, the setter should be added.

Steps to reproduce

Try to compile the README.md sample, in particular:

new ResponseCreationOptions()
{
Tools = { ResponseTool.CreateWebSearchTool() },
});

Expect the code to compile;

Observe that the following error is generated:

Property or indexer 'ResponseCreationOptions.Tools' cannot be assigned to -- it is read only

Code snippets

OS

Windows

.NET version

.Net 9.0

Library version

2.2.0-beta.4

Metadata

Metadata

Assignees

Labels

issue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions