Headers for authentication
Closed this issue · 4 comments
Is there any way to setup the headers for authentication to a remote server running ollama?
Something similar to param_headers in langchain community : https://api.python.langchain.com/en/latest/llms/langchain_community.llms.ollama.Ollama.html#langchain_community.llms.ollama.Ollama.headers
I see httpr2 supports custom headers https://httr2.r-lib.org/reference/req_headers.html, but I am not 100% clear about the best way to set them from an user standpoint and pass them in the call.
I can try to help if needed, but for R I'm mostly an user and not really a developer!
Could you point me to a server that uses authentication? As far as I'm aware, authentication is not supported by Ollama natively (yet).
We could add an option to supply custom headers here, but it would be good to have a test case and example implementation.
In my setup I use Ollama behind this proxy which adds authentication: https://github.com/ParisNeo/ollama_proxy_server
Another option (which I did not use so far) is this other project: https://github.com/g1ibby/ollama-auth
Excellent, thanks! Can you test and see if the newest commit works for you? It works like this:
library(rollama)
options(rollama_headers = list(Authorization = "Bearer <USER_KEY>"))
query("why is the sky blue?")
I will test these two options later.
Great, I tested and I can confirm the latest commit works well with authentication!
Thanks for the feature addition, it really helps!