langchain/docs
fatmelon d1e0ec7b55
community: VectorStores: Azure Cosmos DB Mongo vCore with DiskANN (#27329)
# Description
Add a new vector index type `diskann` to Azure Cosmos DB Mongo vCore
vector store. Paper of DiskANN can be found here [DiskANN: Fast Accurate
Billion-point Nearest Neighbor Search on a Single
Node](https://proceedings.neurips.cc/paper_files/paper/2019/file/09853c7fb1d3f8ee67a61b6bf4a7f8e6-Paper.pdf).

## Sample Usage
```python
from pymongo import MongoClient

# INDEX_NAME = "izzy-test-index-2"
# NAMESPACE = "izzy_test_db.izzy_test_collection"
# DB_NAME, COLLECTION_NAME = NAMESPACE.split(".")

client: MongoClient = MongoClient(CONNECTION_STRING)
collection = client[DB_NAME][COLLECTION_NAME]

model_deployment = os.getenv(
    "OPENAI_EMBEDDINGS_DEPLOYMENT", "smart-agent-embedding-ada"
)
model_name = os.getenv("OPENAI_EMBEDDINGS_MODEL_NAME", "text-embedding-ada-002")

vectorstore = AzureCosmosDBVectorSearch.from_documents(
    docs,
    openai_embeddings,
    collection=collection,
    index_name=INDEX_NAME,
)

# Read more about these variables in detail here. https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/vector-search
maxDegree = 40
dimensions = 1536
similarity_algorithm = CosmosDBSimilarityType.COS
kind = CosmosDBVectorSearchType.VECTOR_DISKANN
lBuild = 20

vectorstore.create_index(
            dimensions=dimensions,
            similarity=similarity_algorithm,
            kind=kind ,
            max_degree=maxDegree,
            l_build=lBuild,
        )
```

## Dependencies
No additional dependencies were added

---------

Co-authored-by: Yang Qiao (from Dev Box) <yangqiao@microsoft.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-12-12 01:54:04 +00:00
..
api_reference docs: format (#28593) 2024-12-06 15:08:25 -08:00
cassettes docs: update tutorials (#28219) 2024-11-26 10:43:12 -05:00
data docs: 👥 Update LangChain people data (#27022) 2024-10-08 17:09:07 +00:00
docs community: VectorStores: Azure Cosmos DB Mongo vCore with DiskANN (#27329) 2024-12-12 01:54:04 +00:00
scripts docs: provider list from packages.yml (#28677) 2024-12-12 00:12:30 +00:00
src docs: Adding Docs for new SQLServer Vector store package (#28173) 2024-12-10 03:00:10 +00:00
static community: update Memgraph integration (#27017) 2024-12-10 10:57:21 -05:00
.gitignore infra: cleanup docs build (#21134) 2024-05-01 17:34:05 -07:00
.yarnrc.yml docs[minor]: Add thumbs up/down to all docs pages (#18526) 2024-03-04 15:14:28 -08:00
babel.config.js
docusaurus.config.js docs: throw on broken anchors (#27773) 2024-11-13 14:29:27 -05:00
ignore-step.sh docs: ignore case production fork master (#27971) 2024-11-07 13:55:21 -08:00
Makefile docs: raw loader codeblock (#28548) 2024-12-06 09:26:34 -08:00
package.json docs: raw loader codeblock (#28548) 2024-12-06 09:26:34 -08:00
README.md docs: reorganize contributing docs (#27649) 2024-10-25 22:41:54 +00:00
sidebars.js docs: reorg sidebar (#27978) 2024-11-15 14:28:18 -08:00
vercel_requirements.txt docs: provider list from packages.yml (#28677) 2024-12-12 00:12:30 +00:00
vercel.json langchain-weaviate: Remove outdated docs (#28058) 2024-12-10 05:00:07 +00:00
yarn.lock docs: raw loader codeblock (#28548) 2024-12-06 09:26:34 -08:00

LangChain Documentation

For more information on contributing to our documentation, see the Documentation Contributing Guide