Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorStoreIds in AssistantCreationOptions / FileSearchToolResources cannot be populated #301

Open
cpalm1974 opened this issue Dec 3, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@cpalm1974
Copy link

cpalm1974 commented Dec 3, 2024

Service

OpenAI

Describe the bug

With the constructor of AssistantCreationOptions / FileSearchToolRessources it's not possible to ever set a value for VectorStoreIds.
Since the field is left uninitialized it's not possible to use the Add method and also a new List cannot be assigned since the set-method is declared as internal.

Steps to reproduce

  1. See here:
AssistantCreationOptions options = new AssistantCreationOptions()
            {
                Name = "Test",
                Instructions = "Some instructions...",
                Tools = { ToolDefinition.CreateFileSearch(10) }
            };

options.ToolResources.FileSearch.VectorStoreIds.Add(myVectorStore.Id);

This compiles but throws an exception because "Add" requires a non-null Object on VectorStoreIds (which is missing in the constructor).

  1. This would also be expected to be possible:
AssistantCreationOptions options = new AssistantCreationOptions()
{
    Name = "Test",
    Instructions = "Some instructions...",
    Tools = { ToolDefinition.CreateFileSearch(10) },
    ToolResources = new FileSearchToolResources() {
            VectorStoreIds = [myVectorStoreId],
        } 
};

This example doesn't compile because VectorStoreIds is read only because of being "inline".

Code snippets

No response

OS

Windows 11

.NET version

8.0

Library version

2.1.0

@cpalm1974 cpalm1974 added the bug Something isn't working label Dec 3, 2024
@cpalm1974 cpalm1974 changed the title VectorStoreIds in AssistantCreationOptions cannot be populated VectorStoreIds in AssistantCreationOptions / FileSearchToolResources cannot be populated Dec 3, 2024
@Pigweed
Copy link

Pigweed commented Jan 28, 2025

Is there a workaround for this issue? I am stuck trying to make use of my vector store in C#.
Thanks.

@Pigweed
Copy link

Pigweed commented Jan 28, 2025

Is there a workaround for this issue? I am stuck trying to make use of my vector store in C#. Thanks.

I seem to have figured it out by doing this:

ToolResources = new ToolResources { FileSearch = new () { VectorStoreIds = { vectorStore.Id } }, CodeInterpreter = new CodeInterpreterToolResources { FileIds = { fileId } } }

Both are marked as get only and neither accepts the standard assignment methods.

@joseharriaga
Copy link
Collaborator

Thank you for reaching out, @cpalm1974 ! @Pigweed is correct.

The first code snippet in your original post fails because options.ToolResources is not initialized. You must first create a new ToolResources object. This new obect has a property called FileSearch, which you must also initialize by creating a new FileSearchToolResources instance.

The second code snippet in the original post does not compile because FileSearchToolResources is not the same type as the ToolResources property. Instead, like @Pigweed mentioned, ToolResources has a FileSearch property of type FileSearchToolResources.

As I'm typing this, I can see that the current naming is confusing. We will take this as feedback and rename these in the future to make the relationship between them clearer. Thank you!

@joseharriaga joseharriaga self-assigned this Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants