Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

- Changed name of return types from methods returning streaming collections from `ResultCollection` to `CollectionResult` [#105](https://github.com/openai/openai-dotnet/pull/105).
- Changed return types from methods returning paginated collections from `PageableCollection` to `PageCollection` [#105](https://github.com/openai/openai-dotnet/pull/105). Users must now call `GetAllValues` on the collection of pages to enumerate collection items directly. Corresponding protocol methods return `IEnumerable<ClientResult>` where each collection item represents a single service response holding a page of values.
- Updated `VectorStoreFileCounts` and `VectorStoreFileAssociationError` types from `readonly struct` to `class`.

### Other Changes

- Removed the usage of `init` and updated properties to use `set`.

### Bugs Fixed

Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/Assistant.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

[CodeGenModel("AssistantObject")]
public partial class Assistant
Expand Down
10 changes: 5 additions & 5 deletions src/Custom/Assistants/AssistantCollectionOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

/// <summary>
/// Represents addition options available when requesting a collection of <see cref="Assistant"/> instances.
Expand All @@ -14,20 +14,20 @@ public AssistantCollectionOptions() { }
/// The <c>order</c> that results should appear in the list according to
/// their <c>created_at</c> timestamp.
/// </summary>
public ListOrder? Order { get; init; }
public ListOrder? Order { get; set; }

/// <summary>
/// The number of values to return in a page result.
/// </summary>
public int? PageSize { get; init; }
public int? PageSize { get; set; }

/// <summary>
/// The id of the item preceeding the first item in the collection.
/// </summary>
public string AfterId { get; init; }
public string AfterId { get; set; }

/// <summary>
/// The id of the item following the last item in the collection.
/// </summary>
public string BeforeId { get; init; }
public string BeforeId { get; set; }
}
6 changes: 3 additions & 3 deletions src/Custom/Assistants/AssistantCreationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ public partial class AssistantCreationOptions

/// <inheritdoc cref="ToolResources"/>
[CodeGenMember("ToolResources")]
public ToolResources ToolResources { get; init; }
public ToolResources ToolResources { get; set; }

/// <inheritdoc cref="AssistantResponseFormat"/>
[CodeGenMember("ResponseFormat")]
public AssistantResponseFormat ResponseFormat { get; init; }
public AssistantResponseFormat ResponseFormat { get; set; }

/// <summary>
/// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
///
/// We generally recommend altering this or temperature but not both.
/// </summary>
[CodeGenMember("TopP")]
public float? NucleusSamplingFactor { get; init; }
public float? NucleusSamplingFactor { get; set; }

internal AssistantCreationOptions(InternalCreateAssistantRequestModel model)
: this()
Expand Down
10 changes: 5 additions & 5 deletions src/Custom/Assistants/AssistantModificationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class AssistantModificationOptions
/// <summary>
/// The replacement model that the assistant should use.
/// </summary>
public string Model { get; init; }
public string Model { get; set; }

/// <summary>
/// <para>
Expand All @@ -20,24 +20,24 @@ 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`.
/// </summary>
[CodeGenMember("Tools")]
public IList<ToolDefinition> DefaultTools { get; init; } = new ChangeTrackingList<ToolDefinition>();
public IList<ToolDefinition> DefaultTools { get; set; } = new ChangeTrackingList<ToolDefinition>();

// CUSTOM: reuse common request/response models for tool resources. Note that modification operations use the
// response models (which do not contain resource initialization helpers).

/// <inheritdoc cref="ToolResources"/>
[CodeGenMember("ToolResources")]
public ToolResources ToolResources { get; init; }
public ToolResources ToolResources { get; set; }

/// <inheritdoc cref="AssistantResponseFormat"/>
[CodeGenMember("ResponseFormat")]
public AssistantResponseFormat ResponseFormat { get; init; }
public AssistantResponseFormat ResponseFormat { get; set; }

/// <summary>
/// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
///
/// We generally recommend altering this or temperature but not both.
/// </summary>
[CodeGenMember("TopP")]
public float? NucleusSamplingFactor { get; init; }
public float? NucleusSamplingFactor { get; set; }
}
2 changes: 1 addition & 1 deletion src/Custom/Assistants/AssistantThread.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

[CodeGenModel("ThreadObject")]
public partial class AssistantThread
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/AssistantsPageEnumerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Text.Json;
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/AssistantsPageToken.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ClientModel;
using System.Diagnostics;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/CodeInterpreterToolResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class CodeInterpreterToolResources
public IList<string> FileIds
{
get => _fileIds;
init
set
{
_fileIds = new ChangeTrackingList<string>();
foreach (string fileId in value)
Expand Down
4 changes: 2 additions & 2 deletions src/Custom/Assistants/FileSearchToolDefinition.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

Expand All @@ -11,7 +11,7 @@ public partial class FileSearchToolDefinition : ToolDefinition
public int? MaxResults
{
get => _fileSearch?.InternalMaxNumResults;
init => _fileSearch.InternalMaxNumResults = value;
set => _fileSearch.InternalMaxNumResults = value;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/FileSearchToolResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class FileSearchToolResources
public IList<string> VectorStoreIds
{
get => _vectorStoreIds;
init
set
{
_vectorStoreIds = new ChangeTrackingList<string>();
foreach (string item in value)
Expand Down
8 changes: 4 additions & 4 deletions src/Custom/Assistants/FunctionToolDefinition.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

Expand All @@ -17,21 +17,21 @@ public partial class FunctionToolDefinition : ToolDefinition
public required string FunctionName
{
get => _internalFunction.Name;
init => _internalFunction.Name = value;
set => _internalFunction.Name = value;
}

/// <inheritdoc cref="InternalFunctionDefinition.Description"/>
public string Description
{
get => _internalFunction.Description;
init => _internalFunction.Description = value;
set => _internalFunction.Description = value;
}

/// <inheritdoc cref="InternalFunctionDefinition.Parameters"/>
public BinaryData Parameters
{
get => _internalFunction.Parameters;
init => _internalFunction.Parameters = value;
set => _internalFunction.Parameters = value;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/GeneratorStubs.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

/*
* This file stubs and performs minimal customization to generated public types for the OpenAI.Assistants namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

/*
* This file stubs and performs minimal customization to generated internal types for the OpenAI.Assistants namespace.
Expand Down
10 changes: 5 additions & 5 deletions src/Custom/Assistants/MessageCollectionOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

/// <summary>
/// Represents addition options available when requesting a collection of <see cref="ThreadMessage"/> instances.
Expand All @@ -14,20 +14,20 @@ public MessageCollectionOptions() { }
/// The <c>order</c> that results should appear in the list according to
/// their <c>created_at</c> timestamp.
/// </summary>
public ListOrder? Order { get; init; }
public ListOrder? Order { get; set; }

/// <summary>
/// The number of values to return in a page result.
/// </summary>
public int? PageSize { get; init; }
public int? PageSize { get; set; }

/// <summary>
/// The id of the item preceeding the first item in the collection.
/// </summary>
public string AfterId { get; init; }
public string AfterId { get; set; }

/// <summary>
/// The id of the item following the last item in the collection.
/// </summary>
public string BeforeId { get; init; }
public string BeforeId { get; set; }
}
2 changes: 1 addition & 1 deletion src/Custom/Assistants/MessageContent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;

namespace OpenAI.Assistants;
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/MessageImageDetail.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

/// <summary>
/// The available detail settings to use when processing an image.
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/MessagesPageEnumerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Text.Json;
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/Assistants/MessagesPageToken.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ClientModel;
using System.Diagnostics;
using System.IO;
Expand Down
10 changes: 5 additions & 5 deletions src/Custom/Assistants/RunCollectionOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenAI.Assistants;
namespace OpenAI.Assistants;

/// <summary>
/// Represents addition options available when requesting a collection of <see cref="ThreadRun"/> instances.
Expand All @@ -14,20 +14,20 @@ public RunCollectionOptions() { }
/// The <c>order</c> that results should appear in the list according to
/// their <c>created_at</c> timestamp.
/// </summary>
public ListOrder? Order { get; init; }
public ListOrder? Order { get; set; }

/// <summary>
/// The number of values to return in a page result.
/// </summary>
public int? PageSize { get; init; }
public int? PageSize { get; set; }

/// <summary>
/// The id of the item preceeding the first item in the collection.
/// </summary>
public string AfterId { get; init; }
public string AfterId { get; set; }

/// <summary>
/// The id of the item following the last item in the collection.
/// </summary>
public string BeforeId { get; init; }
public string BeforeId { get; set; }
}
22 changes: 11 additions & 11 deletions src/Custom/Assistants/RunCreationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ public partial class RunCreationOptions

/// <inheritdoc cref="AssistantResponseFormat"/>
[CodeGenMember("ResponseFormat")]
public AssistantResponseFormat ResponseFormat { get; init; }
public AssistantResponseFormat ResponseFormat { get; set; }

/// <summary>
/// A run-specific model name that will override the assistant's defined model. If not provided, the assistant's
/// selection will be used.
/// </summary>
[CodeGenMember("Model")]
public string ModelOverride { get; init; }
public string ModelOverride { get; set; }

/// <summary>
/// A run specific replacement for the assistant's default instructions that will override the assistant-level
/// instructions. If not specified, the assistant's instructions will be used.
/// </summary>
[CodeGenMember("Instructions")]
public string InstructionsOverride { get; init; }
public string InstructionsOverride { get; set; }

/// <summary>
/// Run-specific additional instructions that will be appended to the assistant-level instructions solely for this
/// run. Unlike <see cref="InstructionsOverride"/>, the assistant's instructions are preserved and these additional
/// instructions are concatenated.
/// </summary>
[CodeGenMember("AdditionalInstructions")]
public string AdditionalInstructions { get; init; }
public string AdditionalInstructions { get; set; }

/// <summary> Adds additional messages to the thread before creating the run. </summary>
public IList<ThreadInitializationMessage> AdditionalMessages { get; } = new ChangeTrackingList<ThreadInitializationMessage>();
Expand Down Expand Up @@ -73,7 +73,7 @@ private set
/// Assumed <c>true</c> if not otherwise specified.
/// </remarks>
[CodeGenMember("ParallelToolCalls")]
public bool? ParallelToolCallsEnabled { get; init; }
public bool? ParallelToolCallsEnabled { get; set; }

/// <summary>
/// A run-specific collection of tool definitions that will override the assistant-level defaults. If not provided,
Expand Down Expand Up @@ -102,30 +102,30 @@ private set
public IDictionary<string, string> Metadata { get; } = new ChangeTrackingDictionary<string, string>();

/// <summary> What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. </summary>
public float? Temperature { get; init; }
public float? Temperature { get; set; }

/// <summary>
/// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
///
/// We generally recommend altering this or temperature but not both.
/// </summary>
[CodeGenMember("TopP")]
public float? NucleusSamplingFactor { get; init; }
public float? NucleusSamplingFactor { get; set; }

/// <summary> The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. </summary>
public int? MaxPromptTokens { get; init; }
public int? MaxPromptTokens { get; set; }

/// <summary> The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. </summary>
public int? MaxCompletionTokens { get; init; }
public int? MaxCompletionTokens { get; set; }

/// <summary> Gets or sets the truncation strategy. </summary>
public RunTruncationStrategy TruncationStrategy { get; init; }
public RunTruncationStrategy TruncationStrategy { get; set; }

/// <summary>
///
/// </summary>
[CodeGenMember("ToolChoice")]
public ToolConstraint ToolConstraint { get; init; }
public ToolConstraint ToolConstraint { get; set; }

/// <summary>
/// Creates a new instance of <see cref="RunCreationOptions"/>.
Expand Down
Loading