This package contains the Azure CosmosDB vector store integrations.
Learn more about how to use this package in the LangChain documentation:
npm install @langchain/azure-cosmosdb @langchain/core
This package, along with the main LangChain package, depends on @langchain/core.
If you are using this package with other LangChain packages, you should make sure that all of the packages depend on the same instance of @langchain/core.
You can do so by adding appropriate fields to your project's package.json like this:
{
"name": "your-project",
"version": "0.0.0",
"dependencies": {
"@langchain/core": "^0.3.0",
"@langchain/azure-cosmosdb": "^0.2.5"
},
"resolutions": {
"@langchain/core": "0.3.0"
},
"overrides": {
"@langchain/core": "0.3.0"
},
"pnpm": {
"overrides": {
"@langchain/core": "0.3.0"
}
}
}
The field you need depends on the package manager you're using, but we recommend adding a field for the common yarn, npm, and pnpm to maximize compatibility.
import { AzureCosmosDBNoSQLVectorStore } from "@langchain/azure-cosmosdb";
const store = await AzureCosmosDBNoSQLVectorStore.fromDocuments(
["Hello, World!"],
new OpenAIEmbeddings(),
{
databaseName: "langchain",
containerName: "documents",
}
);
const resultDocuments = await store.similaritySearch("hello");
console.log(resultDocuments[0].pageContent);Represents a Semantic Cache that uses CosmosDB NoSQL backend as the underlying storage system.
Azure Cosmos DB for NoSQL vector store. To use this, you should have both:
@azure/cosmos NPM package installedYou do not need to create
Class for storing chat message history with Cosmos DB NoSQL. It extends the BaseListChatMessageHistory class and provides methods to get, add, and clear messages.
Azure DocumentDB Chat Message History. Stores chat message history in an Azure DocumentDB collection.
Represents a Semantic Cache that uses Azure DocumentDB as the underlying storage system.
Azure DocumentDB vector store. To use this, you should have both:
mongodb NPM package installedYou do not need to create a d
Type for the input to the AzureCosmosDBNoSQLChatMessageHistory constructor.
Configuration options for the AzureCosmosDBNoSQLVectorStore constructor.
Full-text rank filter item for full-text ranking queries. Each item specifies a field to search and the search text.
Initialization options for the Azure CosmosDB for NoSQL database and container.
Note that if you provide multiple vector embeddings in the vectorEmbeddingPolicy, the first one will be used for creati
Configuration options for the AzureDocumentDBVectorStore constructor.
Azure Cosmos DB for NoSQL container creation options.
Azure Cosmos DB for NoSQL database creation options.
Azure Cosmos DB for NoSQL Delete Parameters.
Azure Cosmos DB for NoSQL filter type.
Azure Cosmos DB for NoSQL query filter.
Azure Cosmos DB for NoSQL search type.
Azure DocumentDB delete Parameters.
Azure DocumentDB Index Options.
Azure DocumentDB Similarity type.
Lightweight type for listing chat sessions.
Projection mapping for custom field selection. Maps field names to their aliases in the query results.