-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Kattbot.Common.Models.KattGpt; | ||
|
||
public record ChatCompletionChoice | ||
{ | ||
/// <summary> | ||
/// The index of the choice in the list of choices. | ||
/// </summary> | ||
[JsonPropertyName("index")] | ||
public int Index { get; set; } | ||
Check warning on line 11 in Kattbot.Common/Models/KattGpt/ChatCompletionChoice.cs GitHub Actions / Build
|
||
|
||
/// <summary> | ||
/// A chat completion message generated by the model. | ||
/// </summary> | ||
[JsonPropertyName("message")] | ||
public ChatCompletionMessage Message { get; set; } = null!; | ||
Check warning on line 17 in Kattbot.Common/Models/KattGpt/ChatCompletionChoice.cs GitHub Actions / Build
|
||
|
||
/// <summary> | ||
/// The reason the model stopped generating tokens. | ||
/// This will be 'stop' if the model hit a natural stop point or a provided stop sequence, | ||
/// 'length' if the maximum number of tokens specified in the request was reached, | ||
/// 'content_filter' if content was omitted due to a flag from our content filters | ||
/// or 'tool_calls' if the model called a tool. | ||
/// </summary> | ||
[JsonPropertyName("finish_reason")] | ||
public ChoiceFinishReason FinishReason { get; set; } | ||
Check warning on line 27 in Kattbot.Common/Models/KattGpt/ChatCompletionChoice.cs GitHub Actions / Build
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
|
||
namespace Kattbot.Common.Models.KattGpt; | ||
|
||
/// <summary> | ||
/// Creates a model response for the given chat conversation. | ||
/// https://platform.openai.com/docs/api-reference/chat/create | ||
Check warning on line 7 in Kattbot.Common/Models/KattGpt/ChatCompletionCreateRequest.cs GitHub Actions / Build
|
||
/// </summary> | ||
public record ChatCompletionCreateRequest | ||
{ | ||
/// <summary> | ||
|
@@ -19,22 +23,34 @@ public record ChatCompletionCreateRequest | |
public ChatCompletionMessage[] Messages { get; set; } = null!; | ||
|
||
/// <summary> | ||
/// Gets or sets a list of functions the model may generate JSON inputs for. | ||
/// https://platform.openai.com/docs/api-reference/chat/create#functions. | ||
/// A list of tools the model may call. Currently, only functions are supported as a tool. | ||
/// Use this to provide a list of functions the model may generate JSON inputs for. | ||
/// A max of 128 functions are supported. | ||
/// https://platform.openai.com/docs/api-reference/chat/create#chat-create-tools | ||
/// </summary> | ||
[JsonPropertyName("functions")] | ||
public ChatCompletionFunction[]? Functions { get; set; } | ||
[JsonPropertyName("tools")] | ||
public ChatCompletionTool[]? Tools { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the mode for controlling the model responds to function calls. none means the model does not call a | ||
/// function, | ||
/// and responds to the end-user. auto means the model can pick between an end-user or calling a function. | ||
/// Specifying a particular function via {"name": "my_function"} forces the model to call that function. | ||
/// Defaults to "none" when no functions are present and "auto" if functions are present. | ||
/// https://platform.openai.com/docs/api-reference/chat/create#function_call. | ||
/// Controls which (if any) tool is called by the model. | ||
/// none means the model will not call any tool and instead generates a message. | ||
/// auto means the model can pick between generating a message or calling one or more tools. | ||
/// required means the model must call one or more tools. | ||
/// Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} | ||
/// forces the model to call that tool. | ||
/// none is the default when no tools are present. auto is the default if tools are present. | ||
/// https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice | ||
/// </summary> | ||
[JsonPropertyName("function_call")] | ||
public string? FunctionCall { get; set; } | ||
[JsonPropertyName("tool_choice")] | ||
public StringOrObject<ChatCompletionToolChoice> ToolChoice { get; set; } | ||
|
||
/// <summary> | ||
/// Whether to enable parallel function calling during tool use. | ||
/// Defaults to true | ||
/// https://platform.openai.com/docs/api-reference/chat/create#chat-create-parallel_tool_calls | ||
/// </summary> | ||
[JsonPropertyName("parallel_tool_calls")] | ||
public bool ParallelToolCalls { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Gets or sets what sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Kattbot.Common.Models.KattGpt; | ||
|
||
public record ChatCompletionFunctionCall | ||
{ | ||
public ChatCompletionFunctionCall(string name, string arguments) | ||
{ | ||
Name = name; | ||
Arguments = arguments; | ||
} | ||
|
||
/// <summary> | ||
/// The name of the function to call. | ||
/// </summary> | ||
[JsonPropertyName("name")] | ||
public string Name { get; } | ||
Check warning on line 17 in Kattbot.Common/Models/KattGpt/ChatCompletionFunctionCall.cs GitHub Actions / Build
|
||
|
||
/// <summary> | ||
/// The arguments to call the function with, as generated by the model in JSON format. | ||
/// Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your | ||
/// function schema. | ||
/// Validate the arguments in your code before calling your function. | ||
/// </summary> | ||
[JsonPropertyName("arguments")] | ||
public string Arguments { get; } | ||
Check warning on line 26 in Kattbot.Common/Models/KattGpt/ChatCompletionFunctionCall.cs GitHub Actions / Build
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Kattbot.Common.Models.KattGpt; | ||
|
||
public record ChatCompletionFunctionChoice | ||
{ | ||
/// <summary> | ||
/// The name of the function to call. | ||
/// </summary> | ||
[JsonPropertyName("name")] | ||
public string Name { get; set; } = null!; | ||
Check warning on line 11 in Kattbot.Common/Models/KattGpt/ChatCompletionFunctionChoice.cs GitHub Actions / Build
|
||
} |