weaviate / Verba

Retrieval Augmented Generation (RAG) chatbot powered by Weaviate
BSD 3-Clause "New" or "Revised" License
4.84k stars 499 forks source link

Max retries exceeded with url: /api/embeddings #197

Open zer0u1tra opened 1 month ago

zer0u1tra commented 1 month ago
⚠ 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: 'jane@doe.com,john@doe.com'
      # AUTHORIZATION_ADMINLIST_ENABLED: 'true'
      # AUTHORIZATION_ADMINLIST_USERS: 'john@doe.com'
      # AUTHORIZATION_ADMINLIST_READONLY_USERS: 'jane@doe.com'

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 commented 1 month ago

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'))
mmike87 commented 1 month ago

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

thomashacker commented 1 month ago

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

mmike87 commented 1 month ago

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.

zer0u1tra commented 1 month ago

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?

mmike87 commented 1 month ago

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.

zer0u1tra commented 1 month ago

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.

sitaram70 commented 1 month ago

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.

zer0u1tra commented 3 weeks ago

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.

edishu commented 3 weeks ago

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
ozopled commented 1 week ago

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/

thomashacker commented 6 days ago

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