Describe the bug
The SSL connection could not be established, see inner exception.
SocketException: An existing connection was forcibly closed by the remote host.
Your code piece
public async Task GenerateResponse2()
{
var openAiService = new OpenAIService(new OpenAiOptions()
{
ApiKey = apiKey
});
var completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
{
Messages = new List<ChatMessage>
{
ChatMessage.FromSystem("You are a helpful assistant."),
ChatMessage.FromUser("Who won the world series in 2020?"),
ChatMessage.FromAssistant("The Los Angeles Dodgers won the World Series in 2020."),
ChatMessage.FromUser("Where was it played?")
},
Model = Models.ChatGpt3_5Turbo,
MaxTokens = 50//optional
});
if (completionResult.Successful)
{
Console.WriteLine(completionResult.Choices.First().Message.Content);
}
}
If you need to use a self-signed SSL certificate you may want to pass your own HTTP client to the library. There was a topic in the discussion about this.
Describe the bug The SSL connection could not be established, see inner exception. SocketException: An existing connection was forcibly closed by the remote host.
Your code piece