import { type EmbeddingProvider, type VectorDocument, type VectorSearchOptions, type VectorSearchResult, type VectorStore } from '../hallucination/retrieval.js'; /** Options for the Pinecone store. */ export interface PineconeVectorStoreOptions { /** The index's host, as the Pinecone console shows it, such as `https://docs-abc123.svc.aped-4627-b74a.pinecone.io`. */ host: string; /** The Pinecone API key. */ apiKey: string; /** The namespace chunks are kept in. Defaults to the index's default namespace. */ namespace?: string; /** Width of every vector. Must match the index and the embedding function. */ dimensions: number; /** Embeds chunks that arrive without a vector, and search queries. Defaults to hashed term vectors. */ embed?: EmbeddingProvider; /** The `X-Pinecone-API-Version` header. Defaults to `2025-04`. */ apiVersion?: string; /** Vectors sent per upsert request. Defaults to 100, well under Pinecone's request limits. */ batchSize?: number; /** Replaces the global `fetch`, for a proxy, retries, or tests. */ fetch?: typeof globalThis.fetch; /** Headers added to every request. */ headers?: Record; /** Aborts a request that takes longer, in milliseconds. Defaults to 30 seconds. */ timeoutMs?: number; } /** Raised when Pinecone answers with an error. */ export declare class PineconeError extends Error { /** The HTTP status Pinecone answered with. */ readonly status: number; /** Pinecone's response body, as text. */ readonly body?: string | undefined; constructor(message: string, /** The HTTP status Pinecone answered with. */ status: number, /** Pinecone's response body, as text. */ body?: string | undefined); } /** * Retrieval chunks in a Pinecone index, through its data-plane REST API. * * No Pinecone client is a dependency. `PineconeVectorStore.create()` creates the index, with the cosine * metric and the store's width, or give the store the host of one made so; chunk ids are Pinecone ids * as they are. Each chunk's text, source, and metadata travel in the * vector's metadata, and its top-level string, number, and boolean metadata fields are copied under * `meta_` names, which is what a search filter matches on. */ export declare class PineconeVectorStore implements VectorStore { private readonly options; private readonly base; private readonly embed; constructor(options: PineconeVectorStoreOptions); /** * A store over the named index, created first, as `ensurePineconeIndex()` does, when it does not exist. * * ```ts * const store = await PineconeVectorStore.create({ apiKey, name: 'docs', dimensions: 1536, embed }); * ``` */ static create(options: PineconeCreateOptions): Promise; /** Adds chunks, or replaces those whose id exists, embedding those without a vector in one batch. */ add(documents: VectorDocument[]): Promise; /** The chunks most similar to a query, best first. */ search(query: string, options?: VectorSearchOptions): Promise; /** The chunks most similar to a vector, best first. */ searchVector(vector: number[], options?: VectorSearchOptions): Promise; /** Removes chunks by id. */ delete(ids: readonly string[]): Promise; private namespace; private request; } /** Options for `ensurePineconeIndex()`: the index, and how to reach Pinecone's control plane. */ export interface PineconeIndexOptions { /** The Pinecone API key. */ apiKey: string; /** The index's name: 1 to 45 lowercase letters, digits, and hyphens, beginning and ending with a letter or digit. */ name: string; /** Width of every vector. An index that exists must have it. */ dimensions: number; /** Where a new serverless index runs. Defaults to `aws`. */ cloud?: 'aws' | 'gcp' | 'azure'; /** The cloud's region for a new index. Defaults to `us-east-1`. */ region?: string; /** Protects a new index from deletion. Defaults to false. */ deletionProtection?: boolean; /** Tags on a new index. */ tags?: Readonly>; /** How long to wait for the index to be ready, in milliseconds. Defaults to 5 minutes. */ readyTimeoutMs?: number; /** How often to ask whether it is ready, in milliseconds. Defaults to 2 seconds. */ pollMs?: number; /** The control plane's URL. Defaults to `https://api.pinecone.io`. */ controlUrl?: string; /** The `X-Pinecone-API-Version` header. Defaults to `2025-04`. */ apiVersion?: string; /** Replaces the global `fetch`. */ fetch?: typeof globalThis.fetch; /** Headers added to every request. */ headers?: Record; /** Aborts a request that takes longer, in milliseconds. Defaults to 30 seconds. */ timeoutMs?: number; } /** An index ready to take vectors. */ export interface PineconeIndex { /** Its name. */ name: string; /** Its data-plane host, which `PineconeVectorStore` takes. */ host: string; /** Whether this call created it, rather than finding it. */ created: boolean; } /** What `PineconeVectorStore.create()` takes: the store's options, its host aside, and the index's. */ export type PineconeCreateOptions = Omit & Pick; /** * Creates a serverless index with the cosine metric and the store's width, unless one of that name * exists, and waits until it is ready. An index that exists is used when its width and metric are the * store's, and refused otherwise; one created by another process at the same moment is used as found. * * ```ts * const { host } = await ensurePineconeIndex({ apiKey, name: 'docs', dimensions: 1536, region: 'eu-west-1' }); * ``` */ export declare function ensurePineconeIndex(options: PineconeIndexOptions): Promise;