Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

MongoDB as a Vector Database for AI Agents

Описание и применение

Создание ассистента рецептов, использующего MongoDB Atlas как векторную базу данных, VoyageAI для эмбеддингов и Claude для генерации ответов, с сохранением памяти пользователя.

Задача

Build an AI recipe assistant that can answer natural‑language queries and remember user preferences without a separate vector store.

Результат

The assistant can semantically search recipes and remember user preferences across sessions using a single MongoDB Atlas cluster, eliminating the need for a separate vector store.

Рабочий процесс

  • Create project directory and virtual environment
  • Install langchain, langchain‑anthropic, langchain‑mongodb, langchain‑voyageai, pymongo, requests, python‑dotenv
  • Create .gitignore for secrets
  • Set up MongoDB Atlas M0 cluster, create user and whitelist IP
  • Create .env with MONGODB_URI, VOYAGE_API_KEY, ANTHROPIC_API_KEY
  • Create JavaScript script to create recipes and memories collections and attach vector search indexes
  • Fetch recipes from TheMealDB and embed with VoyageAI
  • Insert embeddings into MongoDB
  • Configure LangChain retriever and Claude agent
  • Run agent to answer queries and store/retrieve memories

Доказательства

MongoDB is a general‑purpose document database with several modules embedded in its core that turn it into a complete data platform for modern application development.

Источник

The agent will answer natural language questions like "what can I make with rice and saffron?" by performing a semantic search over a collection of recipes fetched from TheMealDB, a free, public recipe API that requires no key.

Источник

MongoDB handles both structured and semantic workloads without splitting your infrastructure or adding complexity to your software.

Источник

  • Дата записи: 2026-10-02T09:56:07.098Z