openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
api/api.md
1639lines · modecode
| 1 | ```csharp |
| 2 | namespace OpenAI { |
| 3 | public class OpenAIClient { |
| 4 | public OpenAIClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 5 | public OpenAIClient(OpenAIClientOptions options = null); |
| 6 | protected OpenAIClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 7 | protected OpenAIClient(); |
| 8 | public virtual ClientPipeline Pipeline { get; } |
| 9 | protected Uri Endpoint { get; } |
| 10 | internal [Experimental("OPENAI001")] |
| 11 | public virtual AssistantClient GetAssistantClient(); |
| 12 | public virtual AudioClient GetAudioClient(string model); |
| 13 | public virtual BatchClient GetBatchClient(); |
| 14 | public virtual ChatClient GetChatClient(string model); |
| 15 | public virtual EmbeddingClient GetEmbeddingClient(string model); |
| 16 | public virtual FileClient GetFileClient(); |
| 17 | public virtual FineTuningClient GetFineTuningClient(); |
| 18 | public virtual ImageClient GetImageClient(string model); |
| 19 | public virtual ModelClient GetModelClient(); |
| 20 | public virtual ModerationClient GetModerationClient(string model); |
| 21 | internal [Experimental("OPENAI001")] |
| 22 | public virtual VectorStoreClient GetVectorStoreClient(); |
| 23 | } |
| 24 | public class OpenAIClientOptions : ClientPipelineOptions { |
| 25 | public OpenAIClientOptions(); |
| 26 | public string ApplicationId { get; init; } |
| 27 | public Uri Endpoint { get; init; } |
| 28 | } |
| 29 | public readonly struct ListOrder : IEquatable<ListOrder> { |
| 30 | public ListOrder(string value); |
| 31 | public static ListOrder NewestFirst { get; } |
| 32 | public static ListOrder OldestFirst { get; } |
| 33 | public static bool operator ==(ListOrder left, ListOrder right); |
| 34 | public static implicit operator ListOrder(string value); |
| 35 | public static bool operator !=(ListOrder left, ListOrder right); |
| 36 | public bool Equals(ListOrder other); |
| 37 | public override bool Equals(object obj); |
| 38 | public override int GetHashCode(); |
| 39 | public override string ToString(); |
| 40 | } |
| 41 | } |
| 42 | namespace OpenAI.Assistants { |
| 43 | internal [Experimental("OPENAI001")] |
| 44 | public class AssistantClient { |
| 45 | protected AssistantClient(); |
| 46 | public AssistantClient(OpenAIClientOptions options = null); |
| 47 | public AssistantClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 48 | protected AssistantClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 49 | public virtual ClientResult<ThreadRun> CancelRun(ThreadRun run); |
| 50 | public virtual ClientResult CancelRun(string threadId, string runId, RequestOptions options); |
| 51 | public virtual ClientResult<ThreadRun> CancelRun(string threadId, string runId, CancellationToken cancellationToken = default); |
| 52 | public virtual Task<ClientResult<ThreadRun>> CancelRunAsync(ThreadRun run); |
| 53 | public virtual Task<ClientResult> CancelRunAsync(string threadId, string runId, RequestOptions options); |
| 54 | public virtual Task<ClientResult<ThreadRun>> CancelRunAsync(string threadId, string runId, CancellationToken cancellationToken = default); |
| 55 | public virtual ClientResult<Assistant> CreateAssistant(string model, AssistantCreationOptions options = null, CancellationToken cancellationToken = default); |
| 56 | public virtual ClientResult CreateAssistant(BinaryContent content, RequestOptions options = null); |
| 57 | public virtual Task<ClientResult<Assistant>> CreateAssistantAsync(string model, AssistantCreationOptions options = null, CancellationToken cancellationToken = default); |
| 58 | public virtual Task<ClientResult> CreateAssistantAsync(BinaryContent content, RequestOptions options = null); |
| 59 | public virtual ClientResult<ThreadMessage> CreateMessage(AssistantThread thread, MessageRole role, IEnumerable<MessageContent> content, MessageCreationOptions options = null); |
| 60 | public virtual ClientResult<ThreadMessage> CreateMessage(string threadId, MessageRole role, IEnumerable<MessageContent> content, MessageCreationOptions options = null, CancellationToken cancellationToken = default); |
| 61 | public virtual ClientResult CreateMessage(string threadId, BinaryContent content, RequestOptions options = null); |
| 62 | public virtual Task<ClientResult<ThreadMessage>> CreateMessageAsync(AssistantThread thread, MessageRole role, IEnumerable<MessageContent> content, MessageCreationOptions options = null); |
| 63 | public virtual Task<ClientResult<ThreadMessage>> CreateMessageAsync(string threadId, MessageRole role, IEnumerable<MessageContent> content, MessageCreationOptions options = null, CancellationToken cancellationToken = default); |
| 64 | public virtual Task<ClientResult> CreateMessageAsync(string threadId, BinaryContent content, RequestOptions options = null); |
| 65 | public virtual ClientResult<ThreadRun> CreateRun(AssistantThread thread, Assistant assistant, RunCreationOptions options = null); |
| 66 | public virtual ClientResult<ThreadRun> CreateRun(string threadId, string assistantId, RunCreationOptions options = null, CancellationToken cancellationToken = default); |
| 67 | public virtual ClientResult CreateRun(string threadId, BinaryContent content, RequestOptions options = null); |
| 68 | public virtual Task<ClientResult<ThreadRun>> CreateRunAsync(AssistantThread thread, Assistant assistant, RunCreationOptions options = null); |
| 69 | public virtual Task<ClientResult<ThreadRun>> CreateRunAsync(string threadId, string assistantId, RunCreationOptions options = null, CancellationToken cancellationToken = default); |
| 70 | public virtual Task<ClientResult> CreateRunAsync(string threadId, BinaryContent content, RequestOptions options = null); |
| 71 | public virtual ResultCollection<StreamingUpdate> CreateRunStreaming(AssistantThread thread, Assistant assistant, RunCreationOptions options = null); |
| 72 | public virtual ResultCollection<StreamingUpdate> CreateRunStreaming(string threadId, string assistantId, RunCreationOptions options = null, CancellationToken cancellationToken = default); |
| 73 | public virtual AsyncResultCollection<StreamingUpdate> CreateRunStreamingAsync(AssistantThread thread, Assistant assistant, RunCreationOptions options = null); |
| 74 | public virtual AsyncResultCollection<StreamingUpdate> CreateRunStreamingAsync(string threadId, string assistantId, RunCreationOptions options = null, CancellationToken cancellationToken = default); |
| 75 | public virtual ClientResult<AssistantThread> CreateThread(ThreadCreationOptions options = null, CancellationToken cancellationToken = default); |
| 76 | public virtual ClientResult CreateThread(BinaryContent content, RequestOptions options = null); |
| 77 | public virtual ClientResult<ThreadRun> CreateThreadAndRun(Assistant assistant, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null); |
| 78 | public virtual ClientResult<ThreadRun> CreateThreadAndRun(string assistantId, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null, CancellationToken cancellationToken = default); |
| 79 | public virtual ClientResult CreateThreadAndRun(BinaryContent content, RequestOptions options = null); |
| 80 | public virtual Task<ClientResult<ThreadRun>> CreateThreadAndRunAsync(Assistant assistant, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null); |
| 81 | public virtual Task<ClientResult<ThreadRun>> CreateThreadAndRunAsync(string assistantId, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null, CancellationToken cancellationToken = default); |
| 82 | public virtual Task<ClientResult> CreateThreadAndRunAsync(BinaryContent content, RequestOptions options = null); |
| 83 | public virtual ResultCollection<StreamingUpdate> CreateThreadAndRunStreaming(Assistant assistant, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null); |
| 84 | public virtual ResultCollection<StreamingUpdate> CreateThreadAndRunStreaming(string assistantId, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null, CancellationToken cancellationToken = default); |
| 85 | public virtual AsyncResultCollection<StreamingUpdate> CreateThreadAndRunStreamingAsync(Assistant assistant, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null); |
| 86 | public virtual AsyncResultCollection<StreamingUpdate> CreateThreadAndRunStreamingAsync(string assistantId, ThreadCreationOptions threadOptions = null, RunCreationOptions runOptions = null, CancellationToken cancellationToken = default); |
| 87 | public virtual Task<ClientResult<AssistantThread>> CreateThreadAsync(ThreadCreationOptions options = null, CancellationToken cancellationToken = default); |
| 88 | public virtual Task<ClientResult> CreateThreadAsync(BinaryContent content, RequestOptions options = null); |
| 89 | public virtual ClientResult<bool> DeleteAssistant(Assistant assistant); |
| 90 | public virtual ClientResult DeleteAssistant(string assistantId, RequestOptions options); |
| 91 | public virtual ClientResult<bool> DeleteAssistant(string assistantId, CancellationToken cancellationToken = default); |
| 92 | public virtual Task<ClientResult<bool>> DeleteAssistantAsync(Assistant assistant); |
| 93 | public virtual Task<ClientResult> DeleteAssistantAsync(string assistantId, RequestOptions options); |
| 94 | public virtual Task<ClientResult<bool>> DeleteAssistantAsync(string assistantId, CancellationToken cancellationToken = default); |
| 95 | |
| 96 | public virtual ClientResult<bool> DeleteMessage(ThreadMessage message); |
| 97 | public virtual ClientResult DeleteMessage(string threadId, string messageId, RequestOptions options); |
| 98 | public virtual ClientResult<bool> DeleteMessage(string threadId, string messageId, CancellationToken cancellationToken = default); |
| 99 | public virtual Task<ClientResult<bool>> DeleteMessageAsync(ThreadMessage message); |
| 100 | public virtual Task<ClientResult> DeleteMessageAsync(string threadId, string messageId, RequestOptions options); |
| 101 | public virtual Task<ClientResult<bool>> DeleteMessageAsync(string threadId, string messageId, CancellationToken cancellationToken = default); |
| 102 | public virtual ClientResult<bool> DeleteThread(AssistantThread thread); |
| 103 | public virtual ClientResult DeleteThread(string threadId, RequestOptions options); |
| 104 | public virtual ClientResult<bool> DeleteThread(string threadId, CancellationToken cancellationToken = default); |
| 105 | public virtual Task<ClientResult<bool>> DeleteThreadAsync(AssistantThread thread); |
| 106 | public virtual Task<ClientResult> DeleteThreadAsync(string threadId, RequestOptions options); |
| 107 | public virtual Task<ClientResult<bool>> DeleteThreadAsync(string threadId, CancellationToken cancellationToken = default); |
| 108 | public virtual ClientResult GetAssistant(string assistantId, RequestOptions options); |
| 109 | public virtual ClientResult<Assistant> GetAssistant(string assistantId, CancellationToken cancellationToken = default); |
| 110 | public virtual Task<ClientResult> GetAssistantAsync(string assistantId, RequestOptions options); |
| 111 | public virtual Task<ClientResult<Assistant>> GetAssistantAsync(string assistantId, CancellationToken cancellationToken = default); |
| 112 | public virtual ClientResult GetAssistants(int? limit, string order, string after, string before, RequestOptions options); |
| 113 | public virtual PageableCollection<Assistant> GetAssistants(ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 114 | public virtual Task<ClientResult> GetAssistantsAsync(int? limit, string order, string after, string before, RequestOptions options); |
| 115 | public virtual AsyncPageableCollection<Assistant> GetAssistantsAsync(ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 116 | public virtual ClientResult<ThreadMessage> GetMessage(ThreadMessage message); |
| 117 | public virtual ClientResult GetMessage(string threadId, string messageId, RequestOptions options); |
| 118 | public virtual ClientResult<ThreadMessage> GetMessage(string threadId, string messageId, CancellationToken cancellationToken = default); |
| 119 | public virtual Task<ClientResult<ThreadMessage>> GetMessageAsync(ThreadMessage message); |
| 120 | public virtual Task<ClientResult> GetMessageAsync(string threadId, string messageId, RequestOptions options); |
| 121 | public virtual Task<ClientResult<ThreadMessage>> GetMessageAsync(string threadId, string messageId, CancellationToken cancellationToken = default); |
| 122 | public virtual PageableCollection<ThreadMessage> GetMessages(AssistantThread thread, ListOrder? resultOrder = null); |
| 123 | public virtual ClientResult GetMessages(string threadId, int? limit, string order, string after, string before, RequestOptions options); |
| 124 | public virtual PageableCollection<ThreadMessage> GetMessages(string threadId, ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 125 | public virtual AsyncPageableCollection<ThreadMessage> GetMessagesAsync(AssistantThread thread, ListOrder? resultOrder = null); |
| 126 | public virtual Task<ClientResult> GetMessagesAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options); |
| 127 | public virtual AsyncPageableCollection<ThreadMessage> GetMessagesAsync(string threadId, ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 128 | public virtual ClientResult<ThreadRun> GetRun(ThreadRun run); |
| 129 | public virtual ClientResult GetRun(string threadId, string runId, RequestOptions options); |
| 130 | public virtual ClientResult<ThreadRun> GetRun(string threadId, string runId, CancellationToken cancellationToken = default); |
| 131 | public virtual Task<ClientResult<ThreadRun>> GetRunAsync(ThreadRun run); |
| 132 | public virtual Task<ClientResult> GetRunAsync(string threadId, string runId, RequestOptions options); |
| 133 | public virtual Task<ClientResult<ThreadRun>> GetRunAsync(string threadId, string runId, CancellationToken cancellationToken = default); |
| 134 | public virtual PageableCollection<ThreadRun> GetRuns(AssistantThread thread, ListOrder? resultOrder = null); |
| 135 | public virtual ClientResult GetRuns(string threadId, int? limit, string order, string after, string before, RequestOptions options); |
| 136 | public virtual PageableCollection<ThreadRun> GetRuns(string threadId, ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 137 | public virtual AsyncPageableCollection<ThreadRun> GetRunsAsync(AssistantThread thread, ListOrder? resultOrder = null); |
| 138 | public virtual Task<ClientResult> GetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options); |
| 139 | public virtual AsyncPageableCollection<ThreadRun> GetRunsAsync(string threadId, ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 140 | public virtual ClientResult GetRunStep(string threadId, string runId, string stepId, RequestOptions options); |
| 141 | public virtual ClientResult<RunStep> GetRunStep(string threadId, string runId, string stepId, CancellationToken cancellationToken = default); |
| 142 | public virtual Task<ClientResult> GetRunStepAsync(string threadId, string runId, string stepId, RequestOptions options); |
| 143 | public virtual Task<ClientResult<RunStep>> GetRunStepAsync(string threadId, string runId, string stepId, CancellationToken cancellationToken = default); |
| 144 | public virtual PageableCollection<RunStep> GetRunSteps(ThreadRun run, ListOrder? resultOrder = null); |
| 145 | public virtual ClientResult GetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options); |
| 146 | public virtual PageableCollection<RunStep> GetRunSteps(string threadId, string runId, ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 147 | public virtual AsyncPageableCollection<RunStep> GetRunStepsAsync(ThreadRun run, ListOrder? resultOrder = null); |
| 148 | public virtual Task<ClientResult> GetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options); |
| 149 | public virtual AsyncPageableCollection<RunStep> GetRunStepsAsync(string threadId, string runId, ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 150 | public virtual ClientResult<AssistantThread> GetThread(AssistantThread thread); |
| 151 | public virtual ClientResult GetThread(string threadId, RequestOptions options); |
| 152 | public virtual ClientResult<AssistantThread> GetThread(string threadId, CancellationToken cancellationToken = default); |
| 153 | public virtual Task<ClientResult<AssistantThread>> GetThreadAsync(AssistantThread thread); |
| 154 | public virtual Task<ClientResult> GetThreadAsync(string threadId, RequestOptions options); |
| 155 | public virtual Task<ClientResult<AssistantThread>> GetThreadAsync(string threadId, CancellationToken cancellationToken = default); |
| 156 | public virtual ClientResult<Assistant> ModifyAssistant(Assistant assistant, AssistantModificationOptions options); |
| 157 | public virtual ClientResult<Assistant> ModifyAssistant(string assistantId, AssistantModificationOptions options, CancellationToken cancellationToken = default); |
| 158 | public virtual ClientResult ModifyAssistant(string assistantId, BinaryContent content, RequestOptions options = null); |
| 159 | public virtual Task<ClientResult<Assistant>> ModifyAssistantAsync(Assistant assistant, AssistantModificationOptions options); |
| 160 | public virtual Task<ClientResult<Assistant>> ModifyAssistantAsync(string assistantId, AssistantModificationOptions options, CancellationToken cancellationToken = default); |
| 161 | public virtual Task<ClientResult> ModifyAssistantAsync(string assistantId, BinaryContent content, RequestOptions options = null); |
| 162 | public virtual ClientResult<ThreadMessage> ModifyMessage(ThreadMessage message, MessageModificationOptions options); |
| 163 | public virtual ClientResult<ThreadMessage> ModifyMessage(string threadId, string messageId, MessageModificationOptions options, CancellationToken cancellationToken = default); |
| 164 | public virtual ClientResult ModifyMessage(string threadId, string messageId, BinaryContent content, RequestOptions options = null); |
| 165 | public virtual Task<ClientResult<ThreadMessage>> ModifyMessageAsync(ThreadMessage message, MessageModificationOptions options); |
| 166 | public virtual Task<ClientResult<ThreadMessage>> ModifyMessageAsync(string threadId, string messageId, MessageModificationOptions options, CancellationToken cancellationToken = default); |
| 167 | public virtual Task<ClientResult> ModifyMessageAsync(string threadId, string messageId, BinaryContent content, RequestOptions options = null); |
| 168 | public virtual ClientResult ModifyRun(string threadId, string runId, BinaryContent content, RequestOptions options = null); |
| 169 | public virtual Task<ClientResult> ModifyRunAsync(string threadId, string runId, BinaryContent content, RequestOptions options = null); |
| 170 | public virtual ClientResult<AssistantThread> ModifyThread(AssistantThread thread, ThreadModificationOptions options); |
| 171 | public virtual ClientResult<AssistantThread> ModifyThread(string threadId, ThreadModificationOptions options, CancellationToken cancellationToken = default); |
| 172 | public virtual ClientResult ModifyThread(string threadId, BinaryContent content, RequestOptions options = null); |
| 173 | public virtual Task<ClientResult<AssistantThread>> ModifyThreadAsync(AssistantThread thread, ThreadModificationOptions options); |
| 174 | public virtual Task<ClientResult<AssistantThread>> ModifyThreadAsync(string threadId, ThreadModificationOptions options, CancellationToken cancellationToken = default); |
| 175 | public virtual Task<ClientResult> ModifyThreadAsync(string threadId, BinaryContent content, RequestOptions options = null); |
| 176 | public virtual ClientPipeline Pipeline { get; } |
| 177 | public virtual ClientResult<ThreadRun> SubmitToolOutputsToRun(ThreadRun run, IEnumerable<ToolOutput> toolOutputs); |
| 178 | public virtual ClientResult SubmitToolOutputsToRun(string threadId, string runId, BinaryContent content, RequestOptions options = null); |
| 179 | public virtual ClientResult<ThreadRun> SubmitToolOutputsToRun(string threadId, string runId, IEnumerable<ToolOutput> toolOutputs, CancellationToken cancellationToken = default); |
| 180 | public virtual Task<ClientResult<ThreadRun>> SubmitToolOutputsToRunAsync(ThreadRun run, IEnumerable<ToolOutput> toolOutputs); |
| 181 | public virtual Task<ClientResult> SubmitToolOutputsToRunAsync(string threadId, string runId, BinaryContent content, RequestOptions options = null); |
| 182 | public virtual Task<ClientResult<ThreadRun>> SubmitToolOutputsToRunAsync(string threadId, string runId, IEnumerable<ToolOutput> toolOutputs, CancellationToken cancellationToken = default); |
| 183 | public virtual ResultCollection<StreamingUpdate> SubmitToolOutputsToRunStreaming(ThreadRun run, IEnumerable<ToolOutput> toolOutputs); |
| 184 | public virtual ResultCollection<StreamingUpdate> SubmitToolOutputsToRunStreaming(string threadId, string runId, IEnumerable<ToolOutput> toolOutputs, CancellationToken cancellationToken = default); |
| 185 | public virtual AsyncResultCollection<StreamingUpdate> SubmitToolOutputsToRunStreamingAsync(ThreadRun run, IEnumerable<ToolOutput> toolOutputs); |
| 186 | public virtual AsyncResultCollection<StreamingUpdate> SubmitToolOutputsToRunStreamingAsync(string threadId, string runId, IEnumerable<ToolOutput> toolOutputs, CancellationToken cancellationToken = default); |
| 187 | } |
| 188 | public class AssistantCreationOptions { |
| 189 | public AssistantCreationOptions(); |
| 190 | public string Description { get; init; } |
| 191 | public string Instructions { get; init; } |
| 192 | public IDictionary<string, string> Metadata { get; } |
| 193 | public string Name { get; init; } |
| 194 | public float? NucleusSamplingFactor { get; init; } |
| 195 | public AssistantResponseFormat ResponseFormat { get; init; } |
| 196 | public float? Temperature { get; init; } |
| 197 | public ToolResources ToolResources { get; init; } |
| 198 | public IList<ToolDefinition> Tools { get; } |
| 199 | } |
| 200 | public class AssistantModificationOptions { |
| 201 | public AssistantModificationOptions(); |
| 202 | public IList<ToolDefinition> DefaultTools { get; init; } |
| 203 | public string Description { get; init; } |
| 204 | public string Instructions { get; init; } |
| 205 | public IDictionary<string, string> Metadata { get; } |
| 206 | public string Model { get; init; } |
| 207 | public string Name { get; init; } |
| 208 | public float? NucleusSamplingFactor { get; init; } |
| 209 | public AssistantResponseFormat ResponseFormat { get; init; } |
| 210 | public float? Temperature { get; init; } |
| 211 | public ToolResources ToolResources { get; init; } |
| 212 | } |
| 213 | public class MessageCreationOptions { |
| 214 | public MessageCreationOptions(); |
| 215 | public IList<MessageCreationAttachment> Attachments { get; } |
| 216 | public IDictionary<string, string> Metadata { get; } |
| 217 | public MessageRole Role { get; } |
| 218 | } |
| 219 | public class MessageModificationOptions { |
| 220 | public MessageModificationOptions(); |
| 221 | public IDictionary<string, string> Metadata { get; } |
| 222 | } |
| 223 | public class RunCreationOptions { |
| 224 | public RunCreationOptions(); |
| 225 | public string AdditionalInstructions { get; init; } |
| 226 | public IList<ThreadInitializationMessage> AdditionalMessages { get; } |
| 227 | public string InstructionsOverride { get; init; } |
| 228 | public int? MaxCompletionTokens { get; init; } |
| 229 | public int? MaxPromptTokens { get; init; } |
| 230 | public IDictionary<string, string> Metadata { get; } |
| 231 | public string ModelOverride { get; init; } |
| 232 | public float? NucleusSamplingFactor { get; init; } |
| 233 | public bool? ParallelToolCallsEnabled { get; init; } |
| 234 | public AssistantResponseFormat ResponseFormat { get; init; } |
| 235 | public float? Temperature { get; init; } |
| 236 | public ToolConstraint ToolConstraint { get; init; } |
| 237 | public IList<ToolDefinition> ToolsOverride { get; } |
| 238 | public RunTruncationStrategy TruncationStrategy { get; init; } |
| 239 | } |
| 240 | public class RunModificationOptions { |
| 241 | public RunModificationOptions(); |
| 242 | public IDictionary<string, string> Metadata { get; } |
| 243 | } |
| 244 | public class ThreadCreationOptions { |
| 245 | public ThreadCreationOptions(); |
| 246 | public IList<ThreadInitializationMessage> InitialMessages { get; } |
| 247 | public IDictionary<string, string> Metadata { get; } |
| 248 | public ToolResources ToolResources { get; init; } |
| 249 | } |
| 250 | public class ThreadModificationOptions { |
| 251 | public ThreadModificationOptions(); |
| 252 | public IDictionary<string, string> Metadata { get; } |
| 253 | public ToolResources ToolResources { get; init; } |
| 254 | } |
| 255 | public class Assistant { |
| 256 | public DateTimeOffset CreatedAt { get; } |
| 257 | public string Description { get; } |
| 258 | public string Id { get; } |
| 259 | public string Instructions { get; } |
| 260 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 261 | public string Model { get; } |
| 262 | public string Name { get; } |
| 263 | public float? NucleusSamplingFactor { get; } |
| 264 | public AssistantResponseFormat ResponseFormat { get; } |
| 265 | public float? Temperature { get; } |
| 266 | public ToolResources ToolResources { get; } |
| 267 | public IReadOnlyList<ToolDefinition> Tools { get; } |
| 268 | } |
| 269 | public class AssistantResponseFormat { |
| 270 | protected AssistantResponseFormat(); |
| 271 | public static AssistantResponseFormat Auto { get; } |
| 272 | public static AssistantResponseFormat JsonObject { get; } |
| 273 | public static AssistantResponseFormat Text { get; } |
| 274 | public static bool operator ==(AssistantResponseFormat left, AssistantResponseFormat right); |
| 275 | public static implicit operator AssistantResponseFormat(string value); |
| 276 | public static bool operator !=(AssistantResponseFormat left, AssistantResponseFormat right); |
| 277 | public bool Equals(AssistantResponseFormat other); |
| 278 | public override bool Equals(object obj); |
| 279 | public override int GetHashCode(); |
| 280 | public override string ToString(); |
| 281 | } |
| 282 | public class AssistantThread { |
| 283 | public DateTimeOffset CreatedAt { get; } |
| 284 | public string Id { get; } |
| 285 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 286 | public ToolResources ToolResources { get; } |
| 287 | } |
| 288 | public class CodeInterpreterToolDefinition : ToolDefinition { |
| 289 | public CodeInterpreterToolDefinition(); |
| 290 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 291 | } |
| 292 | public class CodeInterpreterToolResources { |
| 293 | public CodeInterpreterToolResources(); |
| 294 | public IList<string> FileIds { get; init; } |
| 295 | } |
| 296 | public class FileSearchToolDefinition : ToolDefinition { |
| 297 | public FileSearchToolDefinition(); |
| 298 | public int? MaxResults { get; init; } |
| 299 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 300 | } |
| 301 | public class FileSearchToolResources { |
| 302 | public FileSearchToolResources(); |
| 303 | public IList<VectorStoreCreationHelper> NewVectorStores { get; } |
| 304 | public IList<string> VectorStoreIds { get; init; } |
| 305 | } |
| 306 | public class FunctionToolDefinition : ToolDefinition { |
| 307 | internal [SetsRequiredMembers] |
| 308 | public FunctionToolDefinition(string name, string description = null, BinaryData parameters = null); |
| 309 | public FunctionToolDefinition(); |
| 310 | public string Description { get; init; } |
| 311 | public required string FunctionName { get; init; } |
| 312 | public BinaryData Parameters { get; init; } |
| 313 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 314 | } |
| 315 | public abstract class MessageContent { |
| 316 | protected MessageContent(); |
| 317 | public MessageImageDetail? ImageDetail { get; } |
| 318 | public string ImageFileId { get; } |
| 319 | public Uri ImageUrl { get; } |
| 320 | public string Text { get; } |
| 321 | public IReadOnlyList<TextAnnotation> TextAnnotations { get; } |
| 322 | public static MessageContent FromImageFileId(string imageFileId, MessageImageDetail? detail = null); |
| 323 | public static MessageContent FromImageUrl(Uri imageUri, MessageImageDetail? detail = null); |
| 324 | public static MessageContent FromText(string text); |
| 325 | public static implicit operator MessageContent(string value); |
| 326 | protected abstract void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 327 | } |
| 328 | public class MessageContentUpdate : StreamingUpdate { |
| 329 | public MessageImageDetail? ImageDetail { get; } |
| 330 | public string ImageFileId { get; } |
| 331 | public string MessageId { get; } |
| 332 | public int MessageIndex { get; } |
| 333 | public MessageRole? Role { get; } |
| 334 | public string Text { get; } |
| 335 | public TextAnnotationUpdate TextAnnotation { get; } |
| 336 | } |
| 337 | public class MessageCreationAttachment { |
| 338 | public MessageCreationAttachment(string fileId, IEnumerable<ToolDefinition> tools); |
| 339 | public string FileId { get; } |
| 340 | public IReadOnlyList<ToolDefinition> Tools { get; } |
| 341 | } |
| 342 | public class MessageFailureDetails { |
| 343 | public MessageFailureReason Reason { get; } |
| 344 | } |
| 345 | public readonly struct MessageFailureReason : IEquatable<MessageFailureReason> { |
| 346 | public MessageFailureReason(string value); |
| 347 | public static MessageFailureReason ContentFilter { get; } |
| 348 | public static MessageFailureReason MaxTokens { get; } |
| 349 | public static MessageFailureReason RunCancelled { get; } |
| 350 | public static MessageFailureReason RunExpired { get; } |
| 351 | public static MessageFailureReason RunFailed { get; } |
| 352 | public static bool operator ==(MessageFailureReason left, MessageFailureReason right); |
| 353 | public static implicit operator MessageFailureReason(string value); |
| 354 | public static bool operator !=(MessageFailureReason left, MessageFailureReason right); |
| 355 | public bool Equals(MessageFailureReason other); |
| 356 | public override bool Equals(object obj); |
| 357 | public override int GetHashCode(); |
| 358 | public override string ToString(); |
| 359 | } |
| 360 | public readonly struct MessageStatus : IEquatable<MessageStatus> { |
| 361 | public MessageStatus(string value); |
| 362 | public static MessageStatus Completed { get; } |
| 363 | public static MessageStatus Incomplete { get; } |
| 364 | public static MessageStatus InProgress { get; } |
| 365 | public static bool operator ==(MessageStatus left, MessageStatus right); |
| 366 | public static implicit operator MessageStatus(string value); |
| 367 | public static bool operator !=(MessageStatus left, MessageStatus right); |
| 368 | public bool Equals(MessageStatus other); |
| 369 | public override bool Equals(object obj); |
| 370 | public override int GetHashCode(); |
| 371 | public override string ToString(); |
| 372 | } |
| 373 | public class MessageStatusUpdate : StreamingUpdate<ThreadMessage> { |
| 374 | } |
| 375 | public class MessageTextContentAnnotation { |
| 376 | public int EndIndex { get; } |
| 377 | public string InputFileId { get; } |
| 378 | public string OutputFileId { get; } |
| 379 | public int StartIndex { get; } |
| 380 | public string TextToReplace { get; } |
| 381 | } |
| 382 | public abstract class RequiredAction { |
| 383 | protected RequiredAction(); |
| 384 | public string FunctionArguments { get; } |
| 385 | public string FunctionName { get; } |
| 386 | public string ToolCallId { get; } |
| 387 | } |
| 388 | public class RequiredActionUpdate : StreamingUpdate { |
| 389 | public string FunctionArguments { get; } |
| 390 | public string FunctionName { get; } |
| 391 | public string ToolCallId { get; } |
| 392 | public ThreadRun GetThreadRun(); |
| 393 | } |
| 394 | public class RunError { |
| 395 | public RunErrorCode Code { get; } |
| 396 | public string Message { get; } |
| 397 | } |
| 398 | public readonly struct RunErrorCode : IEquatable<RunErrorCode> { |
| 399 | public RunErrorCode(string value); |
| 400 | public static RunErrorCode InvalidPrompt { get; } |
| 401 | public static RunErrorCode RateLimitExceeded { get; } |
| 402 | public static RunErrorCode ServerError { get; } |
| 403 | public static bool operator ==(RunErrorCode left, RunErrorCode right); |
| 404 | public static implicit operator RunErrorCode(string value); |
| 405 | public static bool operator !=(RunErrorCode left, RunErrorCode right); |
| 406 | public bool Equals(RunErrorCode other); |
| 407 | public override bool Equals(object obj); |
| 408 | public override int GetHashCode(); |
| 409 | public override string ToString(); |
| 410 | } |
| 411 | public class RunIncompleteDetails { |
| 412 | public RunIncompleteReason? Reason { get; } |
| 413 | } |
| 414 | public readonly struct RunIncompleteReason : IEquatable<RunIncompleteReason> { |
| 415 | public RunIncompleteReason(string value); |
| 416 | public static RunIncompleteReason MaxCompletionTokens { get; } |
| 417 | public static RunIncompleteReason MaxPromptTokens { get; } |
| 418 | public static bool operator ==(RunIncompleteReason left, RunIncompleteReason right); |
| 419 | public static implicit operator RunIncompleteReason(string value); |
| 420 | public static bool operator !=(RunIncompleteReason left, RunIncompleteReason right); |
| 421 | public bool Equals(RunIncompleteReason other); |
| 422 | public override bool Equals(object obj); |
| 423 | public override int GetHashCode(); |
| 424 | public override string ToString(); |
| 425 | } |
| 426 | public readonly struct RunStatus : IEquatable<RunStatus> { |
| 427 | public RunStatus(string value); |
| 428 | public static RunStatus Cancelled { get; } |
| 429 | public static RunStatus Cancelling { get; } |
| 430 | public static RunStatus Completed { get; } |
| 431 | public static RunStatus Expired { get; } |
| 432 | public static RunStatus Failed { get; } |
| 433 | public static RunStatus Incomplete { get; } |
| 434 | public static RunStatus InProgress { get; } |
| 435 | public bool IsTerminal { get; } |
| 436 | public static RunStatus Queued { get; } |
| 437 | public static RunStatus RequiresAction { get; } |
| 438 | public static bool operator ==(RunStatus left, RunStatus right); |
| 439 | public static implicit operator RunStatus(string value); |
| 440 | public static bool operator !=(RunStatus left, RunStatus right); |
| 441 | public bool Equals(RunStatus other); |
| 442 | public override bool Equals(object obj); |
| 443 | public override int GetHashCode(); |
| 444 | public override string ToString(); |
| 445 | } |
| 446 | public class RunStep { |
| 447 | public string AssistantId { get; } |
| 448 | public DateTimeOffset? CancelledAt { get; } |
| 449 | public DateTimeOffset? CompletedAt { get; } |
| 450 | public DateTimeOffset CreatedAt { get; } |
| 451 | public RunStepDetails Details { get; } |
| 452 | public DateTimeOffset? ExpiredAt { get; } |
| 453 | public DateTimeOffset? FailedAt { get; } |
| 454 | public string Id { get; } |
| 455 | public RunStepError LastError { get; } |
| 456 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 457 | public string RunId { get; } |
| 458 | public RunStepStatus Status { get; } |
| 459 | public string ThreadId { get; } |
| 460 | public RunStepType Type { get; } |
| 461 | public RunStepTokenUsage Usage { get; } |
| 462 | } |
| 463 | public abstract class RunStepCodeInterpreterOutput { |
| 464 | protected RunStepCodeInterpreterOutput(); |
| 465 | public string ImageFileId { get; } |
| 466 | public string Logs { get; } |
| 467 | } |
| 468 | public abstract class RunStepDetails { |
| 469 | protected RunStepDetails(); |
| 470 | public string CreatedMessageId { get; } |
| 471 | public IReadOnlyList<RunStepToolCall> ToolCalls { get; } |
| 472 | } |
| 473 | public class RunStepDetailsUpdate : StreamingUpdate { |
| 474 | public string CodeInterpreterInput { get; } |
| 475 | public IReadOnlyList<RunStepUpdateCodeInterpreterOutput> CodeInterpreterOutputs { get; } |
| 476 | public string CreatedMessageId { get; } |
| 477 | public string FunctionArguments { get; } |
| 478 | public string FunctionName { get; } |
| 479 | public string FunctionOutput { get; } |
| 480 | public string StepId { get; } |
| 481 | public string ToolCallId { get; } |
| 482 | public int? ToolCallIndex { get; } |
| 483 | } |
| 484 | public class RunStepError { |
| 485 | public RunStepErrorCode Code { get; } |
| 486 | public string Message { get; } |
| 487 | } |
| 488 | public readonly struct RunStepErrorCode : IEquatable<RunStepErrorCode> { |
| 489 | public RunStepErrorCode(string value); |
| 490 | public static RunStepErrorCode RateLimitExceeded { get; } |
| 491 | public static RunStepErrorCode ServerError { get; } |
| 492 | public static bool operator ==(RunStepErrorCode left, RunStepErrorCode right); |
| 493 | public static implicit operator RunStepErrorCode(string value); |
| 494 | public static bool operator !=(RunStepErrorCode left, RunStepErrorCode right); |
| 495 | public bool Equals(RunStepErrorCode other); |
| 496 | public override bool Equals(object obj); |
| 497 | public override int GetHashCode(); |
| 498 | public override string ToString(); |
| 499 | } |
| 500 | public readonly struct RunStepStatus : IEquatable<RunStepStatus> { |
| 501 | public RunStepStatus(string value); |
| 502 | public static RunStepStatus Cancelled { get; } |
| 503 | public static RunStepStatus Completed { get; } |
| 504 | public static RunStepStatus Expired { get; } |
| 505 | public static RunStepStatus Failed { get; } |
| 506 | public static RunStepStatus InProgress { get; } |
| 507 | public static bool operator ==(RunStepStatus left, RunStepStatus right); |
| 508 | public static implicit operator RunStepStatus(string value); |
| 509 | public static bool operator !=(RunStepStatus left, RunStepStatus right); |
| 510 | public bool Equals(RunStepStatus other); |
| 511 | public override bool Equals(object obj); |
| 512 | public override int GetHashCode(); |
| 513 | public override string ToString(); |
| 514 | } |
| 515 | public class RunStepTokenUsage { |
| 516 | public int CompletionTokens { get; } |
| 517 | public int PromptTokens { get; } |
| 518 | public int TotalTokens { get; } |
| 519 | } |
| 520 | public abstract class RunStepToolCall { |
| 521 | protected RunStepToolCall(); |
| 522 | public string CodeInterpreterInput { get; } |
| 523 | public IReadOnlyList<RunStepCodeInterpreterOutput> CodeInterpreterOutputs { get; } |
| 524 | public string FunctionArguments { get; } |
| 525 | public string FunctionName { get; } |
| 526 | public string FunctionOutput { get; } |
| 527 | public string ToolCallId { get; } |
| 528 | public RunStepToolCallKind ToolKind { get; } |
| 529 | } |
| 530 | public readonly struct RunStepType : IEquatable<RunStepType> { |
| 531 | public RunStepType(string value); |
| 532 | public static RunStepType MessageCreation { get; } |
| 533 | public static RunStepType ToolCalls { get; } |
| 534 | public static bool operator ==(RunStepType left, RunStepType right); |
| 535 | public static implicit operator RunStepType(string value); |
| 536 | public static bool operator !=(RunStepType left, RunStepType right); |
| 537 | public bool Equals(RunStepType other); |
| 538 | public override bool Equals(object obj); |
| 539 | public override int GetHashCode(); |
| 540 | public override string ToString(); |
| 541 | } |
| 542 | public class RunStepUpdate : StreamingUpdate<RunStep> { |
| 543 | } |
| 544 | public abstract class RunStepUpdateCodeInterpreterOutput { |
| 545 | protected RunStepUpdateCodeInterpreterOutput(); |
| 546 | public string ImageFileId { get; } |
| 547 | public string Logs { get; } |
| 548 | public int OutputIndex { get; } |
| 549 | } |
| 550 | public class RunTokenUsage { |
| 551 | public int CompletionTokens { get; } |
| 552 | public int PromptTokens { get; } |
| 553 | public int TotalTokens { get; } |
| 554 | } |
| 555 | public class RunTruncationStrategy { |
| 556 | public static RunTruncationStrategy Auto { get; } |
| 557 | public int? LastMessages { get; } |
| 558 | public static RunTruncationStrategy CreateLastMessagesStrategy(int lastMessageCount); |
| 559 | } |
| 560 | public class RunUpdate : StreamingUpdate<ThreadRun> { |
| 561 | } |
| 562 | public abstract class StreamingUpdate { |
| 563 | public StreamingUpdateReason UpdateKind { get; } |
| 564 | } |
| 565 | public class StreamingUpdate<T> where T : class : StreamingUpdate { |
| 566 | public T Value { get; } |
| 567 | public static implicit operator T(StreamingUpdate<T> update); |
| 568 | } |
| 569 | public class TextAnnotation { |
| 570 | public int EndIndex { get; } |
| 571 | public string InputFileId { get; } |
| 572 | public string OutputFileId { get; } |
| 573 | public int StartIndex { get; } |
| 574 | public string TextToReplace { get; } |
| 575 | } |
| 576 | public class TextAnnotationUpdate { |
| 577 | public int ContentIndex { get; } |
| 578 | public int? EndIndex { get; } |
| 579 | public string InputFileId { get; } |
| 580 | public string OutputFileId { get; } |
| 581 | public int? StartIndex { get; } |
| 582 | public string TextToReplace { get; } |
| 583 | } |
| 584 | public class ThreadInitializationMessage : MessageCreationOptions { |
| 585 | public ThreadInitializationMessage(IEnumerable<MessageContent> content); |
| 586 | public static implicit operator ThreadInitializationMessage(string initializationMessage); |
| 587 | } |
| 588 | public class ThreadMessage { |
| 589 | public string AssistantId { get; } |
| 590 | public IReadOnlyList<MessageCreationAttachment> Attachments { get; } |
| 591 | public DateTimeOffset? CompletedAt { get; } |
| 592 | public IReadOnlyList<MessageContent> Content { get; } |
| 593 | public DateTimeOffset CreatedAt { get; } |
| 594 | public string Id { get; } |
| 595 | public DateTimeOffset? IncompleteAt { get; } |
| 596 | public MessageFailureDetails IncompleteDetails { get; } |
| 597 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 598 | public MessageRole Role { get; } |
| 599 | public string RunId { get; } |
| 600 | public MessageStatus Status { get; } |
| 601 | public string ThreadId { get; } |
| 602 | } |
| 603 | public class ThreadRun { |
| 604 | public string AssistantId { get; } |
| 605 | public DateTimeOffset? CancelledAt { get; } |
| 606 | public DateTimeOffset? CompletedAt { get; } |
| 607 | public DateTimeOffset CreatedAt { get; } |
| 608 | public DateTimeOffset? ExpiresAt { get; } |
| 609 | public DateTimeOffset? FailedAt { get; } |
| 610 | public string Id { get; } |
| 611 | public RunIncompleteDetails IncompleteDetails { get; } |
| 612 | public string Instructions { get; } |
| 613 | public RunError LastError { get; } |
| 614 | public int? MaxCompletionTokens { get; } |
| 615 | public int? MaxPromptTokens { get; } |
| 616 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 617 | public string Model { get; } |
| 618 | public float? NucleusSamplingFactor { get; } |
| 619 | public bool? ParallelToolCallsEnabled { get; init; } |
| 620 | public IReadOnlyList<RequiredAction> RequiredActions { get; } |
| 621 | public AssistantResponseFormat ResponseFormat { get; } |
| 622 | public DateTimeOffset? StartedAt { get; } |
| 623 | public RunStatus Status { get; } |
| 624 | public float? Temperature { get; } |
| 625 | public string ThreadId { get; } |
| 626 | public ToolConstraint ToolConstraint { get; } |
| 627 | public IReadOnlyList<ToolDefinition> Tools { get; } |
| 628 | public RunTruncationStrategy TruncationStrategy { get; } |
| 629 | public RunTokenUsage Usage { get; } |
| 630 | } |
| 631 | public class ThreadUpdate : StreamingUpdate<AssistantThread> { |
| 632 | public DateTimeOffset CreatedAt { get; } |
| 633 | public string Id { get; } |
| 634 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 635 | public ToolResources ToolResources { get; } |
| 636 | } |
| 637 | public class ToolConstraint { |
| 638 | public ToolConstraint(ToolDefinition toolDefinition); |
| 639 | public static ToolConstraint Auto { get; } |
| 640 | public static ToolConstraint None { get; } |
| 641 | public static ToolConstraint Required { get; } |
| 642 | } |
| 643 | public abstract class ToolDefinition { |
| 644 | protected ToolDefinition(string type); |
| 645 | protected ToolDefinition(); |
| 646 | public static CodeInterpreterToolDefinition CreateCodeInterpreter(); |
| 647 | public static FileSearchToolDefinition CreateFileSearch(int? maxResults = null); |
| 648 | public static FunctionToolDefinition CreateFunction(string name, string description = null, BinaryData parameters = null); |
| 649 | protected abstract void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 650 | } |
| 651 | public class ToolOutput { |
| 652 | public ToolOutput(string toolCallId, string output); |
| 653 | public ToolOutput(); |
| 654 | public string Output { get; init; } |
| 655 | public string ToolCallId { get; init; } |
| 656 | } |
| 657 | public class ToolResources { |
| 658 | public ToolResources(); |
| 659 | public CodeInterpreterToolResources CodeInterpreter { get; init; } |
| 660 | public FileSearchToolResources FileSearch { get; init; } |
| 661 | } |
| 662 | public class VectorStoreCreationHelper { |
| 663 | public VectorStoreCreationHelper(IEnumerable<string> fileIds, IDictionary<string, string> metadata = null); |
| 664 | public VectorStoreCreationHelper(IEnumerable<OpenAIFileInfo> files, IDictionary<string, string> metadata = null); |
| 665 | public VectorStoreCreationHelper(); |
| 666 | public IList<string> FileIds { get; } |
| 667 | public IDictionary<string, string> Metadata { get; } |
| 668 | } |
| 669 | public enum MessageImageDetail { |
| 670 | Auto = 0, |
| 671 | Low = 1, |
| 672 | High = 2, |
| 673 | } |
| 674 | public enum MessageRole { |
| 675 | User = 0, |
| 676 | Assistant = 1, |
| 677 | } |
| 678 | public enum RunStepToolCallKind { |
| 679 | Unknown = 0, |
| 680 | CodeInterpreter = 1, |
| 681 | FileSearch = 2, |
| 682 | Function = 3, |
| 683 | } |
| 684 | public enum StreamingUpdateReason { |
| 685 | Unknown = 0, |
| 686 | ThreadCreated = 1, |
| 687 | RunCreated = 2, |
| 688 | RunQueued = 3, |
| 689 | RunInProgress = 4, |
| 690 | RunRequiresAction = 5, |
| 691 | RunCompleted = 6, |
| 692 | RunIncomplete = 7, |
| 693 | RunFailed = 8, |
| 694 | RunCancelling = 9, |
| 695 | RunCancelled = 10, |
| 696 | RunExpired = 11, |
| 697 | RunStepCreated = 12, |
| 698 | RunStepInProgress = 13, |
| 699 | RunStepUpdated = 14, |
| 700 | RunStepCompleted = 15, |
| 701 | RunStepFailed = 16, |
| 702 | RunStepCancelled = 17, |
| 703 | RunStepExpired = 18, |
| 704 | MessageCreated = 19, |
| 705 | MessageInProgress = 20, |
| 706 | MessageUpdated = 21, |
| 707 | MessageCompleted = 22, |
| 708 | MessageFailed = 23, |
| 709 | Error = 24, |
| 710 | Done = 25, |
| 711 | } |
| 712 | } |
| 713 | namespace OpenAI.Audio { |
| 714 | public class AudioClient { |
| 715 | public AudioClient(string model, ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 716 | public AudioClient(string model, OpenAIClientOptions options = null); |
| 717 | protected AudioClient(ClientPipeline pipeline, string model, Uri endpoint, OpenAIClientOptions options); |
| 718 | protected AudioClient(); |
| 719 | public virtual ClientPipeline Pipeline { get; } |
| 720 | public virtual ClientResult<BinaryData> GenerateSpeechFromText(string text, GeneratedSpeechVoice voice, SpeechGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 721 | public virtual ClientResult GenerateSpeechFromText(BinaryContent content, RequestOptions options = null); |
| 722 | public virtual Task<ClientResult<BinaryData>> GenerateSpeechFromTextAsync(string text, GeneratedSpeechVoice voice, SpeechGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 723 | public virtual Task<ClientResult> GenerateSpeechFromTextAsync(BinaryContent content, RequestOptions options = null); |
| 724 | public virtual ClientResult<AudioTranscription> TranscribeAudio(Stream audio, string audioFilename, AudioTranscriptionOptions options = null, CancellationToken cancellationToken = default); |
| 725 | public virtual ClientResult<AudioTranscription> TranscribeAudio(string audioFilePath, AudioTranscriptionOptions options = null); |
| 726 | public virtual ClientResult TranscribeAudio(BinaryContent content, string contentType, RequestOptions options = null); |
| 727 | public virtual Task<ClientResult<AudioTranscription>> TranscribeAudioAsync(Stream audio, string audioFilename, AudioTranscriptionOptions options = null, CancellationToken cancellationToken = default); |
| 728 | public virtual Task<ClientResult<AudioTranscription>> TranscribeAudioAsync(string audioFilePath, AudioTranscriptionOptions options = null); |
| 729 | public virtual Task<ClientResult> TranscribeAudioAsync(BinaryContent content, string contentType, RequestOptions options = null); |
| 730 | public virtual ClientResult<AudioTranslation> TranslateAudio(Stream audio, string audioFilename, AudioTranslationOptions options = null, CancellationToken cancellationToken = default); |
| 731 | public virtual ClientResult<AudioTranslation> TranslateAudio(string audioFilePath, AudioTranslationOptions options = null); |
| 732 | public virtual ClientResult TranslateAudio(BinaryContent content, string contentType, RequestOptions options = null); |
| 733 | public virtual Task<ClientResult<AudioTranslation>> TranslateAudioAsync(Stream audio, string audioFilename, AudioTranslationOptions options = null, CancellationToken cancellationToken = default); |
| 734 | public virtual Task<ClientResult<AudioTranslation>> TranslateAudioAsync(string audioFilePath, AudioTranslationOptions options = null); |
| 735 | public virtual Task<ClientResult> TranslateAudioAsync(BinaryContent content, string contentType, RequestOptions options = null); |
| 736 | } |
| 737 | public class AudioTranscriptionOptions { |
| 738 | public AudioTranscriptionOptions(); |
| 739 | public AudioTimestampGranularities Granularities { get; init; } |
| 740 | public string Language { get; init; } |
| 741 | public string Prompt { get; init; } |
| 742 | public AudioTranscriptionFormat? ResponseFormat { get; init; } |
| 743 | public float? Temperature { get; init; } |
| 744 | } |
| 745 | public class AudioTranslationOptions { |
| 746 | public AudioTranslationOptions(); |
| 747 | public string Prompt { get; init; } |
| 748 | public AudioTranslationFormat? ResponseFormat { get; init; } |
| 749 | public float? Temperature { get; init; } |
| 750 | } |
| 751 | public class SpeechGenerationOptions { |
| 752 | public SpeechGenerationOptions(); |
| 753 | public GeneratedSpeechFormat? ResponseFormat { get; init; } |
| 754 | public float? Speed { get; init; } |
| 755 | } |
| 756 | public class AudioTranscription { |
| 757 | public TimeSpan? Duration { get; } |
| 758 | public string Language { get; } |
| 759 | public IReadOnlyList<TranscribedSegment> Segments { get; } |
| 760 | public string Text { get; } |
| 761 | public IReadOnlyList<TranscribedWord> Words { get; } |
| 762 | } |
| 763 | public class AudioTranslation { |
| 764 | public TimeSpan? Duration { get; } |
| 765 | public string Language { get; } |
| 766 | public IReadOnlyList<TranscribedSegment> Segments { get; } |
| 767 | public string Text { get; } |
| 768 | } |
| 769 | public readonly struct TranscribedSegment { |
| 770 | public TranscribedSegment(); |
| 771 | public double AverageLogProbability { get; } |
| 772 | public float CompressionRatio { get; } |
| 773 | public TimeSpan End { get; } |
| 774 | public int Id { get; } |
| 775 | public double NoSpeechProbability { get; } |
| 776 | public long SeekOffset { get; } |
| 777 | public TimeSpan Start { get; } |
| 778 | public float Temperature { get; } |
| 779 | public string Text { get; } |
| 780 | public IReadOnlyList<long> TokenIds { get; } |
| 781 | } |
| 782 | public readonly struct TranscribedWord { |
| 783 | public TranscribedWord(); |
| 784 | public TimeSpan End { get; } |
| 785 | public TimeSpan Start { get; } |
| 786 | public string Word { get; } |
| 787 | } |
| 788 | [Flags] |
| 789 | public enum AudioTimestampGranularities { |
| 790 | Default = 0, |
| 791 | Word = 1, |
| 792 | Segment = 2, |
| 793 | } |
| 794 | public enum AudioTranscriptionFormat { |
| 795 | Text = 0, |
| 796 | Simple = 1, |
| 797 | Verbose = 2, |
| 798 | Srt = 3, |
| 799 | Vtt = 4, |
| 800 | } |
| 801 | public enum AudioTranslationFormat { |
| 802 | Text = 0, |
| 803 | Simple = 1, |
| 804 | Verbose = 2, |
| 805 | Srt = 3, |
| 806 | Vtt = 4, |
| 807 | } |
| 808 | public enum GeneratedSpeechFormat { |
| 809 | Mp3 = 0, |
| 810 | Opus = 1, |
| 811 | Aac = 2, |
| 812 | Flac = 3, |
| 813 | Wav = 4, |
| 814 | Pcm = 5, |
| 815 | } |
| 816 | public enum GeneratedSpeechVoice { |
| 817 | Alloy = 0, |
| 818 | Echo = 1, |
| 819 | Fable = 2, |
| 820 | Onyx = 3, |
| 821 | Nova = 4, |
| 822 | Shimmer = 5, |
| 823 | } |
| 824 | } |
| 825 | namespace OpenAI.Batch { |
| 826 | public class BatchClient { |
| 827 | public BatchClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 828 | public BatchClient(OpenAIClientOptions options = null); |
| 829 | protected BatchClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 830 | protected BatchClient(); |
| 831 | public virtual ClientPipeline Pipeline { get; } |
| 832 | public virtual ClientResult CancelBatch(string batchId, RequestOptions options); |
| 833 | public virtual Task<ClientResult> CancelBatchAsync(string batchId, RequestOptions options); |
| 834 | public virtual ClientResult CreateBatch(BinaryContent content, RequestOptions options = null); |
| 835 | public virtual Task<ClientResult> CreateBatchAsync(BinaryContent content, RequestOptions options = null); |
| 836 | public virtual ClientResult GetBatch(string batchId, RequestOptions options); |
| 837 | public virtual Task<ClientResult> GetBatchAsync(string batchId, RequestOptions options); |
| 838 | public virtual ClientResult GetBatches(string after, int? limit, RequestOptions options); |
| 839 | public virtual Task<ClientResult> GetBatchesAsync(string after, int? limit, RequestOptions options); |
| 840 | } |
| 841 | } |
| 842 | namespace OpenAI.Chat { |
| 843 | public class ChatClient { |
| 844 | public ChatClient(string model, ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 845 | public ChatClient(string model, OpenAIClientOptions options = null); |
| 846 | protected ChatClient(ClientPipeline pipeline, string model, Uri endpoint, OpenAIClientOptions options); |
| 847 | protected ChatClient(); |
| 848 | public virtual ClientPipeline Pipeline { get; } |
| 849 | public virtual ClientResult<ChatCompletion> CompleteChat(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default); |
| 850 | public virtual ClientResult<ChatCompletion> CompleteChat(params ChatMessage[] messages); |
| 851 | public virtual ClientResult CompleteChat(BinaryContent content, RequestOptions options = null); |
| 852 | public virtual Task<ClientResult<ChatCompletion>> CompleteChatAsync(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default); |
| 853 | public virtual Task<ClientResult<ChatCompletion>> CompleteChatAsync(params ChatMessage[] messages); |
| 854 | public virtual Task<ClientResult> CompleteChatAsync(BinaryContent content, RequestOptions options = null); |
| 855 | public virtual ResultCollection<StreamingChatCompletionUpdate> CompleteChatStreaming(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default); |
| 856 | public virtual ResultCollection<StreamingChatCompletionUpdate> CompleteChatStreaming(params ChatMessage[] messages); |
| 857 | public virtual AsyncResultCollection<StreamingChatCompletionUpdate> CompleteChatStreamingAsync(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default); |
| 858 | public virtual AsyncResultCollection<StreamingChatCompletionUpdate> CompleteChatStreamingAsync(params ChatMessage[] messages); |
| 859 | } |
| 860 | public class ChatCompletionOptions { |
| 861 | public ChatCompletionOptions(); |
| 862 | public float? FrequencyPenalty { get; init; } |
| 863 | public ChatFunctionChoice FunctionChoice { get; init; } |
| 864 | public IList<ChatFunction> Functions { get; } |
| 865 | public bool? IncludeLogProbabilities { get; init; } |
| 866 | public IDictionary<int, int> LogitBiases { get; } |
| 867 | public int? MaxTokens { get; init; } |
| 868 | public bool? ParallelToolCallsEnabled { get; init; } |
| 869 | public float? PresencePenalty { get; init; } |
| 870 | public ChatResponseFormat ResponseFormat { get; init; } |
| 871 | public long? Seed { get; init; } |
| 872 | public IList<string> StopSequences { get; } |
| 873 | public float? Temperature { get; init; } |
| 874 | public ChatToolChoice ToolChoice { get; init; } |
| 875 | public IList<ChatTool> Tools { get; } |
| 876 | public int? TopLogProbabilityCount { get; init; } |
| 877 | public float? TopP { get; init; } |
| 878 | public string User { get; init; } |
| 879 | } |
| 880 | public class AssistantChatMessage : ChatMessage { |
| 881 | public AssistantChatMessage(string content); |
| 882 | public AssistantChatMessage(IEnumerable<ChatToolCall> toolCalls, string content = null); |
| 883 | public AssistantChatMessage(ChatFunctionCall functionCall, string content = null); |
| 884 | public AssistantChatMessage(ChatCompletion chatCompletion); |
| 885 | public ChatFunctionCall FunctionCall { get; init; } |
| 886 | public string ParticipantName { get; init; } |
| 887 | public IList<ChatToolCall> ToolCalls { get; } |
| 888 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 889 | } |
| 890 | public class ChatCompletion { |
| 891 | public IReadOnlyList<ChatMessageContentPart> Content { get; } |
| 892 | public IReadOnlyList<ChatTokenLogProbabilityInfo> ContentTokenLogProbabilities { get; } |
| 893 | public DateTimeOffset CreatedAt { get; } |
| 894 | public ChatFinishReason FinishReason { get; } |
| 895 | public ChatFunctionCall FunctionCall { get; } |
| 896 | public string Id { get; } |
| 897 | public string Model { get; } |
| 898 | public ChatMessageRole Role { get; } |
| 899 | public string SystemFingerprint { get; } |
| 900 | public IReadOnlyList<ChatToolCall> ToolCalls { get; } |
| 901 | public ChatTokenUsage Usage { get; } |
| 902 | public override string ToString(); |
| 903 | } |
| 904 | [Obsolete("This field is marked as deprecated.")] |
| 905 | public class ChatFunction { |
| 906 | public ChatFunction(string functionName, string functionDescription = null, BinaryData functionParameters = null); |
| 907 | public string FunctionDescription { get; init; } |
| 908 | public string FunctionName { get; } |
| 909 | public BinaryData FunctionParameters { get; init; } |
| 910 | } |
| 911 | public class ChatFunctionCall { |
| 912 | public ChatFunctionCall(string functionName, string functionArguments); |
| 913 | public string FunctionArguments { get; } |
| 914 | public string FunctionName { get; } |
| 915 | } |
| 916 | public class ChatFunctionChoice { |
| 917 | public ChatFunctionChoice(ChatFunction chatFunction); |
| 918 | public static ChatFunctionChoice Auto { get; } |
| 919 | public static ChatFunctionChoice None { get; } |
| 920 | } |
| 921 | public abstract class ChatMessage { |
| 922 | protected ChatMessage(); |
| 923 | public IList<ChatMessageContentPart> Content { get; protected init; } |
| 924 | public static AssistantChatMessage CreateAssistantMessage(string content); |
| 925 | public static AssistantChatMessage CreateAssistantMessage(IEnumerable<ChatToolCall> toolCalls, string content = null); |
| 926 | public static AssistantChatMessage CreateAssistantMessage(ChatFunctionCall functionCall, string content = null); |
| 927 | public static AssistantChatMessage CreateAssistantMessage(ChatCompletion chatCompletion); |
| 928 | public static FunctionChatMessage CreateFunctionMessage(string functionName, string content); |
| 929 | public static SystemChatMessage CreateSystemMessage(string content); |
| 930 | public static ToolChatMessage CreateToolChatMessage(string toolCallId, string content); |
| 931 | public static UserChatMessage CreateUserMessage(string content); |
| 932 | public static UserChatMessage CreateUserMessage(IEnumerable<ChatMessageContentPart> contentParts); |
| 933 | public static UserChatMessage CreateUserMessage(params ChatMessageContentPart[] contentParts); |
| 934 | public static implicit operator ChatMessage(string userMessage); |
| 935 | protected abstract void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 936 | } |
| 937 | public class ChatMessageContentPart { |
| 938 | public BinaryData ImageBytes { get; } |
| 939 | public string ImageBytesMediaType { get; } |
| 940 | public ImageChatMessageContentPartDetail? ImageDetail { get; } |
| 941 | public Uri ImageUri { get; } |
| 942 | public ChatMessageContentPartKind Kind { get; } |
| 943 | public string Text { get; } |
| 944 | public static ChatMessageContentPart CreateImageMessageContentPart(Uri imageUri, ImageChatMessageContentPartDetail? imageDetail = null); |
| 945 | public static ChatMessageContentPart CreateImageMessageContentPart(BinaryData imageBytes, string imageBytesMediaType, ImageChatMessageContentPartDetail? imageDetail = null); |
| 946 | public static ChatMessageContentPart CreateTextMessageContentPart(string text); |
| 947 | public static implicit operator ChatMessageContentPart(string content); |
| 948 | public override string ToString(); |
| 949 | } |
| 950 | public readonly struct ChatMessageContentPartKind : IEquatable<ChatMessageContentPartKind> { |
| 951 | public ChatMessageContentPartKind(string value); |
| 952 | public static ChatMessageContentPartKind Image { get; } |
| 953 | public static ChatMessageContentPartKind Text { get; } |
| 954 | public static bool operator ==(ChatMessageContentPartKind left, ChatMessageContentPartKind right); |
| 955 | public static implicit operator ChatMessageContentPartKind(string value); |
| 956 | public static bool operator !=(ChatMessageContentPartKind left, ChatMessageContentPartKind right); |
| 957 | public bool Equals(ChatMessageContentPartKind other); |
| 958 | public override bool Equals(object obj); |
| 959 | public override int GetHashCode(); |
| 960 | public override string ToString(); |
| 961 | } |
| 962 | public class ChatResponseFormat { |
| 963 | public static ChatResponseFormat JsonObject { get; } |
| 964 | public static ChatResponseFormat Text { get; } |
| 965 | } |
| 966 | public class ChatTokenLogProbabilityInfo { |
| 967 | public float LogProbability { get; } |
| 968 | public string Token { get; } |
| 969 | public IReadOnlyList<ChatTokenTopLogProbabilityInfo> TopLogProbabilities { get; } |
| 970 | public IReadOnlyList<int> Utf8ByteValues { get; } |
| 971 | } |
| 972 | public class ChatTokenTopLogProbabilityInfo { |
| 973 | public float LogProbability { get; } |
| 974 | public string Token { get; } |
| 975 | public IReadOnlyList<int> Utf8ByteValues { get; } |
| 976 | } |
| 977 | public class ChatTokenUsage { |
| 978 | public int InputTokens { get; } |
| 979 | public int OutputTokens { get; } |
| 980 | public int TotalTokens { get; } |
| 981 | } |
| 982 | public class ChatTool { |
| 983 | public string FunctionDescription { get; } |
| 984 | public string FunctionName { get; } |
| 985 | public BinaryData FunctionParameters { get; } |
| 986 | public ChatToolKind Kind { get; } |
| 987 | public static ChatTool CreateFunctionTool(string functionName, string functionDescription = null, BinaryData functionParameters = null); |
| 988 | } |
| 989 | public class ChatToolCall { |
| 990 | public string FunctionArguments { get; } |
| 991 | public string FunctionName { get; } |
| 992 | public string Id { get; init; } |
| 993 | public ChatToolCallKind Kind { get; } |
| 994 | public static ChatToolCall CreateFunctionToolCall(string toolCallId, string functionName, string functionArguments); |
| 995 | } |
| 996 | public readonly struct ChatToolCallKind : IEquatable<ChatToolCallKind> { |
| 997 | public ChatToolCallKind(string value); |
| 998 | public static ChatToolCallKind Function { get; } |
| 999 | public static bool operator ==(ChatToolCallKind left, ChatToolCallKind right); |
| 1000 | public static implicit operator ChatToolCallKind(string value); |
| 1001 | public static bool operator !=(ChatToolCallKind left, ChatToolCallKind right); |
| 1002 | public bool Equals(ChatToolCallKind other); |
| 1003 | public override bool Equals(object obj); |
| 1004 | public override int GetHashCode(); |
| 1005 | public override string ToString(); |
| 1006 | } |
| 1007 | public class ChatToolChoice { |
| 1008 | public ChatToolChoice(ChatTool tool); |
| 1009 | public static ChatToolChoice Auto { get; } |
| 1010 | public static ChatToolChoice None { get; } |
| 1011 | public static ChatToolChoice Required { get; } |
| 1012 | } |
| 1013 | public readonly struct ChatToolKind : IEquatable<ChatToolKind> { |
| 1014 | public ChatToolKind(string value); |
| 1015 | public static ChatToolKind Function { get; } |
| 1016 | public static bool operator ==(ChatToolKind left, ChatToolKind right); |
| 1017 | public static implicit operator ChatToolKind(string value); |
| 1018 | public static bool operator !=(ChatToolKind left, ChatToolKind right); |
| 1019 | public bool Equals(ChatToolKind other); |
| 1020 | public override bool Equals(object obj); |
| 1021 | public override int GetHashCode(); |
| 1022 | public override string ToString(); |
| 1023 | } |
| 1024 | [Obsolete("This field is marked as deprecated.")] |
| 1025 | public class FunctionChatMessage : ChatMessage { |
| 1026 | public FunctionChatMessage(string functionName, string content = null); |
| 1027 | public string FunctionName { get; } |
| 1028 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 1029 | } |
| 1030 | public readonly struct ImageChatMessageContentPartDetail : IEquatable<ImageChatMessageContentPartDetail> { |
| 1031 | public ImageChatMessageContentPartDetail(string value); |
| 1032 | public static ImageChatMessageContentPartDetail Auto { get; } |
| 1033 | public static ImageChatMessageContentPartDetail High { get; } |
| 1034 | public static ImageChatMessageContentPartDetail Low { get; } |
| 1035 | public static bool operator ==(ImageChatMessageContentPartDetail left, ImageChatMessageContentPartDetail right); |
| 1036 | public static implicit operator ImageChatMessageContentPartDetail(string value); |
| 1037 | public static bool operator !=(ImageChatMessageContentPartDetail left, ImageChatMessageContentPartDetail right); |
| 1038 | public bool Equals(ImageChatMessageContentPartDetail other); |
| 1039 | public override bool Equals(object obj); |
| 1040 | public override int GetHashCode(); |
| 1041 | public override string ToString(); |
| 1042 | } |
| 1043 | public class StreamingChatCompletionUpdate { |
| 1044 | public IReadOnlyList<ChatTokenLogProbabilityInfo> ContentTokenLogProbabilities { get; } |
| 1045 | public IReadOnlyList<ChatMessageContentPart> ContentUpdate { get; } |
| 1046 | public DateTimeOffset CreatedAt { get; } |
| 1047 | public ChatFinishReason? FinishReason { get; } |
| 1048 | public StreamingChatFunctionCallUpdate FunctionCallUpdate { get; } |
| 1049 | public string Id { get; } |
| 1050 | public string Model { get; } |
| 1051 | public ChatMessageRole? Role { get; } |
| 1052 | public string SystemFingerprint { get; } |
| 1053 | public IReadOnlyList<StreamingChatToolCallUpdate> ToolCallUpdates { get; } |
| 1054 | public ChatTokenUsage Usage { get; } |
| 1055 | } |
| 1056 | public class StreamingChatFunctionCallUpdate { |
| 1057 | public string FunctionArgumentsUpdate { get; } |
| 1058 | public string FunctionName { get; } |
| 1059 | } |
| 1060 | public class StreamingChatToolCallUpdate { |
| 1061 | public string FunctionArgumentsUpdate { get; } |
| 1062 | public string FunctionName { get; } |
| 1063 | public string Id { get; } |
| 1064 | public int Index { get; } |
| 1065 | public ChatToolCallKind Kind { get; } |
| 1066 | } |
| 1067 | public class SystemChatMessage : ChatMessage { |
| 1068 | public SystemChatMessage(string content); |
| 1069 | public string ParticipantName { get; init; } |
| 1070 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 1071 | } |
| 1072 | public class ToolChatMessage : ChatMessage { |
| 1073 | public ToolChatMessage(string toolCallId, string content); |
| 1074 | public string ToolCallId { get; } |
| 1075 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 1076 | } |
| 1077 | public class UserChatMessage : ChatMessage { |
| 1078 | public UserChatMessage(string content); |
| 1079 | public UserChatMessage(IEnumerable<ChatMessageContentPart> content); |
| 1080 | public UserChatMessage(params ChatMessageContentPart[] content); |
| 1081 | public string ParticipantName { get; init; } |
| 1082 | protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); |
| 1083 | } |
| 1084 | public enum ChatFinishReason { |
| 1085 | Stop = 0, |
| 1086 | Length = 1, |
| 1087 | ContentFilter = 2, |
| 1088 | ToolCalls = 3, |
| 1089 | FunctionCall = 4, |
| 1090 | } |
| 1091 | public enum ChatMessageRole { |
| 1092 | System = 0, |
| 1093 | User = 1, |
| 1094 | Assistant = 2, |
| 1095 | Tool = 3, |
| 1096 | Function = 4, |
| 1097 | } |
| 1098 | } |
| 1099 | namespace OpenAI.Embeddings { |
| 1100 | public class EmbeddingClient { |
| 1101 | public EmbeddingClient(string model, ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1102 | public EmbeddingClient(string model, OpenAIClientOptions options = null); |
| 1103 | protected EmbeddingClient(ClientPipeline pipeline, string model, Uri endpoint, OpenAIClientOptions options); |
| 1104 | protected EmbeddingClient(); |
| 1105 | public virtual ClientPipeline Pipeline { get; } |
| 1106 | public virtual ClientResult<Embedding> GenerateEmbedding(string input, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1107 | public virtual Task<ClientResult<Embedding>> GenerateEmbeddingAsync(string input, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1108 | public virtual ClientResult<EmbeddingCollection> GenerateEmbeddings(IEnumerable<string> inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1109 | public virtual ClientResult<EmbeddingCollection> GenerateEmbeddings(IEnumerable<IEnumerable<int>> inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1110 | public virtual ClientResult GenerateEmbeddings(BinaryContent content, RequestOptions options = null); |
| 1111 | public virtual Task<ClientResult<EmbeddingCollection>> GenerateEmbeddingsAsync(IEnumerable<string> inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1112 | public virtual Task<ClientResult<EmbeddingCollection>> GenerateEmbeddingsAsync(IEnumerable<IEnumerable<int>> inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1113 | public virtual Task<ClientResult> GenerateEmbeddingsAsync(BinaryContent content, RequestOptions options = null); |
| 1114 | } |
| 1115 | public class EmbeddingGenerationOptions { |
| 1116 | public EmbeddingGenerationOptions(); |
| 1117 | public int? Dimensions { get; init; } |
| 1118 | public string User { get; init; } |
| 1119 | } |
| 1120 | public class Embedding { |
| 1121 | public int Index { get; } |
| 1122 | public ReadOnlyMemory<float> Vector { get; } |
| 1123 | } |
| 1124 | public class EmbeddingCollection : ReadOnlyCollection<Embedding> { |
| 1125 | public string Model { get; } |
| 1126 | public EmbeddingTokenUsage Usage { get; } |
| 1127 | } |
| 1128 | public class EmbeddingTokenUsage { |
| 1129 | public int InputTokens { get; } |
| 1130 | public int TotalTokens { get; } |
| 1131 | } |
| 1132 | } |
| 1133 | namespace OpenAI.Files { |
| 1134 | public class FileClient { |
| 1135 | public FileClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1136 | public FileClient(OpenAIClientOptions options = null); |
| 1137 | protected FileClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 1138 | protected FileClient(); |
| 1139 | public virtual ClientPipeline Pipeline { get; } |
| 1140 | public virtual ClientResult<bool> DeleteFile(string fileId, CancellationToken cancellationToken = default); |
| 1141 | public virtual ClientResult<bool> DeleteFile(OpenAIFileInfo file); |
| 1142 | public virtual ClientResult DeleteFile(string fileId, RequestOptions options); |
| 1143 | public virtual Task<ClientResult<bool>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default); |
| 1144 | public virtual Task<ClientResult<bool>> DeleteFileAsync(OpenAIFileInfo file); |
| 1145 | public virtual Task<ClientResult> DeleteFileAsync(string fileId, RequestOptions options); |
| 1146 | public virtual ClientResult<BinaryData> DownloadFile(string fileId, CancellationToken cancellationToken = default); |
| 1147 | public virtual ClientResult<BinaryData> DownloadFile(OpenAIFileInfo file); |
| 1148 | public virtual ClientResult DownloadFile(string fileId, RequestOptions options); |
| 1149 | public virtual Task<ClientResult<BinaryData>> DownloadFileAsync(string fileId, CancellationToken cancellationToken = default); |
| 1150 | public virtual Task<ClientResult<BinaryData>> DownloadFileAsync(OpenAIFileInfo file); |
| 1151 | public virtual Task<ClientResult> DownloadFileAsync(string fileId, RequestOptions options); |
| 1152 | public virtual ClientResult<OpenAIFileInfo> GetFile(string fileId, CancellationToken cancellationToken = default); |
| 1153 | public virtual ClientResult GetFile(string fileId, RequestOptions options); |
| 1154 | public virtual Task<ClientResult<OpenAIFileInfo>> GetFileAsync(string fileId, CancellationToken cancellationToken = default); |
| 1155 | public virtual Task<ClientResult> GetFileAsync(string fileId, RequestOptions options); |
| 1156 | public virtual ClientResult<OpenAIFileInfoCollection> GetFiles(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default); |
| 1157 | public virtual ClientResult GetFiles(string purpose, RequestOptions options); |
| 1158 | public virtual Task<ClientResult<OpenAIFileInfoCollection>> GetFilesAsync(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default); |
| 1159 | public virtual Task<ClientResult> GetFilesAsync(string purpose, RequestOptions options); |
| 1160 | public virtual ClientResult<OpenAIFileInfo> UploadFile(Stream file, string filename, FileUploadPurpose purpose, CancellationToken cancellationToken = default); |
| 1161 | public virtual ClientResult<OpenAIFileInfo> UploadFile(BinaryData file, string filename, FileUploadPurpose purpose); |
| 1162 | public virtual ClientResult<OpenAIFileInfo> UploadFile(string filePath, FileUploadPurpose purpose); |
| 1163 | public virtual ClientResult UploadFile(BinaryContent content, string contentType, RequestOptions options = null); |
| 1164 | public virtual Task<ClientResult<OpenAIFileInfo>> UploadFileAsync(Stream file, string filename, FileUploadPurpose purpose, CancellationToken cancellationToken = default); |
| 1165 | public virtual Task<ClientResult<OpenAIFileInfo>> UploadFileAsync(BinaryData file, string filename, FileUploadPurpose purpose); |
| 1166 | public virtual Task<ClientResult<OpenAIFileInfo>> UploadFileAsync(string filePath, FileUploadPurpose purpose); |
| 1167 | public virtual Task<ClientResult> UploadFileAsync(BinaryContent content, string contentType, RequestOptions options = null); |
| 1168 | } |
| 1169 | public readonly struct FileUploadPurpose : IEquatable<FileUploadPurpose> { |
| 1170 | public FileUploadPurpose(string value); |
| 1171 | public static FileUploadPurpose Assistants { get; } |
| 1172 | public static FileUploadPurpose Batch { get; } |
| 1173 | public static FileUploadPurpose FineTune { get; } |
| 1174 | public static FileUploadPurpose Vision { get; } |
| 1175 | public static bool operator ==(FileUploadPurpose left, FileUploadPurpose right); |
| 1176 | public static implicit operator FileUploadPurpose(string value); |
| 1177 | public static bool operator !=(FileUploadPurpose left, FileUploadPurpose right); |
| 1178 | public bool Equals(FileUploadPurpose other); |
| 1179 | public override bool Equals(object obj); |
| 1180 | public override int GetHashCode(); |
| 1181 | public override string ToString(); |
| 1182 | } |
| 1183 | public class OpenAIFileInfo { |
| 1184 | public DateTimeOffset CreatedAt { get; } |
| 1185 | public string Filename { get; } |
| 1186 | public string Id { get; } |
| 1187 | public OpenAIFilePurpose Purpose { get; } |
| 1188 | public long? SizeInBytes { get; } |
| 1189 | public OpenAIFileStatus Status { get; } |
| 1190 | public string StatusDetails { get; } |
| 1191 | } |
| 1192 | public class OpenAIFileInfoCollection : ReadOnlyCollection<OpenAIFileInfo> { |
| 1193 | } |
| 1194 | public readonly struct OpenAIFilePurpose : IEquatable<OpenAIFilePurpose> { |
| 1195 | public OpenAIFilePurpose(string value); |
| 1196 | public static OpenAIFilePurpose Assistants { get; } |
| 1197 | public static OpenAIFilePurpose AssistantsOutput { get; } |
| 1198 | public static OpenAIFilePurpose Batch { get; } |
| 1199 | public static OpenAIFilePurpose BatchOutput { get; } |
| 1200 | public static OpenAIFilePurpose FineTune { get; } |
| 1201 | public static OpenAIFilePurpose FineTuneResults { get; } |
| 1202 | public static OpenAIFilePurpose Vision { get; } |
| 1203 | public static bool operator ==(OpenAIFilePurpose left, OpenAIFilePurpose right); |
| 1204 | public static implicit operator OpenAIFilePurpose(string value); |
| 1205 | public static bool operator !=(OpenAIFilePurpose left, OpenAIFilePurpose right); |
| 1206 | public bool Equals(OpenAIFilePurpose other); |
| 1207 | public override bool Equals(object obj); |
| 1208 | public override int GetHashCode(); |
| 1209 | public override string ToString(); |
| 1210 | } |
| 1211 | public readonly struct OpenAIFileStatus : IEquatable<OpenAIFileStatus> { |
| 1212 | public OpenAIFileStatus(string value); |
| 1213 | public static OpenAIFileStatus Error { get; } |
| 1214 | public static OpenAIFileStatus Processed { get; } |
| 1215 | public static OpenAIFileStatus Uploaded { get; } |
| 1216 | public static bool operator ==(OpenAIFileStatus left, OpenAIFileStatus right); |
| 1217 | public static implicit operator OpenAIFileStatus(string value); |
| 1218 | public static bool operator !=(OpenAIFileStatus left, OpenAIFileStatus right); |
| 1219 | public bool Equals(OpenAIFileStatus other); |
| 1220 | public override bool Equals(object obj); |
| 1221 | public override int GetHashCode(); |
| 1222 | public override string ToString(); |
| 1223 | } |
| 1224 | } |
| 1225 | namespace OpenAI.FineTuning { |
| 1226 | public class FineTuningClient { |
| 1227 | public FineTuningClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1228 | public FineTuningClient(OpenAIClientOptions options = null); |
| 1229 | protected FineTuningClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 1230 | protected FineTuningClient(); |
| 1231 | public virtual ClientPipeline Pipeline { get; } |
| 1232 | public virtual ClientResult CancelJob(string jobId, RequestOptions options); |
| 1233 | public virtual Task<ClientResult> CancelJobAsync(string jobId, RequestOptions options); |
| 1234 | public virtual ClientResult CreateJob(BinaryContent content, RequestOptions options = null); |
| 1235 | public virtual Task<ClientResult> CreateJobAsync(BinaryContent content, RequestOptions options = null); |
| 1236 | public virtual ClientResult GetJob(string jobId, RequestOptions options); |
| 1237 | public virtual Task<ClientResult> GetJobAsync(string jobId, RequestOptions options); |
| 1238 | public virtual ClientResult GetJobCheckpoints(string fineTuningJobId, string after, int? limit, RequestOptions options); |
| 1239 | public virtual Task<ClientResult> GetJobCheckpointsAsync(string fineTuningJobId, string after, int? limit, RequestOptions options); |
| 1240 | public virtual ClientResult GetJobEvents(string jobId, string after, int? limit, RequestOptions options); |
| 1241 | public virtual Task<ClientResult> GetJobEventsAsync(string jobId, string after, int? limit, RequestOptions options); |
| 1242 | public virtual ClientResult GetJobs(string after, int? limit, RequestOptions options); |
| 1243 | public virtual Task<ClientResult> GetJobsAsync(string after, int? limit, RequestOptions options); |
| 1244 | } |
| 1245 | } |
| 1246 | namespace OpenAI.Images { |
| 1247 | public class ImageClient { |
| 1248 | public ImageClient(string model, ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1249 | public ImageClient(string model, OpenAIClientOptions options = null); |
| 1250 | protected ImageClient(ClientPipeline pipeline, string model, Uri endpoint, OpenAIClientOptions options); |
| 1251 | protected ImageClient(); |
| 1252 | public virtual ClientPipeline Pipeline { get; } |
| 1253 | public virtual ClientResult<GeneratedImage> GenerateImage(string prompt, ImageGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1254 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageAsync(string prompt, ImageGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1255 | public virtual ClientResult<GeneratedImage> GenerateImageEdit(Stream image, string imageFilename, string prompt, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1256 | public virtual ClientResult<GeneratedImage> GenerateImageEdit(string imageFilePath, string prompt, ImageEditOptions options = null); |
| 1257 | public virtual ClientResult<GeneratedImage> GenerateImageEdit(Stream image, string imageFilename, string prompt, Stream mask, string maskFilename, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1258 | public virtual ClientResult<GeneratedImage> GenerateImageEdit(string imageFilePath, string prompt, string maskFilePath, ImageEditOptions options = null); |
| 1259 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageEditAsync(Stream image, string imageFilename, string prompt, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1260 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageEditAsync(string imageFilePath, string prompt, ImageEditOptions options = null); |
| 1261 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageEditAsync(Stream image, string imageFilename, string prompt, Stream mask, string maskFilename, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1262 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageEditAsync(string imageFilePath, string prompt, string maskFilePath, ImageEditOptions options = null); |
| 1263 | public virtual ClientResult<GeneratedImageCollection> GenerateImageEdits(Stream image, string imageFilename, string prompt, int imageCount, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1264 | public virtual ClientResult<GeneratedImageCollection> GenerateImageEdits(string imageFilePath, string prompt, int imageCount, ImageEditOptions options = null); |
| 1265 | public virtual ClientResult<GeneratedImageCollection> GenerateImageEdits(Stream image, string imageFilename, string prompt, Stream mask, string maskFilename, int imageCount, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1266 | public virtual ClientResult<GeneratedImageCollection> GenerateImageEdits(string imageFilePath, string prompt, string maskFilePath, int imageCount, ImageEditOptions options = null); |
| 1267 | public virtual ClientResult GenerateImageEdits(BinaryContent content, string contentType, RequestOptions options = null); |
| 1268 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImageEditsAsync(Stream image, string imageFilename, string prompt, int imageCount, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1269 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImageEditsAsync(string imageFilePath, string prompt, int imageCount, ImageEditOptions options = null); |
| 1270 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImageEditsAsync(Stream image, string imageFilename, string prompt, Stream mask, string maskFilename, int imageCount, ImageEditOptions options = null, CancellationToken cancellationToken = default); |
| 1271 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImageEditsAsync(string imageFilePath, string prompt, string maskFilePath, int imageCount, ImageEditOptions options = null); |
| 1272 | public virtual Task<ClientResult> GenerateImageEditsAsync(BinaryContent content, string contentType, RequestOptions options = null); |
| 1273 | public virtual ClientResult<GeneratedImageCollection> GenerateImages(string prompt, int imageCount, ImageGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1274 | public virtual ClientResult GenerateImages(BinaryContent content, RequestOptions options = null); |
| 1275 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImagesAsync(string prompt, int imageCount, ImageGenerationOptions options = null, CancellationToken cancellationToken = default); |
| 1276 | public virtual Task<ClientResult> GenerateImagesAsync(BinaryContent content, RequestOptions options = null); |
| 1277 | public virtual ClientResult<GeneratedImage> GenerateImageVariation(Stream image, string imageFilename, ImageVariationOptions options = null, CancellationToken cancellationToken = default); |
| 1278 | public virtual ClientResult<GeneratedImage> GenerateImageVariation(string imageFilePath, ImageVariationOptions options = null); |
| 1279 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageVariationAsync(Stream image, string imageFilename, ImageVariationOptions options = null, CancellationToken cancellationToken = default); |
| 1280 | public virtual Task<ClientResult<GeneratedImage>> GenerateImageVariationAsync(string imageFilePath, ImageVariationOptions options = null); |
| 1281 | public virtual ClientResult<GeneratedImageCollection> GenerateImageVariations(Stream image, string imageFilename, int imageCount, ImageVariationOptions options = null, CancellationToken cancellationToken = default); |
| 1282 | public virtual ClientResult<GeneratedImageCollection> GenerateImageVariations(string imageFilePath, int imageCount, ImageVariationOptions options = null); |
| 1283 | public virtual ClientResult GenerateImageVariations(BinaryContent content, string contentType, RequestOptions options = null); |
| 1284 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImageVariationsAsync(Stream image, string imageFilename, int imageCount, ImageVariationOptions options = null, CancellationToken cancellationToken = default); |
| 1285 | public virtual Task<ClientResult<GeneratedImageCollection>> GenerateImageVariationsAsync(string imageFilePath, int imageCount, ImageVariationOptions options = null); |
| 1286 | public virtual Task<ClientResult> GenerateImageVariationsAsync(BinaryContent content, string contentType, RequestOptions options = null); |
| 1287 | } |
| 1288 | public class ImageEditOptions { |
| 1289 | public ImageEditOptions(); |
| 1290 | public GeneratedImageFormat? ResponseFormat { get; init; } |
| 1291 | public GeneratedImageSize? Size { get; init; } |
| 1292 | public string User { get; init; } |
| 1293 | } |
| 1294 | public class ImageGenerationOptions { |
| 1295 | public ImageGenerationOptions(); |
| 1296 | public GeneratedImageQuality? Quality { get; init; } |
| 1297 | public GeneratedImageFormat? ResponseFormat { get; init; } |
| 1298 | public GeneratedImageSize? Size { get; init; } |
| 1299 | public GeneratedImageStyle? Style { get; init; } |
| 1300 | public string User { get; init; } |
| 1301 | } |
| 1302 | public class ImageVariationOptions { |
| 1303 | public ImageVariationOptions(); |
| 1304 | public GeneratedImageFormat? ResponseFormat { get; init; } |
| 1305 | public GeneratedImageSize? Size { get; init; } |
| 1306 | public string User { get; init; } |
| 1307 | } |
| 1308 | public class GeneratedImage { |
| 1309 | public BinaryData ImageBytes { get; } |
| 1310 | public Uri ImageUri { get; } |
| 1311 | public string RevisedPrompt { get; } |
| 1312 | } |
| 1313 | public class GeneratedImageCollection : ReadOnlyCollection<GeneratedImage> { |
| 1314 | public DateTimeOffset Created { get; } |
| 1315 | public DateTimeOffset CreatedAt { get; } |
| 1316 | } |
| 1317 | public readonly struct GeneratedImageSize : IEquatable<GeneratedImageSize> { |
| 1318 | public GeneratedImageSize(int width, int height); |
| 1319 | public static readonly GeneratedImageSize W1024xH1024; |
| 1320 | public static readonly GeneratedImageSize W1024xH1792; |
| 1321 | public static readonly GeneratedImageSize W1792xH1024; |
| 1322 | public static readonly GeneratedImageSize W256xH256; |
| 1323 | public static readonly GeneratedImageSize W512xH512; |
| 1324 | public static bool operator ==(GeneratedImageSize left, GeneratedImageSize right); |
| 1325 | public static bool operator !=(GeneratedImageSize left, GeneratedImageSize right); |
| 1326 | public bool Equals(GeneratedImageSize other); |
| 1327 | public override bool Equals(object obj); |
| 1328 | public override int GetHashCode(); |
| 1329 | public override string ToString(); |
| 1330 | } |
| 1331 | public enum GeneratedImageFormat { |
| 1332 | Bytes = 0, |
| 1333 | Uri = 1, |
| 1334 | } |
| 1335 | public enum GeneratedImageQuality { |
| 1336 | High = 0, |
| 1337 | Standard = 1, |
| 1338 | } |
| 1339 | public enum GeneratedImageStyle { |
| 1340 | Vivid = 0, |
| 1341 | Natural = 1, |
| 1342 | } |
| 1343 | } |
| 1344 | namespace OpenAI.Models { |
| 1345 | public class ModelClient { |
| 1346 | public ModelClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1347 | public ModelClient(OpenAIClientOptions options = null); |
| 1348 | protected ModelClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 1349 | protected ModelClient(); |
| 1350 | public virtual ClientPipeline Pipeline { get; } |
| 1351 | public virtual ClientResult<bool> DeleteModel(string model); |
| 1352 | public virtual ClientResult DeleteModel(string model, RequestOptions options); |
| 1353 | public virtual Task<ClientResult<bool>> DeleteModelAsync(string model); |
| 1354 | public virtual Task<ClientResult> DeleteModelAsync(string model, RequestOptions options); |
| 1355 | public virtual ClientResult<OpenAIModelInfo> GetModel(string model); |
| 1356 | public virtual ClientResult GetModel(string model, RequestOptions options); |
| 1357 | public virtual Task<ClientResult<OpenAIModelInfo>> GetModelAsync(string model); |
| 1358 | public virtual Task<ClientResult> GetModelAsync(string model, RequestOptions options); |
| 1359 | public virtual ClientResult<OpenAIModelInfoCollection> GetModels(); |
| 1360 | public virtual ClientResult GetModels(RequestOptions options); |
| 1361 | public virtual Task<ClientResult<OpenAIModelInfoCollection>> GetModelsAsync(); |
| 1362 | public virtual Task<ClientResult> GetModelsAsync(RequestOptions options); |
| 1363 | } |
| 1364 | public class OpenAIModelInfo { |
| 1365 | public DateTimeOffset CreatedAt { get; } |
| 1366 | public string Id { get; } |
| 1367 | public string OwnedBy { get; } |
| 1368 | } |
| 1369 | public class OpenAIModelInfoCollection : ReadOnlyCollection<OpenAIModelInfo> { |
| 1370 | } |
| 1371 | } |
| 1372 | namespace OpenAI.Moderations { |
| 1373 | public class ModerationClient { |
| 1374 | public ModerationClient(string model, ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1375 | public ModerationClient(string model, OpenAIClientOptions options = null); |
| 1376 | protected ModerationClient(ClientPipeline pipeline, string model, Uri endpoint, OpenAIClientOptions options); |
| 1377 | protected ModerationClient(); |
| 1378 | public virtual ClientPipeline Pipeline { get; } |
| 1379 | public virtual ClientResult<ModerationResult> ClassifyTextInput(string input, CancellationToken cancellationToken = default); |
| 1380 | public virtual Task<ClientResult<ModerationResult>> ClassifyTextInputAsync(string input, CancellationToken cancellationToken = default); |
| 1381 | public virtual ClientResult<ModerationCollection> ClassifyTextInputs(IEnumerable<string> inputs, CancellationToken cancellationToken = default); |
| 1382 | public virtual ClientResult ClassifyTextInputs(BinaryContent content, RequestOptions options = null); |
| 1383 | public virtual Task<ClientResult<ModerationCollection>> ClassifyTextInputsAsync(IEnumerable<string> inputs, CancellationToken cancellationToken = default); |
| 1384 | public virtual Task<ClientResult> ClassifyTextInputsAsync(BinaryContent content, RequestOptions options = null); |
| 1385 | } |
| 1386 | public class ModerationCategories { |
| 1387 | public bool Harassment { get; } |
| 1388 | public bool HarassmentThreatening { get; } |
| 1389 | public bool Hate { get; } |
| 1390 | public bool HateThreatening { get; } |
| 1391 | public bool SelfHarm { get; } |
| 1392 | public bool SelfHarmInstructions { get; } |
| 1393 | public bool SelfHarmIntent { get; } |
| 1394 | public bool Sexual { get; } |
| 1395 | public bool SexualMinors { get; } |
| 1396 | public bool Violence { get; } |
| 1397 | public bool ViolenceGraphic { get; } |
| 1398 | } |
| 1399 | public class ModerationCategoryScores { |
| 1400 | public float Harassment { get; } |
| 1401 | public float HarassmentThreatening { get; } |
| 1402 | public float Hate { get; } |
| 1403 | public float HateThreatening { get; } |
| 1404 | public float SelfHarm { get; } |
| 1405 | public float SelfHarmInstructions { get; } |
| 1406 | public float SelfHarmIntent { get; } |
| 1407 | public float Sexual { get; } |
| 1408 | public float SexualMinors { get; } |
| 1409 | public float Violence { get; } |
| 1410 | public float ViolenceGraphic { get; } |
| 1411 | } |
| 1412 | public class ModerationCollection : ReadOnlyCollection<ModerationResult> { |
| 1413 | public string Id { get; } |
| 1414 | public string Model { get; } |
| 1415 | } |
| 1416 | public class ModerationResult { |
| 1417 | public ModerationCategories Categories { get; } |
| 1418 | public ModerationCategoryScores CategoryScores { get; } |
| 1419 | public bool Flagged { get; } |
| 1420 | } |
| 1421 | } |
| 1422 | namespace OpenAI.VectorStores { |
| 1423 | internal [Experimental("OPENAI001")] |
| 1424 | public class VectorStoreClient { |
| 1425 | public virtual ClientResult<VectorStoreFileAssociation> AddFileToVectorStore(VectorStore vectorStore, OpenAIFileInfo file); |
| 1426 | public virtual ClientResult<VectorStoreFileAssociation> AddFileToVectorStore(string vectorStoreId, string fileId, CancellationToken cancellationToken = default); |
| 1427 | public virtual ClientResult AddFileToVectorStore(string vectorStoreId, BinaryContent content, RequestOptions options = null); |
| 1428 | public virtual Task<ClientResult<VectorStoreFileAssociation>> AddFileToVectorStoreAsync(VectorStore vectorStore, OpenAIFileInfo file); |
| 1429 | public virtual Task<ClientResult<VectorStoreFileAssociation>> AddFileToVectorStoreAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default); |
| 1430 | public virtual Task<ClientResult> AddFileToVectorStoreAsync(string vectorStoreId, BinaryContent content, RequestOptions options = null); |
| 1431 | public virtual ClientResult<VectorStoreBatchFileJob> CancelBatchFileJob(VectorStoreBatchFileJob batchJob); |
| 1432 | public virtual ClientResult CancelBatchFileJob(string vectorStoreId, string batchId, RequestOptions options); |
| 1433 | public virtual ClientResult<VectorStoreBatchFileJob> CancelBatchFileJob(string vectorStoreId, string batchJobId, CancellationToken cancellationToken = default); |
| 1434 | public virtual Task<ClientResult<VectorStoreBatchFileJob>> CancelBatchFileJobAsync(VectorStoreBatchFileJob batchJob); |
| 1435 | public virtual Task<ClientResult> CancelBatchFileJobAsync(string vectorStoreId, string batchId, RequestOptions options); |
| 1436 | public virtual Task<ClientResult<VectorStoreBatchFileJob>> CancelBatchFileJobAsync(string vectorStoreId, string batchJobId, CancellationToken cancellationToken = default); |
| 1437 | public virtual ClientResult<VectorStoreBatchFileJob> CreateBatchFileJob(VectorStore vectorStore, IEnumerable<OpenAIFileInfo> files); |
| 1438 | public virtual ClientResult CreateBatchFileJob(string vectorStoreId, BinaryContent content, RequestOptions options = null); |
| 1439 | public virtual ClientResult<VectorStoreBatchFileJob> CreateBatchFileJob(string vectorStoreId, IEnumerable<string> fileIds, CancellationToken cancellationToken = default); |
| 1440 | public virtual Task<ClientResult<VectorStoreBatchFileJob>> CreateBatchFileJobAsync(VectorStore vectorStore, IEnumerable<OpenAIFileInfo> files); |
| 1441 | public virtual Task<ClientResult> CreateBatchFileJobAsync(string vectorStoreId, BinaryContent content, RequestOptions options = null); |
| 1442 | public virtual Task<ClientResult<VectorStoreBatchFileJob>> CreateBatchFileJobAsync(string vectorStoreId, IEnumerable<string> fileIds, CancellationToken cancellationToken = default); |
| 1443 | public virtual ClientResult<VectorStore> CreateVectorStore(VectorStoreCreationOptions vectorStore = null, CancellationToken cancellationToken = default); |
| 1444 | public virtual ClientResult CreateVectorStore(BinaryContent content, RequestOptions options = null); |
| 1445 | public virtual Task<ClientResult<VectorStore>> CreateVectorStoreAsync(VectorStoreCreationOptions vectorStore = null, CancellationToken cancellationToken = default); |
| 1446 | public virtual Task<ClientResult> CreateVectorStoreAsync(BinaryContent content, RequestOptions options = null); |
| 1447 | public virtual ClientResult<bool> DeleteVectorStore(VectorStore vectorStore); |
| 1448 | public virtual ClientResult DeleteVectorStore(string vectorStoreId, RequestOptions options); |
| 1449 | public virtual ClientResult<bool> DeleteVectorStore(string vectorStoreId, CancellationToken cancellationToken = default); |
| 1450 | public virtual Task<ClientResult<bool>> DeleteVectorStoreAsync(VectorStore vectorStore); |
| 1451 | public virtual Task<ClientResult> DeleteVectorStoreAsync(string vectorStoreId, RequestOptions options); |
| 1452 | public virtual Task<ClientResult<bool>> DeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default); |
| 1453 | public virtual ClientResult<VectorStoreBatchFileJob> GetBatchFileJob(VectorStoreBatchFileJob batchJob); |
| 1454 | public virtual ClientResult GetBatchFileJob(string vectorStoreId, string batchId, RequestOptions options); |
| 1455 | public virtual ClientResult<VectorStoreBatchFileJob> GetBatchFileJob(string vectorStoreId, string batchJobId, CancellationToken cancellationToken = default); |
| 1456 | public virtual Task<ClientResult<VectorStoreBatchFileJob>> GetBatchFileJobAsync(VectorStoreBatchFileJob batchJob); |
| 1457 | public virtual Task<ClientResult> GetBatchFileJobAsync(string vectorStoreId, string batchId, RequestOptions options); |
| 1458 | public virtual Task<ClientResult<VectorStoreBatchFileJob>> GetBatchFileJobAsync(string vectorStoreId, string batchJobId, CancellationToken cancellationToken = default); |
| 1459 | public virtual ClientResult<VectorStoreFileAssociation> GetFileAssociation(VectorStore vectorStore, OpenAIFileInfo file); |
| 1460 | public virtual ClientResult GetFileAssociation(string vectorStoreId, string fileId, RequestOptions options); |
| 1461 | public virtual ClientResult<VectorStoreFileAssociation> GetFileAssociation(string vectorStoreId, string fileId, CancellationToken cancellationToken = default); |
| 1462 | public virtual Task<ClientResult<VectorStoreFileAssociation>> GetFileAssociationAsync(VectorStore vectorStore, OpenAIFileInfo file); |
| 1463 | public virtual Task<ClientResult> GetFileAssociationAsync(string vectorStoreId, string fileId, RequestOptions options); |
| 1464 | public virtual Task<ClientResult<VectorStoreFileAssociation>> GetFileAssociationAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default); |
| 1465 | public virtual PageableCollection<VectorStoreFileAssociation> GetFileAssociations(VectorStore vectorStore, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null); |
| 1466 | public virtual PageableCollection<VectorStoreFileAssociation> GetFileAssociations(VectorStoreBatchFileJob batchJob, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null); |
| 1467 | public virtual ClientResult GetFileAssociations(string vectorStoreId, int? limit, string order, string after, string before, string filter, RequestOptions options); |
| 1468 | public virtual PageableCollection<VectorStoreFileAssociation> GetFileAssociations(string vectorStoreId, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null, CancellationToken cancellationToken = default); |
| 1469 | public virtual ClientResult GetFileAssociations(string vectorStoreId, string batchId, int? limit, string order, string after, string before, string filter, RequestOptions options); |
| 1470 | public virtual PageableCollection<VectorStoreFileAssociation> GetFileAssociations(string vectorStoreId, string batchJobId, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null, CancellationToken cancellationToken = default); |
| 1471 | public virtual AsyncPageableCollection<VectorStoreFileAssociation> GetFileAssociationsAsync(VectorStore vectorStore, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null); |
| 1472 | public virtual AsyncPageableCollection<VectorStoreFileAssociation> GetFileAssociationsAsync(VectorStoreBatchFileJob batchJob, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null); |
| 1473 | public virtual Task<ClientResult> GetFileAssociationsAsync(string vectorStoreId, int? limit, string order, string after, string before, string filter, RequestOptions options); |
| 1474 | public virtual AsyncPageableCollection<VectorStoreFileAssociation> GetFileAssociationsAsync(string vectorStoreId, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null, CancellationToken cancellationToken = default); |
| 1475 | public virtual Task<ClientResult> GetFileAssociationsAsync(string vectorStoreId, string batchId, int? limit, string order, string after, string before, string filter, RequestOptions options); |
| 1476 | public virtual AsyncPageableCollection<VectorStoreFileAssociation> GetFileAssociationsAsync(string vectorStoreId, string batchJobId, ListOrder? resultOrder = null, VectorStoreFileStatusFilter? filter = null, CancellationToken cancellationToken = default); |
| 1477 | |
| 1478 | public virtual ClientResult<VectorStore> GetVectorStore(VectorStore vectorStore); |
| 1479 | public virtual ClientResult GetVectorStore(string vectorStoreId, RequestOptions options); |
| 1480 | public virtual ClientResult<VectorStore> GetVectorStore(string vectorStoreId, CancellationToken cancellationToken = default); |
| 1481 | public virtual Task<ClientResult<VectorStore>> GetVectorStoreAsync(VectorStore vectorStore); |
| 1482 | public virtual Task<ClientResult> GetVectorStoreAsync(string vectorStoreId, RequestOptions options); |
| 1483 | public virtual Task<ClientResult<VectorStore>> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default); |
| 1484 | public virtual ClientResult GetVectorStores(int? limit, string order, string after, string before, RequestOptions options); |
| 1485 | public virtual PageableCollection<VectorStore> GetVectorStores(ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 1486 | public virtual Task<ClientResult> GetVectorStoresAsync(int? limit, string order, string after, string before, RequestOptions options); |
| 1487 | public virtual AsyncPageableCollection<VectorStore> GetVectorStoresAsync(ListOrder? resultOrder = null, CancellationToken cancellationToken = default); |
| 1488 | public virtual ClientResult<VectorStore> ModifyVectorStore(VectorStore vectorStore, VectorStoreModificationOptions options); |
| 1489 | public virtual ClientResult<VectorStore> ModifyVectorStore(string vectorStoreId, VectorStoreModificationOptions vectorStore, CancellationToken cancellationToken = default); |
| 1490 | public virtual ClientResult ModifyVectorStore(string vectorStoreId, BinaryContent content, RequestOptions options = null); |
| 1491 | public virtual Task<ClientResult<VectorStore>> ModifyVectorStoreAsync(VectorStore vectorStore, VectorStoreModificationOptions options); |
| 1492 | public virtual Task<ClientResult<VectorStore>> ModifyVectorStoreAsync(string vectorStoreId, VectorStoreModificationOptions vectorStore, CancellationToken cancellationToken = default); |
| 1493 | public virtual Task<ClientResult> ModifyVectorStoreAsync(string vectorStoreId, BinaryContent content, RequestOptions options = null); |
| 1494 | public virtual ClientPipeline Pipeline { get; } |
| 1495 | public virtual ClientResult<bool> RemoveFileFromStore(VectorStore vectorStore, OpenAIFileInfo file); |
| 1496 | public virtual ClientResult RemoveFileFromStore(string vectorStoreId, string fileId, RequestOptions options); |
| 1497 | public virtual ClientResult<bool> RemoveFileFromStore(string vectorStoreId, string fileId, CancellationToken cancellationToken = default); |
| 1498 | public virtual Task<ClientResult<bool>> RemoveFileFromStoreAsync(VectorStore vectorStore, OpenAIFileInfo file); |
| 1499 | public virtual Task<ClientResult> RemoveFileFromStoreAsync(string vectorStoreId, string fileId, RequestOptions options); |
| 1500 | public virtual Task<ClientResult<bool>> RemoveFileFromStoreAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default); |
| 1501 | protected VectorStoreClient(); |
| 1502 | public VectorStoreClient(OpenAIClientOptions options = null); |
| 1503 | public VectorStoreClient(ApiKeyCredential credential, OpenAIClientOptions options = null); |
| 1504 | protected VectorStoreClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options); |
| 1505 | } |
| 1506 | public class VectorStoreCreationOptions { |
| 1507 | public VectorStoreCreationOptions(); |
| 1508 | public FileChunkingStrategy ChunkingStrategy { get; init; } |
| 1509 | public VectorStoreExpirationPolicy ExpirationPolicy { get; init; } |
| 1510 | public IList<string> FileIds { get; init; } |
| 1511 | public IDictionary<string, string> Metadata { get; } |
| 1512 | public string Name { get; init; } |
| 1513 | } |
| 1514 | public class VectorStoreModificationOptions { |
| 1515 | public VectorStoreModificationOptions(); |
| 1516 | public VectorStoreExpirationPolicy ExpirationPolicy { get; init; } |
| 1517 | public IDictionary<string, string> Metadata { get; } |
| 1518 | public string Name { get; init; } |
| 1519 | } |
| 1520 | public abstract class FileChunkingStrategy { |
| 1521 | protected FileChunkingStrategy(); |
| 1522 | public static FileChunkingStrategy Auto { get; } |
| 1523 | public static FileChunkingStrategy Unknown { get; } |
| 1524 | public static FileChunkingStrategy CreateStaticStrategy(int maxTokensPerChunk, int overlappingTokenCount); |
| 1525 | } |
| 1526 | public class StaticFileChunkingStrategy : FileChunkingStrategy { |
| 1527 | public StaticFileChunkingStrategy(int maxTokensPerChunk, int overlappingTokenCount); |
| 1528 | public int MaxTokensPerChunk { get; } |
| 1529 | public int OverlappingTokenCount { get; } |
| 1530 | } |
| 1531 | public class VectorStore { |
| 1532 | public DateTimeOffset CreatedAt { get; } |
| 1533 | public VectorStoreExpirationPolicy ExpirationPolicy { get; } |
| 1534 | public DateTimeOffset? ExpiresAt { get; } |
| 1535 | public VectorStoreFileCounts FileCounts { get; } |
| 1536 | public string Id { get; } |
| 1537 | public DateTimeOffset? LastActiveAt { get; } |
| 1538 | public IReadOnlyDictionary<string, string> Metadata { get; } |
| 1539 | public string Name { get; } |
| 1540 | public VectorStoreStatus Status { get; } |
| 1541 | public int UsageBytes { get; } |
| 1542 | } |
| 1543 | public class VectorStoreBatchFileJob { |
| 1544 | public string BatchId { get; } |
| 1545 | public DateTimeOffset CreatedAt { get; } |
| 1546 | public VectorStoreFileCounts FileCounts { get; } |
| 1547 | public VectorStoreBatchFileJobStatus Status { get; } |
| 1548 | public string VectorStoreId { get; } |
| 1549 | } |
| 1550 | public readonly struct VectorStoreBatchFileJobStatus : IEquatable<VectorStoreBatchFileJobStatus> { |
| 1551 | public VectorStoreBatchFileJobStatus(string value); |
| 1552 | public static VectorStoreBatchFileJobStatus Cancelled { get; } |
| 1553 | public static VectorStoreBatchFileJobStatus Completed { get; } |
| 1554 | public static VectorStoreBatchFileJobStatus Failed { get; } |
| 1555 | public static VectorStoreBatchFileJobStatus InProgress { get; } |
| 1556 | public static bool operator ==(VectorStoreBatchFileJobStatus left, VectorStoreBatchFileJobStatus right); |
| 1557 | public static implicit operator VectorStoreBatchFileJobStatus(string value); |
| 1558 | public static bool operator !=(VectorStoreBatchFileJobStatus left, VectorStoreBatchFileJobStatus right); |
| 1559 | public bool Equals(VectorStoreBatchFileJobStatus other); |
| 1560 | public override bool Equals(object obj); |
| 1561 | public override int GetHashCode(); |
| 1562 | public override string ToString(); |
| 1563 | } |
| 1564 | public class VectorStoreExpirationPolicy { |
| 1565 | internal [SetsRequiredMembers] |
| 1566 | public VectorStoreExpirationPolicy(VectorStoreExpirationAnchor anchor, int days); |
| 1567 | public VectorStoreExpirationPolicy(); |
| 1568 | public required VectorStoreExpirationAnchor Anchor { get; init; } |
| 1569 | public required int Days { get; init; } |
| 1570 | } |
| 1571 | public class VectorStoreFileAssociation { |
| 1572 | public FileChunkingStrategy ChunkingStrategy { get; } |
| 1573 | public DateTimeOffset CreatedAt { get; } |
| 1574 | public string FileId { get; } |
| 1575 | public VectorStoreFileAssociationError? LastError { get; } |
| 1576 | public int Size { get; } |
| 1577 | public VectorStoreFileAssociationStatus Status { get; } |
| 1578 | public string VectorStoreId { get; } |
| 1579 | } |
| 1580 | public readonly struct VectorStoreFileAssociationError { |
| 1581 | public VectorStoreFileAssociationError(); |
| 1582 | public VectorStoreFileAssociationErrorCode Code { get; } |
| 1583 | public string Message { get; } |
| 1584 | } |
| 1585 | public readonly struct VectorStoreFileAssociationErrorCode : IEquatable<VectorStoreFileAssociationErrorCode> { |
| 1586 | public VectorStoreFileAssociationErrorCode(string value); |
| 1587 | public static VectorStoreFileAssociationErrorCode FileNotFound { get; } |
| 1588 | public static VectorStoreFileAssociationErrorCode InternalError { get; } |
| 1589 | public static VectorStoreFileAssociationErrorCode ParsingError { get; } |
| 1590 | public static VectorStoreFileAssociationErrorCode UnhandledMimeType { get; } |
| 1591 | public static bool operator ==(VectorStoreFileAssociationErrorCode left, VectorStoreFileAssociationErrorCode right); |
| 1592 | public static implicit operator VectorStoreFileAssociationErrorCode(string value); |
| 1593 | public static bool operator !=(VectorStoreFileAssociationErrorCode left, VectorStoreFileAssociationErrorCode right); |
| 1594 | public bool Equals(VectorStoreFileAssociationErrorCode other); |
| 1595 | public override bool Equals(object obj); |
| 1596 | public override int GetHashCode(); |
| 1597 | public override string ToString(); |
| 1598 | } |
| 1599 | public readonly struct VectorStoreFileCounts { |
| 1600 | public VectorStoreFileCounts(); |
| 1601 | public int Cancelled { get; } |
| 1602 | public int Completed { get; } |
| 1603 | public int Failed { get; } |
| 1604 | public int InProgress { get; } |
| 1605 | public int Total { get; } |
| 1606 | } |
| 1607 | public readonly struct VectorStoreFileStatusFilter : IEquatable<VectorStoreFileStatusFilter> { |
| 1608 | public VectorStoreFileStatusFilter(string value); |
| 1609 | public static VectorStoreFileStatusFilter Cancelled { get; } |
| 1610 | public static VectorStoreFileStatusFilter Completed { get; } |
| 1611 | public static VectorStoreFileStatusFilter Failed { get; } |
| 1612 | public static VectorStoreFileStatusFilter InProgress { get; } |
| 1613 | public static bool operator ==(VectorStoreFileStatusFilter left, VectorStoreFileStatusFilter right); |
| 1614 | public static implicit operator VectorStoreFileStatusFilter(string value); |
| 1615 | public static bool operator !=(VectorStoreFileStatusFilter left, VectorStoreFileStatusFilter right); |
| 1616 | public bool Equals(VectorStoreFileStatusFilter other); |
| 1617 | public override bool Equals(object obj); |
| 1618 | public override int GetHashCode(); |
| 1619 | public override string ToString(); |
| 1620 | } |
| 1621 | public enum VectorStoreExpirationAnchor { |
| 1622 | Unknown = 0, |
| 1623 | LastActiveAt = 1, |
| 1624 | } |
| 1625 | public enum VectorStoreFileAssociationStatus { |
| 1626 | Unknown = 0, |
| 1627 | InProgress = 1, |
| 1628 | Completed = 2, |
| 1629 | Cancelled = 3, |
| 1630 | Failed = 4, |
| 1631 | } |
| 1632 | public enum VectorStoreStatus { |
| 1633 | Unknown = 0, |
| 1634 | InProgress = 1, |
| 1635 | Completed = 2, |
| 1636 | Expired = 3, |
| 1637 | } |
| 1638 | } |
| 1639 | ``` |