diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs index 2365e0f19..b7dfb8e37 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs @@ -85,10 +85,12 @@ public async Task CanCreateGetAndDeleteVectorStores() deleted = await client.DeleteVectorStoreAsync(vectorStore.Id); Assert.That(deleted, Is.True); - vectorStore = await client.CreateVectorStoreAsync(new VectorStoreCreationOptions() + var options = new VectorStoreCreationOptions(); + foreach (var file in testFiles) { - FileIds = testFiles.Select(file => file.Id).ToList() - }); + options.FileIds.Add(file.Id); + } + vectorStore = await client.CreateVectorStoreAsync(options); Validate(vectorStore); Assert.Multiple(() => { diff --git a/.dotnet/CHANGELOG.md b/.dotnet/CHANGELOG.md index 26b286043..ac6341fbf 100644 --- a/.dotnet/CHANGELOG.md +++ b/.dotnet/CHANGELOG.md @@ -13,6 +13,7 @@ - Removed `ChatMessageContentPart`'s `ToString` overload. (commit_hash) - Removed the common `ListOrder` enum from the top-level `OpenAI` namespace in favor of individual enums in their corresponding sub-namespace. (commit_hash) - Renamed the `PageSize` property to `PageSizeLimit`. (commit_hash) +- Removed setter from collection properties. ### Bugs Fixed diff --git a/.dotnet/api/OpenAI.netstandard2.0.cs b/.dotnet/api/OpenAI.netstandard2.0.cs index 2c34e38e7..4998c5f07 100644 --- a/.dotnet/api/OpenAI.netstandard2.0.cs +++ b/.dotnet/api/OpenAI.netstandard2.0.cs @@ -280,7 +280,7 @@ public class AssistantCreationOptions : IJsonModel, IP BinaryData IPersistableModel.Write(ModelReaderWriterOptions options); } public class AssistantModificationOptions : IJsonModel, IPersistableModel { - public IList DefaultTools { get; set; } + public IList DefaultTools { get; } public string Description { get; set; } public string Instructions { get; set; } public IDictionary Metadata { get; set; } @@ -344,7 +344,7 @@ public class CodeInterpreterToolDefinition : ToolDefinition, IJsonModel.Write(ModelReaderWriterOptions options); } public class CodeInterpreterToolResources : IJsonModel, IPersistableModel { - public IList FileIds { get; set; } + public IList FileIds { get; } CodeInterpreterToolResources IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options); CodeInterpreterToolResources IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options); @@ -361,7 +361,7 @@ public class FileSearchToolDefinition : ToolDefinition, IJsonModel, IPersistableModel { public IList NewVectorStores { get; } - public IList VectorStoreIds { get; set; } + public IList VectorStoreIds { get; } FileSearchToolResources IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options); FileSearchToolResources IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options); @@ -2319,7 +2319,7 @@ public class VectorStoreCollectionOptions { public class VectorStoreCreationOptions : IJsonModel, IPersistableModel { public FileChunkingStrategy ChunkingStrategy { get; set; } public VectorStoreExpirationPolicy ExpirationPolicy { get; set; } - public IList FileIds { get; set; } + public IList FileIds { get; } public IDictionary Metadata { get; set; } public string Name { get; set; } VectorStoreCreationOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options); diff --git a/.dotnet/src/Custom/Assistants/AssistantModificationOptions.cs b/.dotnet/src/Custom/Assistants/AssistantModificationOptions.cs index 6d2544983..295559878 100644 --- a/.dotnet/src/Custom/Assistants/AssistantModificationOptions.cs +++ b/.dotnet/src/Custom/Assistants/AssistantModificationOptions.cs @@ -22,7 +22,7 @@ public partial class AssistantModificationOptions /// There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`. /// [CodeGenMember("Tools")] - public IList DefaultTools { get; set; } = new ChangeTrackingList(); + public IList DefaultTools { get; } = new ChangeTrackingList(); // CUSTOM: reuse common request/response models for tool resources. Note that modification operations use the // response models (which do not contain resource initialization helpers). diff --git a/.dotnet/src/Custom/Assistants/CodeInterpreterToolResources.cs b/.dotnet/src/Custom/Assistants/CodeInterpreterToolResources.cs index 6b763dc67..5f80800f4 100644 --- a/.dotnet/src/Custom/Assistants/CodeInterpreterToolResources.cs +++ b/.dotnet/src/Custom/Assistants/CodeInterpreterToolResources.cs @@ -14,7 +14,7 @@ public partial class CodeInterpreterToolResources public IList FileIds { get => _fileIds; - set + internal set { _fileIds = new ChangeTrackingList(); foreach (string fileId in value) diff --git a/.dotnet/src/Custom/Assistants/FileSearchToolResources.cs b/.dotnet/src/Custom/Assistants/FileSearchToolResources.cs index 8c199b06d..f85e5cf48 100644 --- a/.dotnet/src/Custom/Assistants/FileSearchToolResources.cs +++ b/.dotnet/src/Custom/Assistants/FileSearchToolResources.cs @@ -16,7 +16,7 @@ public partial class FileSearchToolResources public IList VectorStoreIds { get => _vectorStoreIds; - set + internal set { _vectorStoreIds = new ChangeTrackingList(); foreach (string item in value) diff --git a/.dotnet/src/Custom/VectorStores/VectorStoreCreationOptions.cs b/.dotnet/src/Custom/VectorStores/VectorStoreCreationOptions.cs index 066fb6194..a421d5901 100644 --- a/.dotnet/src/Custom/VectorStores/VectorStoreCreationOptions.cs +++ b/.dotnet/src/Custom/VectorStores/VectorStoreCreationOptions.cs @@ -7,9 +7,6 @@ namespace OpenAI.VectorStores; [CodeGenModel("CreateVectorStoreRequest")] public partial class VectorStoreCreationOptions { - /// A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. - public IList FileIds { get; set; } - /// Gets or sets the policy that controls when the new vector store will be automatically deleted. [CodeGenMember("ExpiresAfter")] public VectorStoreExpirationPolicy ExpirationPolicy { get; set; } diff --git a/.dotnet/src/Generated/Models/VectorStoreCreationOptions.cs b/.dotnet/src/Generated/Models/VectorStoreCreationOptions.cs index 6c26058e0..6d5f31216 100644 --- a/.dotnet/src/Generated/Models/VectorStoreCreationOptions.cs +++ b/.dotnet/src/Generated/Models/VectorStoreCreationOptions.cs @@ -25,6 +25,8 @@ internal VectorStoreCreationOptions(IList fileIds, string name, VectorSt Metadata = metadata; SerializedAdditionalRawData = serializedAdditionalRawData; } + + public IList FileIds { get; } public string Name { get; set; } public IDictionary Metadata { get; set; } } diff --git a/.dotnet/tests/Assistants/VectorStoreTests.cs b/.dotnet/tests/Assistants/VectorStoreTests.cs index 5f210ce48..ba11cb321 100644 --- a/.dotnet/tests/Assistants/VectorStoreTests.cs +++ b/.dotnet/tests/Assistants/VectorStoreTests.cs @@ -73,10 +73,13 @@ public void CanCreateGetAndDeleteVectorStores() Assert.That(deleted, Is.True); _vectorStoresToDelete.RemoveAt(_vectorStoresToDelete.Count - 1); - vectorStore = client.CreateVectorStore(new VectorStoreCreationOptions() + var options = new VectorStoreCreationOptions(); + foreach (var file in testFiles) { - FileIds = testFiles.Select(file => file.Id).ToList() - }); + options.FileIds.Add(file.Id); + } + vectorStore = client.CreateVectorStore(options); + Validate(vectorStore); Assert.Multiple(() => { @@ -324,11 +327,16 @@ public async Task CanApplyChunkingStrategy(ChunkingStrategyKind strategyKind) Assert.That(inputStaticStrategy.OverlappingTokenCount, Is.EqualTo(250)); } - VectorStore vectorStore = await client.CreateVectorStoreAsync(new VectorStoreCreationOptions() + var options = new VectorStoreCreationOptions() { - FileIds = testFiles.Select(file => file.Id).ToList(), ChunkingStrategy = chunkingStrategy, - }); + }; + foreach (var file in testFiles) + { + options.FileIds.Add(file.Id); + } + VectorStore vectorStore = client.CreateVectorStore(options); + Validate(vectorStore); Assert.That(vectorStore.FileCounts.Total, Is.EqualTo(5));