genkitx-weaviate
    Preparing search index...

    Function weaviateIndexer

    • Creates a Weaviate indexer action.

      This indexer stores documents and their embeddings in a Weaviate collection. It automatically creates the collection if it doesn't exist.

      Type Parameters

      • EmbedderCustomOptions extends ZodTypeAny

      Parameters

      • ai: Genkit

        Genkit instance

      • collectionName: string

        Name of the Weaviate collection to index into

      • client: WeaviateClientWrapper

        Weaviate client wrapper instance

      • embedder: EmbedderArgument<EmbedderCustomOptions>

        The embedder to use for generating embeddings

      • OptionalembedderOptions: TypeOf<EmbedderCustomOptions>

        Optional embedder options

      Returns IndexerAction<
          ZodOptional<
              ZodObject<
                  {
                      collectionConfig: ZodOptional<
                          ZodObject<
                              {
                                  description: ZodOptional<ZodString>;
                                  properties: ZodOptional<
                                      ZodArray<
                                          ZodObject<
                                              { dataType: ...; description: ...; name: ... },
                                              "strip",
                                              ZodTypeAny,
                                              { dataType: ...; description?: ...; name: ... },
                                              { dataType: ...; description?: ...; name: ... },
                                          >,
                                          "many",
                                      >,
                                  >;
                              },
                              "strip",
                              ZodTypeAny,
                              {
                                  description?: string;
                                  properties?: {
                                      dataType: string;
                                      description?: (...)
                                      | (...);
                                      name: string;
                                  }[];
                              },
                              {
                                  description?: string;
                                  properties?: {
                                      dataType: string;
                                      description?: (...)
                                      | (...);
                                      name: string;
                                  }[];
                              },
                          >,
                      >;
                      createCollectionIfMissing: ZodDefault<ZodOptional<ZodBoolean>>;
                  },
                  "strip",
                  ZodTypeAny,
                  {
                      collectionConfig?: {
                          description?: string;
                          properties?: { dataType: string; description?: string; name: string }[];
                      };
                      createCollectionIfMissing: boolean;
                  },
                  {
                      collectionConfig?: {
                          description?: string;
                          properties?: { dataType: string; description?: string; name: string }[];
                      };
                      createCollectionIfMissing?: boolean;
                  },
              >,
          >,
      >

      An indexer action that can be used with Genkit

      const indexer = weaviateIndexer(ai, 'Documents', client, textEmbedding004);
      await ai.index({
      indexer,
      documents: [
      { text: 'Hello world', metadata: { source: 'test' } }
      ]
      });