-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Support other vendors compatible with OpenAI chat completions API #428
Comments
+1 to this idea! |
This would be great, especially following today's announcement https://www.anthropic.com/news/claude-3-family |
Thanks @pasilastbot - this would be really cool - definitely welcome your PR |
My 2 cents: I just found out today that the awesome @obie has created this: https://github.com/OlympiaAI/open_router It makes use of the OpenRouter API which is a single unified interface for all LLMs Perhaps incorporating open_router with ruby-openai would be a good way forward... |
@etewiah I think these are separate needs. OpenRouter is an excellent service, suitable for smaller personal usage. For larger scale production and enterprise data, I (and my clients) prefer that data would not flow via 3rd party web service or use somebody elses AI instances. And to my understanding, ruby-openai would already work with OpenRouter by setting custom domain? I have also developed a ruby service class on top of ruby-openai, which actually does mapping of system and user messages, function calls, rag documents and images for various AI services. It also calculates the prices and handles rate-limits. It allows me to switch models between OpenAI, Anthropic, Cohere, Google Gemini, Mistral and many others. Right now has some proprietary stuff, but I could think of making it more generic and opensource. @alexrudall I will make a PR later this week, once have some time for coding. |
@alexrudall would you be open to a PR that adds support for the Claude models? I have a standalone implementation that handles streaming and non-streaming requests. I would need to port it over. |
There are a lot of other AI vendors that have provided OpenAI compatible chat completions API. It would be nice if we could utilise this library to use them as well. Vendors include e.g.:
Anthropic claude: https://docs.anthropic.com/claude/reference/messages_post
Mistral AI: https://docs.mistral.ai/api/
Perplexity AI: https://docs.perplexity.ai/reference/post_chat_completions
Only thing we would need to change is to add custom_path parameter to configuration, that would allow setting custom API path not /v1/chat/completions.
I have implemented and tested this change in our own fork, can create a pull request if this fits the scope of this Gem.
https://github.com/LastBotInc/ruby-openai?tab=readme-ov-file#other-chat-completion-apis
The text was updated successfully, but these errors were encountered: