I'm trying to connect to GPT4All with the code below, but getting this error:
ERROR:
{StatusCode: 204, ReasonPhrase: 'No Content', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Access-Control-Allow-Origin: *
Content-Type: application/x-empty
Content-Length: 0
}}
CODE:
public async Task<string> GetResponseAsync()
{
var payload = new
{
prompt = "Who is Barack Obama?",
max_tokens = 10,
};
var content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");
var baseAddress = new Uri("http://localhost:4891/v1/completions");
var response = await _httpClient.PostAsync(baseAddress, content);
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync();
return responseString;
}