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