Open erossini opened 1 month ago
Hi @erossini, first of all, thank you for your interest in my project. I've updated the project to Chat Completion, including the current model for both requests and responses. To add instructions for the assistant bot, you'll need to do so in the system role's content, located in OpenAIService.cs
. For modifying the tokens, you can adjust them in the Usage class found in CompletionResponse.cs
I've included the code where you can change these parameters. Let me know if you encounter any errors so I can improve the code. Thanks!
public async Task<string> AskQuestion(string query)
{
var completion = new CompletionRequest
{
Model = "gpt-4o-mini",
Messages = new List<MessageRequest>
{
new MessageRequest
{
Role = "system",
Content = "You are a helpful assistant."
},
new MessageRequest
{
Role = "user",
Content = query
}
}
};
// ...
}
public class CompletionResponse
{
public string Id { get; set; }
public List<Choice> Choices { get; set; }
public Usage Usage { get; set; }
}
public class Usage
{
public int Prompt_Tokens { get; set; } = 9;
public int Completion_Tokens { get; set; } = 12;
public int Total_Tokens { get; set; } = 21;
}
Thank you so much for your code!
I'm creating an application with ChatGPT and I saw your project. My project for university is to create a simple English teacher that speaks with the user. To do that, I understood, I have to pass the
instruction
to ChatGPT likeLooking at your code, I didn't understand if and where I can add these instructions. Can you point me in the right direction?
I really appreciate any help you can provide. Enrico