/**
 * Redis Vector Store Node - Version 1.2
 * Discriminator: mode=retrieve
 */


interface Credentials {
  redis: CredentialReference;
}

/** Retrieve documents from vector store to be used as vector store with AI nodes */
export type LcVectorStoreRedisV12RetrieveParams = {
  /**
   * Exposes the store as an `ai_vectorStore` subnode for another node (e.g. `toolVectorStore`). Declare with `vectorStore({...})`. Required subnodes: `embedding`. For RAG with an AI Agent directly, prefer `mode: 'retrieve-as-tool'`.
   * <patterns>
   * <pattern title="retrieve mode — feed another node as a subnode (generic)">
   * // Substitute the type literal and provider-specific parameters — see the rest of this file.
   * const store = vectorStore({
   *   type: '@n8n/n8n-nodes-langchain.vectorStoreXxx',
   *   config: {
   *     name: 'Knowledge Base',
   *     parameters: { mode: 'retrieve' /* + provider-specific parameters *\/ },
   *     subnodes: { embedding: embeddingsOpenAi }
   *   }
   * });
   * 
   * const retrieverTool = tool({
   *   type: '@n8n/n8n-nodes-langchain.toolVectorStore',
   *   config: {
   *     name: 'KB Retriever',
   *     parameters: { description: 'Search the product knowledge base' },
   *     subnodes: { vectorStore: store, model: openAiModel }
   *   }
   * });
   * </pattern>
   * </patterns>
   */
  mode: 'retrieve';
  redisIndex?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
 * Whether or not to rerank results
 * @default false
 */
    useReranker?: boolean | Expression<boolean>;
/**
 * Options
 * @default {}
 */
    options?: {
    /** The comma-separated list of words by which to apply additional full-text metadata filtering
     */
    metadataFilter?: string | Expression<string>;
    /** Prefix for Redis keys storing the documents
     */
    keyPrefix?: string | Expression<string>;
    /** The hash key to be used to store the metadata of the document
     */
    metadataKey?: string | Expression<string>;
    /** The hash key to be used to store the content of the document
     */
    contentKey?: string | Expression<string>;
    /** The hash key to be used to store the embedding of the document
     */
    vectorKey?: string | Expression<string>;
  };
};

export interface LcVectorStoreRedisV12RetrieveSubnodeConfig {
  embedding: EmbeddingInstance | EmbeddingInstance[];
  /**
   * @displayOptions.show { useReranker: [true] }
   */
  reranker: RerankerInstance;
}

export type LcVectorStoreRedisV12RetrieveNode = {
  type: '@n8n/n8n-nodes-langchain.vectorStoreRedis';
  version: 1.2;
  credentials?: Credentials;
  config: NodeConfig<LcVectorStoreRedisV12RetrieveParams> & { subnodes: LcVectorStoreRedisV12RetrieveSubnodeConfig };
};