openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Assistants/AssistantCreationOptions.cs
55lines · modecode
| 1 | using System.Collections.Generic; |
| 2 | |
| 3 | namespace OpenAI.Assistants; |
| 4 | |
| 5 | /// <summary> |
| 6 | /// Represents additional options available when creating a new <see cref="Assistant"/>. |
| 7 | /// </summary> |
| 8 | [CodeGenModel("CreateAssistantRequest")] |
| 9 | [CodeGenSuppress(nameof(AssistantCreationOptions), typeof(string))] |
| 10 | public partial class AssistantCreationOptions |
| 11 | { |
| 12 | // CUSTOM: visibility hidden to promote required property to method parameter |
| 13 | internal string Model { get; set; } |
| 14 | |
| 15 | /// <summary> |
| 16 | /// <para> |
| 17 | /// A list of tool enabled on the assistant. |
| 18 | /// </para> |
| 19 | /// There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`. |
| 20 | /// </summary> |
| 21 | [CodeGenMember("Tools")] |
| 22 | public IList<ToolDefinition> Tools { get; } = new ChangeTrackingList<ToolDefinition>(); |
| 23 | |
| 24 | /// <inheritdoc cref="ToolResources"/> |
| 25 | [CodeGenMember("ToolResources")] |
| 26 | public ToolResources ToolResources { get; init; } |
| 27 | |
| 28 | /// <inheritdoc cref="AssistantResponseFormat"/> |
| 29 | [CodeGenMember("ResponseFormat")] |
| 30 | public AssistantResponseFormat ResponseFormat { get; init; } |
| 31 | |
| 32 | /// <summary> |
| 33 | /// 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. |
| 34 | /// |
| 35 | /// We generally recommend altering this or temperature but not both. |
| 36 | /// </summary> |
| 37 | [CodeGenMember("TopP")] |
| 38 | public float? NucleusSamplingFactor { get; init; } |
| 39 | |
| 40 | internal AssistantCreationOptions(InternalCreateAssistantRequestModel model) |
| 41 | : this() |
| 42 | { |
| 43 | Model = model.ToString(); |
| 44 | } |
| 45 | |
| 46 | /// <summary> |
| 47 | /// Creates a new instance of <see cref="AssistantCreationOptions"/>. |
| 48 | /// </summary> |
| 49 | public AssistantCreationOptions() |
| 50 | { |
| 51 | Metadata = new ChangeTrackingDictionary<string, string>(); |
| 52 | Tools = new ChangeTrackingList<ToolDefinition>(); |
| 53 | ToolResources = new(); |
| 54 | } |
| 55 | } |