dvcrn / ex_openai

Auto-generated Elixir SDK for OpenAI APIs with full typespecs, docs and streaming support
MIT License
71 stars 27 forks source link

Add base_url override support, to allow changing the OpenAI endpoint. #21

Closed joshuataylor closed 2 months ago

joshuataylor commented 4 months ago

The OpenAI Python library allows overriding the base_url when defining the client.

It would be great if we could do this on a config level, where api_url in ExOpenAI.Config could be defined in config like this:

config :ex_openai,
  base_url: System.get_env("OPENAI_BASE_URL"),

Then it would override the base_url.

Let me know what you think of this, happy for any changes, it's a pretty basic change, so do what you think is best :).

eadz commented 4 months ago

+1 for this. There are a lots of openapi compatible services out there.

dvcrn commented 3 months ago

Interesting, I didn't know such a use case exists. Thanks for the PR! lGTM

Tonyhaenn commented 2 months ago

Any ETA on merging this PR?

dvcrn commented 2 months ago

Slipped through the cracks, whoops!

Tonyhaenn commented 2 months ago

Woot! Thanks for the speedy turnaround.

Big thanks to @joshuataylor for the original PR

dvcrn commented 2 months ago

I want to cut a new release after changes (if any) required for the new gpt-4o model, will try to get around it soon-ish

Tonyhaenn commented 2 months ago

Thank you! I read that GPT4o right now is only supporting text input / output for now. The new AV input/output would be rolled out in the coming months.

I'm building an app that's going to use both Gpt4 and llama3, so eager to see this go live :)