[Brief Issue Description] Library doesn't work with Azure (malformed base url)
Description
Thanks for the amazing library first of all, it's really nice to have a kotlin-based lib for interacting with these services, and I really like the API.
Let's start by saying that I have no issues with OpenAI, it works as intented.
With Microsoft Azure however I cannot use it: I've investigated the error and apparently it's due to a malformation of the base url. Let me explain:
The URL Azure Al Foundry portal shows me is: https://<ID>-germanywestcentra.cognitiveservices.azure.com/openai/deployments/gpt-4o/v1/completions
But when using openai-kotlin and I set the baseUrl to:
https://mirce-m7vrcp1d-germanywestcentra.cognitiveservices.azure.com/openai/deployments/gpt-4o/v1/
It appends /chat/completions at the end of the url, making it invalid (/chat is not required).
Also I can't use OpenAIHost.azure(...) because it takes for granted that the service is hosted on .openai.azure.com, which is not (as you can see from the url Azure gives me.
Do you think it would be possible for you to tackle it when you have some free time?
I have the same problem. Configuring it the for openai compatible endpoint of deepinfra results in invalid urls:
val deepinfra = OpenAI(
token = deepInfraApiKey,
host = OpenAIHost("https://api.deepinfra.com/v1/openai")
)
deepinfra.embeddings(embeddingRequest)
--> Client request(POST https://api.deepinfra.com/v1/embeddings) invalid: 404 Not Found.
The url should have been https://api.deepinfra.com/v1/openai/embeddings
_
I was able to get it to work with fudging the baseurl:
val deepinfra = OpenAI(
token = deepInfraApiKey,
host = OpenAIHost("https://api.deepinfra.com/v1/openai/DUMMY")
)
FYI this affects version 3.8.2. I haven't confirmed if either the bug or the workaround apply to 4.x.x