ChrisMC
Convex Community5mo ago
1 reply
ChrisM

RAG Filter name location is not valid

Hello,
In the Document of the RAG component it is statet that not every filter needs to be present when creating a RAG entry.
However I came across this in my add where i need to either add no filter values or all of them as undefined or with value.

When adding just one filterValues i get :
Filter name location is not valid (one of spotId, location, category)

This is my RAG setup:

import { RAG } from '@convex-dev/rag';
import { components } from '../_generated/api';
import { textEmbedding } from '../models';

type FilterTypes = {
  location?: {
    latitude: number;
    longitude: number;
  } | undefined;
  spotId?: string | undefined;
  category?: 'spot' | undefined;
};

export type Filter =
  | { name: 'location'; value: { latitude: number; longitude: number } | undefined }
  | { name: 'spotId'; value: string | undefined }
  | { name: 'category'; value: 'spot' | undefined };

export const rag = new RAG<FilterTypes>(components.rag, {
  textEmbeddingModel: textEmbedding,
  embeddingDimension: 1536,
  filterNames: ['spotId', 'location', 'category'],
});


I then cannot do something like this:

    const filterValues: Filter[] = [];
    filterValues.push({ name: 'spotId', value: args.spotId });

    await rag.add(ctx, {
      namespace: 'global',
      title: args.title,
      key: args.title,
      filterValues,
      text: args.text,
    });


Leaving filterValues out works though.

Looking forward to a resolution to this!

Best regards
Chris
Was this page helpful?