spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

Use openAiApi but custom request URL

Open Dragonchu opened this issue 9 months ago • 0 comments

I'm using a company-specific proxy to interact with OpenAI. Our proxy requires a different URL structure for sending queries, specifically http://gpt-proxy.xx.com/gateway/azure/chat/completions

I can customize the base URL using the spring.ai.openai.base-url configuration, but the OpenAiApi seems to always append /v1/chat/completions to the base URL. This doesn't work with our required URL structure.

Could we have a new configuration property that allows for customization of this appended URI? This way, we could configure our application like this:

spring.ai.openai.base-url=http://gpt-proxy.xx.com/

spring.ai.openai.completions-uri=gateway/azure/chat/completions

This change would make the OpenAiApi more flexible for users with unique URL requirements.

Dragonchu avatar May 11 '24 05:05 Dragonchu