Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODE RUB: Add Reference to Examples #196

Open
ElbekDeveloper opened this issue Mar 26, 2023 · 0 comments
Open

CODE RUB: Add Reference to Examples #196

ElbekDeveloper opened this issue Mar 26, 2023 · 0 comments
Assignees
Labels
CODE RUB Clean up and align with The Standard

Comments

@ElbekDeveloper
Copy link
Contributor

ElbekDeveloper commented Mar 26, 2023

Probably update existing example too

using Standard.AI.OpenAI.Clients.OpenAIs;
using Standard.AI.OpenAI.Models.Configurations;
using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions;

var openAIApiConfigurations = new ApiConfigurations
{
    ApiKey = "YOUR_API_KEY",
    OrganizationId = "YOUR_ORG_ID"
};

var openAIClient = new OpenAIClient(openAIApiConfigurations);

var inputChatCompletion = new ChatCompletion
{
    Request = new ChatCompletionRequest
    {
        Model = "gpt-3.5-turbo",

        Messages = new ChatCompletionMessage[]
        {
            new ChatCompletionMessage
            {
                Role = "system",
                Content = "You are chat bot who teaches English"
            },
            new ChatCompletionMessage
            {
                Role = "user",
                Content = "Hello"
            }
        }
    }
};

ChatCompletion resultChatCompletion =
    await openAIClient.ChatCompletions.SendChatCompletionAsync(inputChatCompletion);

Array.ForEach(resultChatCompletion.Response.Choices, choice => Console.WriteLine(choice.Message.Content));
@ElbekDeveloper ElbekDeveloper self-assigned this Mar 26, 2023
@hassanhabib hassanhabib added the CODE RUB Clean up and align with The Standard label Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CODE RUB Clean up and align with The Standard
Projects
None yet
Development

No branches or pull requests

2 participants