-
Notifications
You must be signed in to change notification settings - Fork 15.7k
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
community[minor]: passthrough auth parameter on requests to Ollama-LLMs #24068
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion in case unit tests fail
@@ -130,6 +130,10 @@ class _OllamaCommon(BaseLanguageModel): | |||
tokens for authentication. | |||
""" | |||
|
|||
auth: Callable | tuple | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to import
from __future__ import annotations
@@ -1,5 +1,5 @@ | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import json | |
from __future__ import annotations | |
import json |
There are some broken unit tests. Are you able to resolve those? |
Head branch was pushed to by a user without write access
I think I fixed the broken unit tests, but I'm not sure, because I'm having trouble running them locally. |
I fixed the remaining problem found by the linter. |
…Ms (langchain-ai#24068) Thank you for contributing to LangChain! **Description:** This PR allows users of `langchain_community.llms.ollama.Ollama` to specify the `auth` parameter, which is then forwarded to all internal calls of `requests.request`. This works in the same way as the existing `headers` parameters. The auth parameter enables the usage of the given class with Ollama instances, which are secured by more complex authentication mechanisms, that do not only rely on static headers. An example are AWS API Gateways secured by the IAM authorizer, which expects signatures dynamically calculated on the specific HTTP request. **Issue:** Integrating a remote LLM running through Ollama using `langchain_community.llms.ollama.Ollama` only allows setting static HTTP headers with the parameter `headers`. This does not work, if the given instance of Ollama is secured with an authentication mechanism that makes use of dynamically created HTTP headers which for example may depend on the content of a given request. **Dependencies:** None **Twitter handle:** None --------- Co-authored-by: Eugene Yurtsev <[email protected]>
Thank you for contributing to LangChain!
Description:
This PR allows users of
langchain_community.llms.ollama.Ollama
to specify theauth
parameter, which is then forwarded to all internal calls ofrequests.request
. This works in the same way as the existingheaders
parameters. The auth parameter enables the usage of the given class with Ollama instances, which are secured by more complex authentication mechanisms, that do not only rely on static headers. An example are AWS API Gateways secured by the IAM authorizer, which expects signatures dynamically calculated on the specific HTTP request.Issue:
Integrating a remote LLM running through Ollama using
langchain_community.llms.ollama.Ollama
only allows setting static HTTP headers with the parameterheaders
. This does not work, if the given instance of Ollama is secured with an authentication mechanism that makes use of dynamically created HTTP headers which for example may depend on the content of a given request.Dependencies:
None
Twitter handle:
None