weasy
weasy
CC#
Created by weasy on 1/17/2024 in #help
In my code, it says I have a null parameter, this is my first bit of code, Where am I going wrong?
My first code ever. using Azure; using Azure.AI.OpenAI; using System; using static System.Environment; internal class Program { public static string SetEnvironmentVariables { get; private set; } private static void Main(string[] args) { string endpoint = "https://api.openai.com/v1"; string key = GetEnvironmentVariable("sk-key"); OpenAIClient client = new OpenAIClient(new Uri(endpoint), new AzureKeyCredential(key)); CompletionsOptions completionsOptions = new() { DeploymentName = "gpt-35-turbo-instruct", Prompts = { "When was Microsoft founded?" }, }; Response<Completions> completionsResponse = client.GetCompletions(completionsOptions); string completion = completionsResponse.Value.Choices[0].Text; Console.WriteLine($"Chatbot: {completion}"); } }
10 replies