Skip to content

Commit 08d1fe1

Browse files
TheovanKraaymdrxy
andauthored
add Cosmos DB Chat Message History to Microsoft doc (#1306)
## Overview Adding Cosmos DB Chat Message History to Microsoft doc ## Type of change Update existing documentation ## Related issues/PRs N/A ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [ ] I have updated navigation in `src/docs.json` if needed - I have gotten approval from the relevant reviewers - (Internal team members only / optional) I have created a preview deployment using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes I am a Cosmos DB PM at Microsoft and noticed this was missing. Co-authored-by: Mason Daugherty <mason@langchain.dev>
1 parent 20defbd commit 08d1fe1

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

src/oss/python/integrations/providers/microsoft.mdx

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,37 @@ See a [usage example](/oss/integrations/document_loaders/url/#playwright-url-loa
365365
from langchain_community.document_loaders.onenote import OneNoteLoader
366366
```
367367

368+
## Memory
369+
370+
### Azure Cosmos DB Chat Message History
371+
372+
>[Azure Cosmos DB](https://learn.microsoft.com/azure/cosmos-db/) provides chat message history storage for conversational AI applications, enabling you to persist and retrieve conversation history with low latency and high availability.
373+
374+
<CodeGroup>
375+
```bash pip
376+
pip install langchain-azure-ai
377+
```
378+
379+
```bash uv
380+
uv add langchain-azure-ai
381+
```
382+
</CodeGroup>
383+
384+
Configure your Azure Cosmos DB connection:
385+
386+
```python
387+
from langchain_azure_ai.chat_message_histories import CosmosDBChatMessageHistory
388+
389+
history = CosmosDBChatMessageHistory(
390+
cosmos_endpoint="https://<your-account>.documents.azure.com:443/",
391+
cosmos_database="<your-database>",
392+
cosmos_container="<your-container>",
393+
session_id="<session-id>",
394+
user_id="<user-id>",
395+
credential="<your-credential>" # or use connection_string
396+
)
397+
```
398+
368399
## Vector Stores
369400

370401
### Azure Cosmos DB
@@ -382,15 +413,15 @@ Below are two available Azure Cosmos DB APIs that can provide vector store funct
382413

383414
See [detailed configuration instructions](/oss/integrations/vectorstores/azure_cosmos_db_mongo_vcore).
384415

385-
We need to install `pymongo` python package.
416+
We need to install `langchain-azure-ai` and `pymongo` python packages.
386417

387418
<CodeGroup>
388419
```bash pip
389-
pip install pymongo
420+
pip install langchain-azure-ai pymongo
390421
```
391422

392423
```bash uv
393-
uv add pymongo
424+
uv add langchain-azure-ai pymongo
394425
```
395426
</CodeGroup>
396427

@@ -405,7 +436,7 @@ With Cosmos DB for MongoDB vCore, developers can enjoy the benefits of native Az
405436
See a [usage example](/oss/integrations/vectorstores/azure_cosmos_db_mongo_vcore).
406437

407438
```python
408-
from langchain_community.vectorstores import AzureCosmosDBVectorSearch
439+
from langchain_azure_ai.vectorstores import AzureCosmosDBMongoVCoreVectorSearch
409440
```
410441

411442
#### Azure Cosmos DB NoSQL
@@ -421,15 +452,15 @@ efficiency of vector-based operations.
421452

422453
See [detail configuration instructions](/oss/integrations/vectorstores/azure_cosmos_db_no_sql).
423454

424-
We need to install `azure-cosmos` python package.
455+
We need to install `langchain-azure-ai` and `azure-cosmos` python packages.
425456

426457
<CodeGroup>
427458
```bash pip
428-
pip install azure-cosmos
459+
pip install langchain-azure-ai azure-cosmos
429460
```
430461

431462
```bash uv
432-
uv add azure-cosmos
463+
uv add langchain-azure-ai azure-cosmos
433464
```
434465
</CodeGroup>
435466

@@ -443,7 +474,7 @@ in every Azure region and can automatically replicate data closer to users. It h
443474
See a [usage example](/oss/integrations/vectorstores/azure_cosmos_db_no_sql).
444475

445476
```python
446-
from langchain_community.vectorstores import AzureCosmosDBNoSQLVectorSearch
477+
from langchain_azure_ai.vectorstores import AzureCosmosDBNoSqlVectorSearch
447478
```
448479

449480
### Azure Database for PostgreSQL

0 commit comments

Comments
 (0)