-
Notifications
You must be signed in to change notification settings - Fork 198
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
ollama not using api key #530
Comments
Ahh yes I was aware of this but I forgot to fix it as I didn't think anyone was actually using ollama with a key. Its an easy fix. |
I wanted to use ollama on mobile, so ssh -L isn't an option, but running without auth is a bit too much. I'm using https://github.com/ParisNeo/ollama_proxy_server, which uses bearer token for api key. Not sure if it's compatible but openai client seems to get through. |
I'm using langchain dart for ollama so I'll have to look if auth is an option for that. |
When instantiating maid/lib/classes/ollama_model.dart Lines 191 to 197 in 2479541
You can add custom headers using the final chat = ChatOllama(
baseUrl: '$uri/api',
headers: { 'Authorization': 'Bearer: <token>' },
defaultOptions: ChatOllamaOptions(
model: name,
seed: seed
),
); |
OK this should work https://github.com/Mobile-Artificial-Intelligence/maid/actions/runs/8966774761 Can't test it myself because I'm out of town and I don't have my laptop |
The authentication seems to be missing from the headers. I've installed the version from the link you've provided. I think I'm supposed to see it? Or is it sent separately? As per doc. |
Sorry for the delay, had trouble downloading the APK due to some DNS resolution thing.
|
So its still not authd? Dam I really don't know what's going on then.
With regards,
Dane Madsen
…________________________________
From: Kirill Rd ***@***.***>
Sent: Sunday, May 12, 2024 10:15:00 PM
To: Mobile-Artificial-Intelligence/maid ***@***.***>
Cc: Dane Madsen ***@***.***>; State change ***@***.***>
Subject: Re: [Mobile-Artificial-Intelligence/maid] ollama not using api key (Issue #530)
Sorry for the delay, had trouble downloading the APK due to some DNS resolution thing.
127.0.0.1 - - [12/May/2024 12:12:45] "GET /api/tags HTTP/1.0" - -
User is not authorized
127.0.0.1 - - [12/May/2024 12:12:45] "GET /api/tags HTTP/1.0" 403 -
127.0.0.1 - - [12/May/2024 12:13:58] "GET /api/tags HTTP/1.0" - -
User is not authorized
127.0.0.1 - - [12/May/2024 12:13:58] "GET /api/tags HTTP/1.0" 403 -
—
Reply to this email directly, view it on GitHub<#530 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACYA2IYC36T3YMPJA6BDHGLZB5MMJAVCNFSM6AAAAABHFHUOCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGIZDMOJTGY>.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
Let me try and print what's being sent and what's being received. |
So, here's the problem.
The latter is a server-side issue |
Another problem is that "Bearer: " is incorrect as per https://datatracker.ietf.org/doc/html/rfc6750. |
Check out my repo, it’s a simple, secure way to manage API key authentication for your Ollama apps with a Caddy server. |
Good afternoon,
First of all, thank you for a great project. It's by far the only F-Droid app that allows me to use self-hosted LLMs.
It seems that authentication with ollama using api key is not implemented at all, making the app recieve 403 when connecting to my authenticated endpoint.
I believe the parent class of ollama has token, while the child does not use it:
https://github.com/Mobile-Artificial-Intelligence/maid/blob/main/lib/classes/ollama_model.dart (search for "header")
Adding it to the header could be done like this:
davidmigloz/langchain_dart#399
The text was updated successfully, but these errors were encountered: