dewy icon indicating copy to clipboard operation
dewy copied to clipboard

chunks retrieval issue

Open hassanqaiser opened this issue 1 year ago • 5 comments

getting this error while fetching chunks,

const context = await dewy.kb.retrieveChunks({
        collection: process.env.DEWY_COLLECTION ?? "stablelm",
        query: query, 
        n: 10,
    });
ERROR:
⨯ TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11731:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)       
    at async globalThis.fetch (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:57569)
    at async sendRequest (webpack-internal:///(rsc)/./node_modules/dewy-ts/dist/core/request.js:172:12)
    at async eval (webpack-internal:///(rsc)/./node_modules/dewy-ts/dist/core/request.js:252:34) {
  cause: Error: unknown scheme
      at makeNetworkError (node:internal/deps/undici/undici:5002:35)
      at schemeFetch (node:internal/deps/undici/undici:9857:18)
      at node:internal/deps/undici/undici:9727:26
      at mainFetch (node:internal/deps/undici/undici:9746:11)
      at fetching (node:internal/deps/undici/undici:9694:7)
      at fetch (node:internal/deps/undici/undici:9558:20)
      at Object.fetch (node:internal/deps/undici/undici:11729:18)
      at fetch (node:internal/process/pre_execution:281:25)
      at R (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:35:342633)
      at M (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:61456)
      at C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:63607
      at C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\server\lib\trace\tracer.js:133:36
      at NoopContextManager.with (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:7062)
      at ContextAPI.with (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:518)
      at NoopTracer.startActiveSpan (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:18093)
      at ProxyTracer.startActiveSpan (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:18854)
      at C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\server\lib\trace\tracer.js:122:103
      at NoopContextManager.with (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:7062)
      at ContextAPI.with (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\@opentelemetry\api\index.js:1:518)
      at NextTracerImpl.trace (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\server\lib\trace\tracer.js:122:28)
      at globalThis.fetch (C:\Users\Administrator\Downloads\chat_dewy\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:57593)
      at sendRequest (webpack-internal:///(rsc)/./node_modules/dewy-ts/dist/core/request.js:172:18)
      at eval (webpack-internal:///(rsc)/./node_modules/dewy-ts/dist/core/request.js:252:64)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)     
}

hassanqaiser avatar Mar 25 '24 22:03 hassanqaiser

How dod you configure the Dewy client? The "unknown scheme" makes me think that it was configured to connect to localhost:port instead of http://localhost:port, perhaps. Any more information on the code you're using for the connection?

bjchambers avatar Mar 25 '24 22:03 bjchambers

yes configured as localhost:port, on configuring http://localhost:port, it gives error

cause: Error: connect ECONNREFUSED ::1:8000 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 8000 } }

hassanqaiser avatar Mar 25 '24 22:03 hassanqaiser

Also, in http://localhost:8000/admin/#/search.... I am unable to search and getting the following error,

    POST http://localhost:8000/api/chunks/retrieve 422 (Unprocessable Entity)

hassanqaiser avatar Mar 25 '24 22:03 hassanqaiser

the problem seems to be with the collection in the code below.... in the example you are using collection_id.... but in the code below its collection only.

const context = await dewy.kb.retrieveChunks({ collection: process.env.DEWY_COLLECTION ?? "stablelm", query: query, n: 10, });

hassanqaiser avatar Mar 25 '24 22:03 hassanqaiser

What versions of Dewy and Dewy Client are you using? Did you intsall from Docker or PIP, etc.? This is likely a version mismatch issue.

bjchambers avatar Mar 26 '24 16:03 bjchambers