Open davidd00 opened 1 year ago
I have fixed the extra parenthesis in the generated URL, sorry about that. Beyond that, I don't have any insight into what those values should be or how to test it. Microsoft denied my application to access the Azure OpenAI endpoint, so I'm just guessing based on documentation. Can you give me an example of a correct HTTP request that works for you, including all headers except authorization? That way to can try to make sure this SDK works similarly.
I have access to Azure OpenAI. I will look into this today and provide feedback. I hope I can be of help.
Sorry, I missed the answer to the issue. I'll try to test it today too. Thanks!
Just wanted to add to this thread that - it's all working fine for me, with an Azure OpenAI deployment. The parenthesis fix was all that was needed.
Just wanted to add to this thread that - it's all working fine for me, with an Azure OpenAI deployment. The parenthesis fix was all that was needed.
I confirm that the parenthesis issue is fixed and it's working fine now 👍 Thanks!
I have fixed the extra parenthesis in the generated URL, sorry about that. Beyond that, I don't have any insight into what those values should be or how to test it. Microsoft denied my application to access the Azure OpenAI endpoint, so I'm just guessing based on documentation. Can you give me an example of a correct HTTP request that works for you, including all headers except authorization? That way to can try to make sure this SDK works similarly.
This's the console of Azure OpenAI. The blue part is 'YourResourceName' and the red part is 'deploymentId'.
Response:
Hope this helps you.
And don't worry. Your SDK is perfectly usable. Thanks.
This works for me.
HttpRequestMessage request = new() { Method = HttpMethod.Post, RequestUri = new Uri( $"https://{resourceName}.openai.azure.com/openai/deployments/{deploymentName}/completions?api-version=2022-12-01" ), Content = new StringContent( completionMessage.ToString(), Encoding.UTF8, "application/json" ), }; request.Headers.Clear(); request.Headers.Accept.Add( new MediaTypeWithQualityHeaderValue( "application/json" ) ); request.Headers.Add( "api-key", apiKey );
var response = await _httpClient.SendAsync( request );
{ "prompt": "", "temperature": 1, "top_p": 0.5, "frequency_penalty": 0, "presence_penalty": 0, "max_tokens": 100, "best_of": 1, "stop": null }
I have tried with gpt-35-turbo (version 0301) and 2023-03-15-preview and it's ok.
I'm trying to use this library with an Azure OpenIA resource. I'm using the example in the readme:
OpenAIAPI api = OpenAIAPI.ForAzure("YourResourceName", "deploymentId", "api-key");
, but Url created seems to be wrong.OpenAIAPI api object initialization:
OpenAIAPI api = OpenAIAPI.ForAzure("opeanai-resource", "deployedEngine", "apikey");
CreatedUrl:https://opeanai-resource.openai.azure.com/openai/deployments/deployedEngine)/{1}?api-version={0}
It adds a clos parenthesis to the resource engine, so I get this error:
The API deployment for the resource does not exist.
I guess the ApiVersion
{0}
and the completion{1}
are added when doing the requests, but are not showed in the Url