-
-
Notifications
You must be signed in to change notification settings - Fork 158
Closed
RageAgainstThePixel/com.openai.unity
#235Description
Discussed in #316
Feature Request
Overview
@sibbl
I want to build a message with a tool_call_id
from scratch. Basically like in this python code from the OpenAI docs:
messages.append(
{
"tool_call_id": tool_call.id,
"role": "tool",
"name": function_name,
"content": function_response,
}
)
Proposed Change
diff --git forkSrcPrefix/OpenAI-DotNet/Chat/Message.cs forkDstPrefix/OpenAI-DotNet/Chat/Message.cs
index a16bd605a18dcb79d7e6c3a304b11b45a3bebb7f..227df6a2b8712c7dc07caeef94c92242ce223860 100644
--- forkSrcPrefix/OpenAI-DotNet/Chat/Message.cs
+++ forkDstPrefix/OpenAI-DotNet/Chat/Message.cs
@@ -65,6 +65,18 @@ namespace OpenAI.Chat
ToolCallId = tool.Id;
}
+ /// <summary>
+ /// Creates a new message to insert into a chat conversation.
+ /// </summary>
+ /// <param name="toolCallId">The tool_call_id to use for the message.</param>
+ /// <param name="toolFunctionName">Name of the function call.</param>
+ /// <param name="content">Tool function response.</param>
+ public Message(string toolCallId, string toolFunctionName, IEnumerable<Content> content)
+ : this(Role.Tool, content, toolFunctionName)
+ {
+ ToolCallId = toolCallId;
+ }
+
/// <summary>
/// The <see cref="OpenAI.Role"/> of the author of this message.
/// </summary>
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request