#Rag Search Return Value Validation Error

1 messages · Page 1 of 1 (latest)

wintry niche
#

Error
Uncaught Error: ReturnsValidationError: Value does not match validator.
Path: .results[0].score
Value: null
Validator: v.float64()

at async search [as search] (../../../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_@standard-schema+spe_bxspyhahbywjwdmmps3dsnvu2y/node_modules/@convex-dev/rag/src/client/index.ts:410:8)
at async handler (../../convex/components/rag.ts:427:3)

I got this error from Convex when I try use search method via Rag instance

halcyon tundraBOT
#

Hi @wintry niche. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the error you're encountering, the RAG search is returning a null value for the score field in one of the search results, but the validator expects a v.float64() (a number).

This error indicates that the RAG component is returning search results where at least one result has a null score instead of a numeric value. This could happen in a few scenarios:

  1. Vector search without embeddings: If the search is being performed without proper embeddings being generated or stored
  2. Data inconsistency: There might be some entries in your RAG namespace that don't have proper vector embeddings
  3. Component version issue: This could be a bug in the specific version of the RAG component you're using

Potential Solutions

1. Check your RAG setup

Ensure your RAG instance is properly configured with an embedding model:

const rag = new RAG(components.rag, {
  textEmbeddingModel: openai.embedding("text-embedding-3-small"),
  embeddingDimension: 1536, // Must match your embedding model
});

2. Verify your search parameters

When calling search, make sure you're providing valid parameters as shown in the RAG component documentation:

const { results, text, entries, usage } = await rag.search(ctx, {
  namespace: "global",
  query: args.query,
  limit: 10,
  vectorScoreThreshold: 0.5, // Optional: filter by minimum score
});

3. Check for data migration issues

If you recently migrated data or changed your RAG configuration, some entries might not have proper embeddings. The RAG component supports graceful migrations, so you may need to re-add or migrate your content.

#

4. Update the component

Consider updating to the latest version of @convex-dev/rag as this might be a bug that has been fixed in newer versions:

npm install @convex-dev/rag@latest

If the issue persists after trying these solutions, you may want to file a bug report as mentioned in the RAG component documentation at their GitHub issues page.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: