Notebooks
M
MongoDB
Retrieval Strategies Mongodb Llamaindex Togetherai

Retrieval Strategies Mongodb Llamaindex Togetherai

advanced_techniquesagentsartificial-intelligencellmsmongodb-genai-showcasenotebooksgenerative-airag

Open In Colab

Optimizing for relevance using MongoDB, LlamaIndex and Together.ai

In this notebook, we will explore and tune different retrieval options in MongoDB's LlamaIndex integration using Together.ai to get the most relevant results.

[ ]

Step 1: Install libraries

  • pymongo: Python package to interact with MongoDB databases and collections

- **llama-index**: Python package for the LlamaIndex LLM framework

- **llama-index-llms-together**: Python package to use TogetherAI models via their LlamaIndex integration

- **llama-index-vector-stores-mongodb**: Python package for MongoDB’s LlamaIndex integration

[ ]

Step 2: Setup prerequisites

  • Set the MongoDB connection string: Follow the steps here to get the connection string from the Atlas UI.

  • Set the Together.ai API key: Steps to obtain an API key as here

[ ]
[ ]
[ ]

Step 3: Load and process the dataset

[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]

Step 4: Define the LLM and Embedding Model

[ ]

Step 5: Create MongoDB Atlas Vector store

[ ]

Create Atlas Vector Index

[ ]

Create Atlas Search Index

[ ]
[ ]
[ ]

Step 6: Get movie recommendations

[ ]

Query

[ ]

Aggregate

[ ]

Full-text search

[ ]

Vector search

[ ]

Hybrid search

[ ]
[ ]
[ ]

Combining metadata filters with search

[ ]
[ ]
[ ]