openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Assistants/Assistant.cs
35lines · modecode
| 1 | using System.ClientModel; |
| 2 | using System.ClientModel.Primitives; |
| 3 | using System.Diagnostics.CodeAnalysis; |
| 4 | using System.Text.Json; |
| 5 | |
| 6 | namespace OpenAI.Assistants; |
| 7 | |
| 8 | [CodeGenType("AssistantObject")] |
| 9 | public partial class Assistant |
| 10 | { |
| 11 | private const string AssistantValue = "assistant"; |
| 12 | |
| 13 | // CUSTOM: Made internal. |
| 14 | /// <summary> The object type, which is always `assistant`. </summary> |
| 15 | [CodeGenMember("Object")] |
| 16 | internal string Object { get; } = AssistantValue; |
| 17 | |
| 18 | /// <inheritdoc cref="AssistantResponseFormat"/> |
| 19 | public AssistantResponseFormat ResponseFormat { get; } |
| 20 | |
| 21 | /// <summary> |
| 22 | /// 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. |
| 23 | /// |
| 24 | /// We generally recommend altering this or temperature but not both. |
| 25 | /// </summary> |
| 26 | [CodeGenMember("TopP")] |
| 27 | public float? NucleusSamplingFactor { get; } |
| 28 | |
| 29 | internal static Assistant FromClientResult(ClientResult result) |
| 30 | { |
| 31 | using PipelineResponse response = result.GetRawResponse(); |
| 32 | using JsonDocument document = JsonDocument.Parse(response.Content); |
| 33 | return DeserializeAssistant(document.RootElement, ModelSerializationExtensions.WireOptions); |
| 34 | } |
| 35 | } |
| 36 | |