Created
January 26, 2024 09:06
-
-
Save bjoerntx/146500c6408d06fa09804ef4bb0cd229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace TXTextControl.OpenAI { | |
public class ChatGPTRequest | |
{ | |
public string Text { get; set; } | |
public string Type { get; set; } | |
} | |
public class RequestMessage | |
{ | |
[JsonPropertyName("role")] | |
public string Role { get; set; } | |
[JsonPropertyName("content")] | |
public string Content { get; set; } | |
} | |
public class Request | |
{ | |
[JsonPropertyName("model")] | |
public string Model { get; set; } = "gpt-3.5-turbo"; | |
[JsonPropertyName("max_tokens")] | |
public int MaxTokens { get; set; } = 100; | |
[JsonPropertyName("messages")] | |
public RequestMessage[] Messages { get; set; } | |
} | |
public class Response | |
{ | |
[JsonPropertyName("id")] | |
public string Id { get; set; } | |
[JsonPropertyName("created")] | |
public int Created { get; set; } | |
[JsonPropertyName("model")] | |
public string Model { get; set; } | |
[JsonPropertyName("usage")] | |
public ResponseUsage Usage { get; set; } | |
[JsonPropertyName("choices")] | |
public ResponseChoice[] Choices { get; set; } | |
} | |
public class ResponseUsage | |
{ | |
[JsonPropertyName("prompt_tokens")] | |
public int PromptTokens { get; set; } | |
[JsonPropertyName("completion_tokens")] | |
public int CompletionTokens { get; set; } | |
[JsonPropertyName("total_tokens")] | |
public int TotalTokens { get; set; } | |
} | |
public class ResponseChoice | |
{ | |
[JsonPropertyName("message")] | |
public ResponseMessage Message { get; set; } | |
[JsonPropertyName("finish_reason")] | |
public string FinishReason { get; set; } | |
[JsonPropertyName("index")] | |
public int Index { get; set; } | |
} | |
public class ResponseMessage | |
{ | |
[JsonPropertyName("role")] | |
public string Role { get; set; } | |
[JsonPropertyName("content")] | |
public string Content { get; set; } | |
} | |
public class ChatGPTResponse | |
{ | |
public string Id { get; set; } | |
public Choice[] Choices { get; set; } | |
} | |
public class Choice | |
{ | |
public string Text { get; set; } | |
public int Index { get; set; } | |
} | |
public class Constants | |
{ | |
public static string OPENAI_API_KEY = ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment