/**
 * Qdrant Vector Store Node - Version 1
 * Discriminator: mode=retrieve-as-tool
 */


interface Credentials {
  qdrantApi: CredentialReference;
}

/** Retrieve documents from vector store to be used as tool with AI nodes */
export type LcVectorStoreQdrantV1RetrieveAsToolParams = {
  /**
   * Canonical RAG mode — declare with the `tool({...})` factory (NOT `vectorStore`) and plug into an AI Agent's `subnodes.tools`. Required subnodes: `embedding`. Set `toolDescription` so the agent knows when to call it.
   * <patterns>
   * <pattern title="retrieve-as-tool mode — RAG via AI Agent (generic, works for any vectorStore* node)">
   * // Substitute the type literal and provider-specific parameters — see the rest of this file
   * // for the exact shape (e.g. pineconeIndex, qdrantCollection, supabaseTableName).
   * const knowledgeBase = tool({
   *   type: '@n8n/n8n-nodes-langchain.vectorStoreXxx',
   *   config: {
   *     name: 'Knowledge Base',
   *     parameters: {
   *       mode: 'retrieve-as-tool',
   *       toolDescription: 'Search the product knowledge base',
   *       // ...provider-specific parameters
   *     },
   *     subnodes: { embedding: embeddingsOpenAi }
   *   }
   * });
   * 
   * const agent = node({
   *   type: '@n8n/n8n-nodes-langchain.agent',
   *   config: {
   *     name: 'Support Agent',
   *     parameters: { promptType: 'define', text: expr('{{ $json.question }}') },
   *     subnodes: { model: openAiModel, tools: [knowledgeBase] }
   *   }
   * });
   * </pattern>
   * </patterns>
   */
  mode: 'retrieve-as-tool';
/**
 * Name of the vector store
 */
    toolName: string | Expression<string>;
/**
 * Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often
 */
    toolDescription: string | Expression<string>;
  qdrantCollection?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
 * Number of top results to fetch from vector store
 * @default 4
 */
    topK?: number | Expression<number>;
/**
 * Whether or not to include document metadata
 * @default true
 */
    includeDocumentMetadata?: boolean | Expression<boolean>;
/**
 * Whether or not to rerank results
 * @default false
 */
    useReranker?: boolean | Expression<boolean>;
/**
 * Options
 * @default {}
 */
    options?: {
    /** Filter pageContent or metadata using this &lt;a href="https://qdrant.tech/documentation/concepts/filtering/" target="_blank"&gt;filtering syntax&lt;/a&gt;
     */
    searchFilterJson?: IDataObject | string | Expression<string>;
    /** The key to use for the content payload in Qdrant. Default is "content".
     * @default content
     */
    contentPayloadKey?: string | Expression<string>;
    /** The key to use for the metadata payload in Qdrant. Default is "metadata".
     * @default metadata
     */
    metadataPayloadKey?: string | Expression<string>;
  };
};

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

export type LcVectorStoreQdrantV1RetrieveAsToolNode = {
  type: '@n8n/n8n-nodes-langchain.vectorStoreQdrant';
  version: 1;
  credentials?: Credentials;
  config: NodeConfig<LcVectorStoreQdrantV1RetrieveAsToolParams> & { subnodes: LcVectorStoreQdrantV1RetrieveAsToolSubnodeConfig };
};