openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
mailinhphan/clientOptions

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

OpenAI/src/Custom/Chat/Streaming/StreamingChatToolCallUpdate.cs

43lines · modecode

1namespace OpenAI.Chat;
2
3using Microsoft.TypeSpec.Generator.Customizations;
4using System;
5
6/// <summary> A streaming update representing part of a tool call made by the model. </summary>
7[CodeGenType("ChatCompletionMessageToolCallChunk")]
8[CodeGenSuppress("StreamingChatToolCallUpdate", typeof(int))]
9public partial class StreamingChatToolCallUpdate
10{
11 // CUSTOM: Made internal.
12 [CodeGenMember("Function")]
13 internal InternalChatCompletionMessageToolCallChunkFunction Function { get; }
14 // CUSTOM:
15 // - Changed type to match public type.
16 /// <summary> The kind of tool.Currently, only<see cref="ChatToolCallKind.Function"/> is supported. </summary>
17 [CodeGenMember("Type")]
18 public ChatToolCallKind Kind { get; } = ChatToolCallKind.Function;
19
20 // CUSTOM: Renamed.
21 /// <summary>
22 /// The unique identifier of the tool call being streamed, as used with e.g.
23 /// <see cref="ChatToolCall.CreateFunctionToolCall(string, string, BinaryData)"/> or
24 /// <see cref="ToolChatMessage.ToolChatMessage(string, string)"/>.
25 /// </summary>
26 [CodeGenMember("Id")]
27 public string ToolCallId { get; }
28
29 /// <summary>
30 /// The name of the tool that the streaming tool call requests invocation of.
31 /// </summary>
32 public string FunctionName => Function?.Name;
33
34 // CUSTOM: Spread.
35 /// <summary>
36 /// The update to the arguments that the model is calling the function with, which are generated by the model
37 /// in JSON format. As part of a streaming response, the arguments are chunked and streamed across streaming
38 /// updates, and must therefore be accumulated in order to reconstruct them. Note that the model does not
39 /// always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate
40 /// the arguments in your code before calling your function.
41 /// </summary>
42 public BinaryData FunctionArgumentsUpdate => Function?.Arguments;
43}
44