Verba icon indicating copy to clipboard operation
Verba copied to clipboard

Max retries exceeded with url: /api/embeddings

Open zer0u1tra opened this issue 1 year ago • 12 comments

⚠ Query failed: HTTPConnectionPool(host='localhost', port=11434): Max
retries exceeded with url: /api/embeddings (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x70efe5ed00d0>: Failed to establish a new connection: [Errno 111] Connection
refused'))

We are getting this error when using the following docker-compose YAML:

---
version: '3.4'

services:
  verba:
    build:
      context: ./
      dockerfile: Dockerfile
    ports:
      - 8000:8000
    environment:
      - WEAVIATE_URL_VERBA=http://weaviate:8080
      - OPENAI_API_KEY=$OPENAI_API_KEY
      - COHERE_API_KEY=$COHERE_API_KEY
      - OLLAMA_URL=$OLLAMA_URL
      - OLLAMA_MODEL=$OLLAMA_MODEL
      - UNSTRUCTURED_API_KEY=$UNSTRUCTURED_API_KEY
      - UNSTRUCTURED_API_URL=$UNSTRUCTURED_API_URL
      - GITHUB_TOKEN=$GITHUB_TOKEN
      ## IF YOU WANT AUTHENTICATION, UNCOMENT BELLOW 
      ## AND ADD WEAVIATE SERVICE
      #- WEAVIATE_API_KEY_VERBA=adminkey

    volumes:
      - ./data:/data/
    depends_on:
      weaviate:
        condition: service_healthy
    healthcheck:
      test: wget --no-verbose --tries=3 --spider http://localhost:8000 || exit 1
      interval: 5s
      timeout: 10s
      retries: 5
      start_period: 10s

  weaviate:
    command:
      - --host
      - 0.0.0.0
      - --port
      - '8080'
      - --scheme
      - http
    image: semitechnologies/weaviate:1.24.2
    ports:
      - 8080:8080
      - 3000:8080
    volumes:
      - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    healthcheck:
      test: wget --no-verbose --tries=3 --spider http://localhost:8080/v1/.well-known/ready || exit 1
      interval: 5s
      timeout: 10s
      retries: 5
      start_period: 10s
    environment:
      OPENAI_APIKEY: $OPENAI_API_KEY
      COHERE_APIKEY: $COHERE_API_KEY
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      ENABLE_MODULES: 'text2vec-openai, generative-openai, qna-openai, text2vec-cohere'
      CLUSTER_HOSTNAME: 'node1'
      #######IF YOU WANT AUTHENTICATION UNCOMMENT BELOW########
      # AUTHENTICATION_APIKEY_ENABLED: 'true'
      # AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'readonlykey,adminkey'
      # AUTHENTICATION_APIKEY_USERS: '[email protected],[email protected]'
      # AUTHORIZATION_ADMINLIST_ENABLED: 'true'
      # AUTHORIZATION_ADMINLIST_USERS: '[email protected]'
      # AUTHORIZATION_ADMINLIST_READONLY_USERS: '[email protected]'

volumes:
  weaviate_data: {}
...

And the following .env:

OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama3

Has anyone else been getting this / have a workaround?

zer0u1tra avatar May 23 '24 18:05 zer0u1tra

Here is the Verba output when trying to embed a .pdf document:

(INFO) Importing...
(INFO) Importing 1 files with BasicReader
(INFO) Importing Lanier.pdf
(SUCCESS) Loaded 1 documents in 0.46s
(INFO) Starting Chunking with TokenChunker
(SUCCESS) Chunking completed with 232 chunks in 0.03s
(INFO) Starting Embedding with OllamaEmbedder
(ERROR) HTTPConnectionPool(host='localhost', port=11434): Max retries exceeded with url: /api/embeddings (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x72f4537f4310>: Failed to establish a new connection: [Errno 111] Connection refused'))

zer0u1tra avatar May 23 '24 19:05 zer0u1tra

I am having the same issue. I am not sure what the issue is ... but I have several hours into this with no progress.

mmike87 avatar May 27 '24 02:05 mmike87

Your Docker Container can't access localhost outside of it's container, you need to specify the OLLAMA_URL to http://host.docker.internal:11434

thomashacker avatar May 27 '24 11:05 thomashacker

I am not using a docker container. I am running Ollama native Windows, and Verba in WSL. Maybe that is an issue? I will check if I can hit Ollama from the WSL window.

mmike87 avatar May 27 '24 12:05 mmike87

Your Docker Container can't access localhost outside of it's container, you need to specify the OLLAMA_URL to http://host.docker.internal:11434

I started with that and got the same error, just coming from host.docker.internal. What I posted is what I tried after the fact.

Anyone else have any ideas?

zer0u1tra avatar May 27 '24 20:05 zer0u1tra

I think my situation with WSL is similar - it's running behind Hyper-V and by default, port forwarding is not enabled from WSL -> Windows but it IS the other way. However, even after enabling port forwarding, it still cannot connect.

mmike87 avatar May 27 '24 21:05 mmike87

I think my situation with WSL is similar - it's running behind Hyper-V and by default, port forwarding is not enabled from WSL -> Windows but it IS the other way. However, even after enabling port forwarding, it still cannot connect.

Yeah I have been running it via the docker-compose. It works via the pip install method, but I'd like to also use the weaviate integration that already comes with the docker setup.

zer0u1tra avatar May 27 '24 21:05 zer0u1tra

Hi Try hardcoding these two variables in the docker file. OLLAMA_URL=http://localhost:11434 OLLAMA_MODEL=llama3 And also verify variables in the admin screen in UI before importing.

sitaram70 avatar May 28 '24 14:05 sitaram70

Hi Try hardcoding these two variables in the docker file. OLLAMA_URL=http://localhost:11434 OLLAMA_MODEL=llama3 And also verify variables in the admin screen in UI before importing.

This also does not work.

zer0u1tra avatar Jun 06 '24 16:06 zer0u1tra

I'm also having this issue. I'm using docker to spin up container: docker compose --env-file .env up -d

and my .env is:

OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama3

edishu avatar Jun 08 '24 00:06 edishu

After a couple of hours tinkering, I found a solution for those running Ollama and Verba locally on a Windows machine. You can see it here https://www.robotstud.io/how-to-run-verba-and-ollama-locally-on-your-windows-machine/

ozopled avatar Jun 26 '24 07:06 ozopled

This is a great resource, let me know if this helps to fix the issue

thomashacker avatar Jun 27 '24 13:06 thomashacker