openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.7

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Chat/ChatFunction.cs

42lines · modecode

1using System;
2
3namespace OpenAI.Chat;
4
5/// <summary>
6/// Represents the definition of a function that the model may call, as supplied in a chat completion request.
7/// </summary>
8[CodeGenModel("ChatCompletionFunctions")]
9[CodeGenSuppress("ChatFunction", typeof(string))]
10public partial class ChatFunction
11{
12 // CUSTOM: Added custom constructor.
13 /// <summary>
14 /// Creates a new instance of <see cref="ChatFunction"/>.
15 /// </summary>
16 /// <param name="functionName"> The <c>name</c> of the function. </param>
17 /// <param name="functionDescription"> The <c>description</c> of the function. </param>
18 /// <param name="functionParameters"> The <c>parameters</c> into the function, in JSON Schema format. </param>
19 public ChatFunction(string functionName, string functionDescription = null, BinaryData functionParameters = null)
20 {
21 Argument.AssertNotNull(functionName, nameof(functionName));
22
23 FunctionName = functionName;
24 FunctionDescription = functionDescription;
25 FunctionParameters = functionParameters;
26 }
27
28 // CUSTOM: Renamed.
29 /// <summary> The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. </summary>
30 [CodeGenMember("Name")]
31 public string FunctionName { get; }
32
33 // CUSTOM: Renamed
34 /// <summary> A description of what the function does, used by the model to choose when and how to call the function. </summary>
35 [CodeGenMember("Description")]
36 public string FunctionDescription { get; init; }
37
38 // CUSTOM: Changed type to BinarayData.
39 /// <summary> Gets or sets the parameters. </summary>
40 [CodeGenMember("Parameters")]
41 public BinaryData FunctionParameters { get; init; }
42}