Skip to main content

Development environment setup

Let's get your development environment ready for building the movie recommendation API.

Project setup

Clone this repository to get started:

git clone https://github.com/weaviate-tutorials/academy-first-rag-app.git

Virtual environment

uv

We recommend using uv to manage your project environment. Install uv, and then set up the environment with:

uv sync

Then, activate the virtual environment:

source .venv/bin/activate

venv

If you prefer another method, such as venv you can use the provided requirements.txt file to set up your environment.

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Weaviate instance

Set up a Weaviate Cloud sandbox instance for this course. You can follow the official documentation to create one.

The provided code expects your credentials in the following environment variables:

  • WCD_STUDENT_URL: The (REST) URL of your Weaviate instance
  • WCD_STUDENT_KEY: Your Weaviate API key

AI model providers

This course uses the Weaviate Embeddings service to generate embeddings, and Anthropic API for generative AI tasks. To use the Anthropic API, you'll need to sign up for an API key.

The course expects Anthropic API key to be set in the ANTHROPIC_API_KEY environment variable.

The entire course should cost less than $1 in Anthropic credits to complete, from start to finish.

What if you can't use Anthropic / prefer another provider?

If you prefer another provider or model, you will need to modify:

  • movie_occasion_to_query(): To use a different LLM for query generation
  • recommend_movie(): To use a different LLM for recommendation generation
  • connect_to_weaviate(): Provide the necessary authentication details for the new provider

Project structure overview

main.py: Your FastAPI application with endpoint definitions. You'll implement the Weaviate operations in the TODO sections.

helpers.py: Contains utility functions & variables:

  • connect_to_weaviate(): Context manager for Weaviate connections
  • CollectionName: Constants for collection names
  • movie_occasion_to_query(): Helper for converting occasions to search queries

populate_complete.py: Complete data ingestion script that will create your movie collection and import the dataset.

You're now ready to start building your movie API.

What's next?

With your environment configured, let's explore the movie dataset and learn how to ingest data into Weaviate.

Login to track your progress