Use vector search in Azure Cosmos DB for MongoDB vCore to seamlessly integrate your AI-based applications with your data that's stored in Azure Cosmos DB.This notebook shows you how to leverage the Vector Search capabilities within Azure Cosmos DB for Mongo vCore to store documents in collections, create indicies and perform vector search queries using approximate nearest neighbor algorithms such as COS (cosine distance), L2 (Euclidean distance), and IP (inner product) to locate documents close to the query vectors. Azure Cosmos DB for MongoDB vCore provides developers with a fully managed MongoDB-compatible database service for building modern applications with a familiar architecture.With Cosmos DB for MongoDB vCore, developers can enjoy the benefits of native Azure integrations, low total cost of ownership (TCO), and the familiar vCore architecture when migrating existing applications or building new ones.Sign Up for free to get started today.pip install pymongo    Requirement already satisfied: pymongo in /Users/iekpo/Langchain/langchain-python/.venv/lib/python3.10/site-packages (4.5.0)    Requirement already satisfied: dnspython<3.0.0,>=1.16.0 in /Users/iekpo/Langchain/langchain-python/.venv/lib/python3.10/site-packages (from pymongo) (2.4.2)import osimport getpassCONNECTION_STRING = "AZURE COSMOS DB MONGO vCORE connection string"INDEX_NAME = "izzy-test-index"NAMESPACE = "izzy_test_db.izzy_test_collection"DB_NAME, COLLECTION_NAME = NAMESPACE.split(".")We want to use OpenAIEmbeddings so we need to set up our Azure OpenAI API Key alongside other environment variables. # Set up the OpenAI Environment Variablesos.environ["OPENAI_API_TYPE"] = "azure"os.environ["OPENAI_API_VERSION"] = "2023-05-15"os.environ["OPENAI_API_BASE"] = "YOUR_OPEN_AI_ENDPOINT" # https://example.openai.azure.com/os.environ["OPENAI_API_KEY"] = "YOUR_OPEN_AI_KEY"os.environ["OPENAI_EMBEDDINGS_DEPLOYMENT"] = "smart-agent-embedding-ada" # the deployment name for the embedding
Azure Cosmos DB for MongoDB vCore makes it easy to create a database with full native MongoDB support.
Azure Cosmos DB for MongoDB vCore makes it easy to create a database with full native MongoDB support. ->: Use vector search in Azure Cosmos DB for MongoDB vCore to seamlessly integrate your AI-based applications with your data that's stored in Azure Cosmos DB.This notebook shows you how to leverage the Vector Search capabilities within Azure Cosmos DB for Mongo vCore to store documents in collections, create indicies and perform vector search queries using approximate nearest neighbor algorithms such as COS (cosine distance), L2 (Euclidean distance), and IP (inner product) to locate documents close to the query vectors. Azure Cosmos DB for MongoDB vCore provides developers with a fully managed MongoDB-compatible database service for building modern applications with a familiar architecture.With Cosmos DB for MongoDB vCore, developers can enjoy the benefits of native Azure integrations, low total cost of ownership (TCO), and the familiar vCore architecture when migrating existing applications or building new ones.Sign Up for free to get started today.pip install pymongo    Requirement already satisfied: pymongo in /Users/iekpo/Langchain/langchain-python/.venv/lib/python3.10/site-packages (4.5.0)    Requirement already satisfied: dnspython<3.0.0,>=1.16.0 in /Users/iekpo/Langchain/langchain-python/.venv/lib/python3.10/site-packages (from pymongo) (2.4.2)import osimport getpassCONNECTION_STRING = "AZURE COSMOS DB MONGO vCORE connection string"INDEX_NAME = "izzy-test-index"NAMESPACE = "izzy_test_db.izzy_test_collection"DB_NAME, COLLECTION_NAME = NAMESPACE.split(".")We want to use OpenAIEmbeddings so we need to set up our Azure OpenAI API Key alongside other environment variables. # Set up the OpenAI Environment Variablesos.environ["OPENAI_API_TYPE"] = "azure"os.environ["OPENAI_API_VERSION"] = "2023-05-15"os.environ["OPENAI_API_BASE"] = "YOUR_OPEN_AI_ENDPOINT" # https://example.openai.azure.com/os.environ["OPENAI_API_KEY"] = "YOUR_OPEN_AI_KEY"os.environ["OPENAI_EMBEDDINGS_DEPLOYMENT"] = "smart-agent-embedding-ada" # the deployment name for the embedding