- Architecture
- Folder Structure
- Installation
- Running Locally and Testing
- Docker Setup Guide
- Environment Variables
- Accessing the Application
marvel-ai-backend/
├── app/ # Contains the main application code
│ ├── api/ # Contains the API router for handling requests
│ │ ├── tests/
│ │ └── router.py # Endpoints for FastAPI to test features and handle incoming requests
│ │ └── error_utilities.py
│ │ └── tool_utilities.py
│ │ └── tools_config.json
│ ├── features/ # Contains feature-specific modules
│ │ ├── feature1/
│ │ │ ├── core.py
│ │ │ ├── tools.py
│ │ │ ├── prompt/
│ │ │ ├── tests/
│ │ │ └── metadata.json
│ │ ├── feature2/
│ │ │ ├── core.py
│ │ │ ├── tools.py
│ │ │ ├── prompt/
│ │ │ ├── tests/
│ │ │ └── metadata.json
│ │ ├── featureN/
│ │ │ ├── core.py
│ │ │ ├── tools.py
│ │ │ ├── prompt/
│ │ │ ├── tests/
│ │ │ └── metadata.json
│ ├── services/ # Contains service modules
│ │ ├── logger.py
│ │ ├── schemas.py
│ │ ├── tool_registry.py
│ ├── utils/ # Contains utility modules
│ │ ├── auth.py
│ ├── .env.sample # Contains the required env variables (CREATE AN .env file using it)
│ ├── main.py # Main entry point for the application
├── Dockerfile # Dockerfile for containerizing the application
├── requirements.txt # Python dependencies
├── app.yaml # Application configuration file
├── load_env.sh # Loads env variables
├── local-start.sh # Starts the local server
└── README.md # Documentation file
cd marvel-ai-backend/app
python -m venv env
source env/bin/activate
pip install -r requirements.txt
- A Google Cloud account.
- Access to the Google Cloud Platform console.
- Navigate to the Google Cloud Console and create a new project.
- Enable the following APIs:
- VertexAI
- Navigate to the AI Studio API Key page and create a new API key. This will connect with your Google Cloud Project.
- Create a new file called
.env
in the root of the project. - Copy the contents of the
.env.example
file into the.env
file. - Replace the placeholder values with your API key and project ID.
- Set the
ENV_TYPE
variable todev
.
- Run the following command to start the application:
./local-start.sh
- Set the api-header to
dev
. - Send the request payload to whichever endpoint you want to test!
This guide is designed to help contributors set up and run the backend service using Docker. Follow these steps to ensure that your development environment is configured correctly.
Before you start, ensure you have the following installed:
- Docker
- Python
Navigate to the project's root directory and build the Docker image. Typically, this is done with the following command:
docker build -t <image_name> .
Run the Docker container using the following command:
docker run -p 8000:8000 <image_name>
This command starts a detached container that maps port 8000 of the container to port 8000 on the host.
The Docker container uses several key environment variables:
- ENV_TYPE set to "dev" for development.
- PROJECT_ID specifies your Google Cloud project ID.
- It is possible to enable LangChain tracing by setting the following environment variables. More information can be found on LangSmith
LANGCHAIN_TRACING_V2
LANGCHAIN_ENDPOINT
LANGCHAIN_API_KEY
LANGCHAIN_PROJECT
- Ensure these variables are correctly configured in a .env file.
You can access the backend by visiting:
http://localhost:8000/docs
After your container starts, you should see the FastAPI landing page, indicating that the application is running successfully.