Generates embeddings for input text using a hosted model.
The model, input text, and model-specific parameters.
Embeddings in input order, with the model, vector type, and token usage.
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();
const embeddings = await pc.inference.embed({
model: 'multilingual-e5-large',
inputs: ['How do I return an order?'],
parameters: { inputType: 'query', truncate: 'END' },
});
console.log(embeddings.data);
Inference.getModel for supported model parameters.
Describes a hosted model and its supported parameters.
A model name returned by Inference.listModels.
The model description, capabilities, and supported parameters.
Errors.PineconeArgumentError if modelName is empty.
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();
const model = await pc.inference.getModel('multilingual-e5-large');
console.log(model.supportedParameters);
Inference.listModels to discover available models.
Lists hosted models and their supported capabilities.
Optionaloptions: ListModelsOptions
Optional model and vector type filters; omit to list all models.
Model descriptions and supported parameters in models.
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();
const result = await pc.inference.listModels({ type: 'embed', vectorType: 'dense' });
console.log(result.models);
Inference.getModel for details of one model.
Ranks documents by relevance to a query.
The model, query, documents, and optional result and ranking settings.
Results in descending relevance order, with original document indexes and relevance scores.
Errors.PineconeArgumentError if the model, query, documents, or required document text are missing.
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();
const result = await pc.inference.rerank({
model: 'bge-reranker-v2-m3',
query: 'How do I return an order?',
documents: ['Start a return from your order history.', 'Orders ship on weekdays.'],
});
console.log(result.data);
Inference.getModel for supported model parameters.
Inference generates embeddings and reranks documents using hosted models.
Access it through
pc.inference; do not construct it directly. Unlike index search, inference works on text you supply without querying an index.Example