Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review how URLs are composed in AI model clients to allow flexibility to change the version field in the URL path. #670

Open
markpollack opened this issue May 2, 2024 · 1 comment
Milestone

Comments

@markpollack
Copy link
Member

markpollack commented May 2, 2024

Several of the AI model implementations add /v1/<path-to-functionality> to the base url. For example the base url in OpenAiConnectionProperties is https://api.openai.com. The class OpenAIApi adds the path but hardcodes the /v1 part.

restClient.post().uri("/v1/chat/completions")

This is done in other AI API implementations. If there is a need to switch to a future v2 then we would need a code change.

Maybe we should make this a configuration property or some other way so that adopting to new versions of endpoints does not require a code change.

this issue was driven by a comment that the official Python api for openai attached assigns api.openai.com/v1 as the base url.

@markpollack markpollack added this to the 1.0.0-M2 milestone May 2, 2024
@markpollack
Copy link
Member Author

markpollack commented May 3, 2024

After thinking about it, is also likely that a v2 of the endpoint would have a different api so a different implementation class would be needed and that is where the v2 should be added to the base url.

So we should keep everything the way it is and follow the correct definition of what is a base url.

The base url strictly speaking is api.openai.com , see https://developer.mozilla.org/en-US/docs/Web/API/URL/URL and other libraries (like the official Python client for open ai) that add “v1” to the base url is wrong. Those libraries will need to likely remove the v1 from their wrongly assigned base url variable once there is a v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant