-
Notifications
You must be signed in to change notification settings - Fork 20
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
Allow arbitrary HTTP headers to be added to requests #109
Allow arbitrary HTTP headers to be added to requests #109
Conversation
@kofron Have you tested this against portkey? It might be a little more expressive for the additional headers to be a key-value map, rather than a header string. I think we should also have an example in the user guide showing the exact call for the portkey sample. You'll also have to run 'mix format' for the CI tests to pass. |
Sure have! Works a charm.
I like this suggestion, done.
Sounds good, happy to do that - how does one update the user guide. FWIW, it looks like this: OpenaiEx.new(open_ai_api_key)
|> OpenaiEx.with_base_url("https://api.portkey.ai/v1")
|> OpenaiEx.with_additional_headers(%{"x-portkey-api-key"=>portkey_api_key, "x-portkey-provider"=>"openai"})
Done. |
@kofron Looks good. The user guide is a livebook, so all the examples are executable. This probably belongs as a new subsection in the "Configuration" section between subsections "Base Url" and "Azure OpenAI". If you could delete the |
@restlessronin should be all set |
@kofron Merged. Thanks much 🙏🏾🙏🏾 for the PR. |
@restlessronin awesome, thanks for the library! What's the release cycle like for this hitting |
@kofron I just published v0.8.4 on hex.pm with the latest changes. |
Adds a single function,
with_additional_headers/1
that adds whatever heads the caller wants to the base request.This is useful for e.g. using portkey's LLM gateway.