Skip to content

StackOneHQ/interview-ai-exercise

Repository files navigation

AI Exercise - Retrieval

simple RAG example

Project requirements

uv

Install uv to install and manage python dependencies.

Docker Engine (optional)

Install Docker Engine to build and run the API's Docker image locally.

Installation

make install

API

The project includes an API built with FastAPI. Its code can be found at src/api.

The API is containerized using a Docker image, built from the Dockerfile and docker-compose.yml at the root. This is optional, you can also run the API without docker.

Environment Variables

Copy .env_example to .env and fill in the values.

Build and start the API

To build and start the API, use the following Makefile command:

make dev-api

you can also use make start-api to start the API using Docker.

Frontend

The project includes a frontend built with Streamlit. Its code can be found at demo.

Run the frontend with:

make start-app

Testing

To run unit tests, run pytest with:

make test

Formatting and static analysis

There is some preset up formatting and static analysis tools to help you write clean code. check the make file for more details.

make lint
make format
make typecheck

Get Started

Have a look in ai_exercise/constants.py. Then check out the server routes in ai_exercise/main.py.

  1. Load some documents by calling the /load endpoint. Does the system work as intended? Are there any issues?

  2. Find some method of evaluating the quality of the retrieval system.

  3. See how you can improve the retrieval system. Some ideas:

  • Play with the chunking logic
  • Try different embeddings models
  • Other types of models which may be relevant
  • How else could you store the data for better retrieval?

About

Example repo for AI interviews (document retrieval)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published