Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -432,4 +432,5 @@ FodyWeavers.xsd
# TypeScript
dist/
build/
node_modules/
node_modules/
.tsbuildinfo*
79 changes: 79 additions & 0 deletions mongo-vcore-agent-langchain/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
DEBUG=false
USE_PASSWORDLESS=false

# ========================================
# Azure OpenAI Shared Settings
# ========================================
#The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.
AZURE_OPENAI_API_KEY="<your-azure-openai-api-key>"
AZURE_OPENAI_ENDPOINT="https://<your-resource-name>.openai.azure.com/"
AZURE_OPENAI_API_INSTANCE_NAME="<your-resource-name>"

AZURE_OPENAI_SYNTH_API_VERSION="2025-01-01-preview"
AZURE_OPENAI_SYNTH_DEPLOYMENT="gpt-4o"

AZURE_OPENAI_PLANNER_DEPLOYMENT="gpt-4.1-mini"
AZURE_OPENAI_PLANNER_API_VERSION="2025-01-01-preview"

# ========================================
# Azure OpenAI Embedding Model Settings
# ========================================
AZURE_OPENAI_EMBEDDING_DEPLOYMENT="text-embedding-3-small"
AZURE_OPENAI_EMBEDDING_API_VERSION="2023-05-15"

FIELD_TO_EMBED="Description"
EMBEDDED_FIELD="vectors"
EMBEDDING_DIMENSIONS="1536"
EMBEDDING_BATCH_SIZE="16"

# ========================================
# Data File Paths and Vector Configuration
# ========================================
DATA_FILE_WITHOUT_VECTORS="../data/HotelsData_toCosmosDB.JSON"
DATA_FILE_WITH_VECTORS="./data/HotelsData_toCosmosDB_Vector_text-embedding-3-small.json"
QUERY="quintessential lodging near running trails, eateries, retail"
# ========================================
# Data Loading and Processing Settings
# ========================================
LOAD_SIZE_BATCH="100"
# ========================================
# MongoDB/Cosmos DB Connection Settings
# ========================================
AZURE_COSMOSDB_MONGODB_CONNECTION_STRING="<your-cosmos-db-connection-string>"
MONGO_CLUSTER_NAME="<your-cluster-name>"
MONGO_DB_NAME="Hotels"
MONGO_DB_COLLECTION="Hotels_ivf"
MONGO_DB_INDEX_NAME="vectorIndex_ivf"
# Vector Index Algorithm: vector-ivf (default), vector-hnsw, or vector-diskann
VECTOR_INDEX_ALGORITHM="vector-ivf"
VECTOR_SEARCH_STRATEGY="documentdb" # or mongo or auto

# ========================================
# Vector Index Parameters (Optional Tuning)
# ========================================
# Common parameter for all algorithms
VECTOR_SIMILARITY="COS" # Options: COS (cosine), L2 (euclidean), IP (inner product)

# IVF-specific parameters (used when VECTOR_INDEX_ALGORITHM=vector-ivf)
IVF_NUM_LISTS="10" # Number of clusters for IVF index (default: 10)

# HNSW-specific parameters (used when VECTOR_INDEX_ALGORITHM=vector-hnsw)
# HNSW_M="16" # Max connections per layer (default: 16)
# HNSW_EF_CONSTRUCTION="64" # Size of dynamic candidate list during build (default: 64)

# DiskANN-specific parameters (used when VECTOR_INDEX_ALGORITHM=vector-diskann)
# DISKANN_MAX_DEGREE="20" # Max degree of graph (default: 20)
# DISKANN_L_BUILD="10" # Size of search list during build (default: 10)
# ========================================
# Agent Search Configuration
# ========================================
MAX_SEARCH_RESULTS="5"
SIMILARITY_THRESHOLD="0.7"

# ========================================
# Optional Settings
# ========================================
LANGSMITH_TRACING="false"
LANGSMITH_ENDPOINT="https://api.smith.langchain.com"
LANGSMITH_API_KEY=""
LANGSMITH_PROJECT=""
21 changes: 21 additions & 0 deletions mongo-vcore-agent-langchain/docs/architecture.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```mermaid
flowchart TD
A[User] -->|asks question| Planner(Planner Agent)
Planner -->|calls tool| Tool[getHotelsToMatchSearchQuery Tool]
Tool -->|returns plain text / JSON string| Extractor(Extractor)
Planner -->|may return AI message instead of tool call| Fallback{Planner didn't call tool}
Fallback -->|run programmatic vector search| Extractor
Extractor -->|hotelContext string| Synth(Synthesizer Agent)
Synth -->|final answer| A

subgraph Clients
E[Embedding Client]
C[Cosmos DB (Mongo API) Vector Store]
Chat[Chat Client]
end

Tool --> C
Tool --> E
Planner --> Chat
Synth --> Chat
```
Loading