Open preciz opened 1 month ago
Sounds like https://github.com/dvcrn/ex_openai/pull/21
it’s already merged, just not released yet
I saw that, but will that allow using multiple API providers at the same time from the same app?
I think that config should be moved from the Application env to be able to do that.
def MyOpenAICompatibleProviderOne do
use ExOpenAI, base_url: "url-one..."
end
def MyOpenAICompatibleProviderTwo do
use ExOpenAI, base_url: "url-two..."
end
This is closer to how I mean it.
From Elixir docs:
If you are writing a library to be used by other developers, it is generally recommended to avoid the application environment, as the application environment is effectively a global storage. For more information, read our library guidelines.
It is possible to pass api key and org key into the calls itself, eg:
ExOpenAI.Models.list_models(openai_api_key: "abc", openai_organization_key: "def")
Would it solve your usecase if the env could be overwritten in a similar way?
It would be one way to solve it now yes.
The better way would be similar to how multiple Repos in Ecto are configured.
Currently multiple companies provide OpenAI API compatible endpoints.
At the moment my observation is that the library can only be used with OpenAI due to how configuration works.
Are there any plans to change the library so configuration is more flexible and multiple providers could be used at the same time?