continue icon indicating copy to clipboard operation
continue copied to clipboard

Support of apiKey in Ollama embeddings provider

Open vills opened this issue 1 year ago • 4 comments

Before submitting your bug report

Relevant environment info

- OS: macOS 14.5
- Continue: v0.9.197 (pre-release)
- IDE: VSCode 1.92.1
- Model: nomic-embed-text
- config.json:
  
{
  "embeddingsProvider": {
    "provider": "ollama",
    "model": "nomic-embed-text",
    "apiBase": "https://remote-ollama-instance-behind-open-webui/ollama",
    "apiKey": "api-token-from-open-webui"
  }
}

Description

Ollama embeddings provider return 401 unauthorized. As i can see in OllamaEmbeddingsProvider.ts file there are no support of apiKey for Ollama when used as embeddings provider. Could you please add this header also?

To reproduce

No response

Log output

No response

vills avatar Aug 14 '24 13:08 vills

Hi, try this it work

https://docs.openwebui.com/tutorial/continue-dev/

Le-Syl21 avatar Aug 15 '24 07:08 Le-Syl21

Hi, try this it work

https://docs.openwebui.com/tutorial/continue-dev/

It works with models and tabautocomplete sections, but not in embeddings.

vills avatar Aug 19 '24 09:08 vills

@Le-Syl21 i just found out, that you encouraged me to try openai compatible api? for some reason i got 404 response from ollama in /v1/embeddings endpoint

"embeddingsProvider": {
  "provider": "openai",
  "model": "mxbai-embed-large",
  "apiBase": "https://remote-ollama-instance-behind-open-webui/ollama/v1",
  "apiKey": "api-token-from-open-webui"
}

"POST /ollama/v1/embeddings HTTP/1.1" 404 Not Found

vills avatar Aug 19 '24 09:08 vills

According to the ollama docs for open-webui (http://open-webui/ollama/docs), there is no http://open-webui/ollama/v1/embeddings, And ollama has no v1 path in their api

There is an http://open-webui/ollama/api/embeddings which requires auth when it's enabled and expects the following in the request:

{
  "model": "string",
  "prompt": "string",
  "options": {},
  "keep_alive": "string"
}

andrew-stclair avatar Sep 10 '24 01:09 andrew-stclair

@vills @andrew-stclair just made a fix here: https://github.com/continuedev/continue/commit/07853463c8b2b1d9b2de850bd47e28454db98a03

This will be in the next pre-release!

sestinj avatar Sep 10 '24 03:09 sestinj