brainlid / langchain

Elixir implementation of a LangChain style framework.
https://hexdocs.pm/langchain/
Other
505 stars 58 forks source link

Add possibility to use api_key per chat invocation. #46

Closed michalwarda closed 7 months ago

michalwarda commented 7 months ago

In this PR I'm suggesting an addition of api_key passing directly through the Chat interface. This is done to allow users of the library to dynamically pass api_key based on who is using the chat.

My personal use case is as following: I give my users possibility to pass their own OpenAI API_KEY through interface. Because of that I can't retrieve it from config. I have to inject it during the call.

In case I''ve missed anything in the PR I'm happy to improve it!

Thanks!

brainlid commented 7 months ago

Your use case makes sense and it's a clean solution. Thanks!

❤️💛💙💜