run-llama / create-llama

The easiest way to get started with LlamaIndex
MIT License
1.02k stars 128 forks source link

Unable to connect to ChromaDB running in Docker #301

Open sachinkumaranumula opened 1 month ago

sachinkumaranumula commented 1 month ago

I am running ChromaDB in a docker container which is reachable under http://localhost:8000 and I created shell app using npx create-llama@latest which gave me a nextJs app with "llamaindex": "0.5.24" dependency. I used a notebook to verify ChromaDB is reachable and I am able to create collection and add documents to it using the python client. Can you please shed where the issue might be?

Start creating embeddings...
{project}/node_modules/chromadb/dist/cjs/chromadb.cjs:2844
      throw new Error(newCollection.error);
            ^
Error: TypeError: fetch failed
    at ChromaClient.getOrCreateCollection ({project}/node_modules/chromadb/dist/cjs/chromadb.cjs:2844:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async ChromaVectorStore.getCollection ({project}/node_modules/llamaindex/dist/cjs/storage/vectorStore/ChromaVectorStore.js:34:26)
    at async ChromaVectorStore.add ({project}/node_modules/llamaindex/dist/cjs/storage/vectorStore/ChromaVectorStore.js:55:28)
    at async addNodesToVectorStores ({project}/node_modules/llamaindex/dist/cjs/ingestion/IngestionPipeline.js:113:28)
    at async VectorStoreIndex.insertNodes ({project}/node_modules/llamaindex/dist/cjs/indices/vectorStore/index.js:574:9)
    at async VectorStoreIndex.buildIndexFromNodes ({project}/node_modules/llamaindex/dist/cjs/indices/vectorStore/index.js:488:9)
    at async VectorStoreIndex.init ({project}/node_modules/llamaindex/dist/cjs/indices/vectorStore/index.js:438:13)
    at async VectorStoreIndex.fromDocuments ({project}/node_modules/llamaindex/dist/cjs/indices/vectorStore/index.js:516:16)
    at async loadAndIndex ({project}/app/api/chat/engine/generate.ts:26:3)
    at async <anonymous> ({project}/app/api/chat/engine/generate.ts:35:3)

Node.js v22.7.0

Here is Docker container logs for chromadb/chroma:latest

2024-09-18 11:58:28 Starting 'uvicorn chromadb.app:app' with args: --workers 1 --host 0.0.0.0 --port 8000 --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30
2024-09-18 11:58:29 WARNING:  [18-09-2024 16:58:29] chroma_server_nofile is set to 65536, but this is less than current soft limit of 1048576. chroma_server_nofile will not be set.
2024-09-18 11:58:29 INFO:     [18-09-2024 16:58:29] Anonymized telemetry enabled. See                     https://docs.trychroma.com/telemetry for more information.
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component System
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component OpenTelemetryClient
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component SqliteDB
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component QuotaEnforcer
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component Posthog
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component LocalSegmentManager
2024-09-18 11:58:29 DEBUG:    [18-09-2024 16:58:29] Starting component SegmentAPI
2024-09-18 11:58:29 INFO:     [18-09-2024 16:58:29] Started server process [1]
2024-09-18 11:58:29 INFO:     [18-09-2024 16:58:29] Waiting for application startup.
2024-09-18 11:58:29 INFO:     [18-09-2024 16:58:29] Application startup complete.
2024-09-18 11:58:29 INFO:     [18-09-2024 16:58:29] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2024-09-18 12:00:21 INFO:     [18-09-2024 17:00:21] 192.168.65.1:52795 - "GET / HTTP/1.1" 404
2024-09-18 12:00:21 INFO:     [18-09-2024 17:00:21] 192.168.65.1:52795 - "GET /favicon.ico HTTP/1.1" 404
2024-09-18 12:42:30 INFO:     [18-09-2024 17:42:30] 192.168.65.1:17491 - "GET / HTTP/1.1" 404
2024-09-18 12:42:45 INFO:     [18-09-2024 17:42:45] 192.168.65.1:50933 - "GET /api/v1/collections?tenant=default_tenant&database=default_database HTTP/1.1" 200
marcusschiesser commented 1 month ago

What are your settings in .env for the CHROMA_* variables?