backend/
├── app/ # Contains the main application code
│ ├── Api/ # Contains the API router for handling requests
│ │ └── router.py # Endpoints for FastAPI to test features and handle incoming requests
│ ├── chats/ # Handles chat functionalities
│ ├── Features/ # Contains feature-specific modules
│ │ ├── Feature1/
│ │ │ ├── core.py
│ │ │ ├── tools.py
│ │ │ ├── Prompt/
│ │ │ └── metadata.json
│ │ ├── Feature2/
│ │ │ ├── core.py
│ │ │ ├── tools.py
│ │ │ ├── Prompt/
│ │ │ └── metadata.json
│ ├── services/ # Contains service modules
│ ├── utils/ # Contains utility modules
│ ├── app.yaml # Application configuration file
│ ├── Dependencies.py # Dependency management
│ ├── Main.py # Main entry point for the application
│ └── requirements.txt # Python dependencies
├── Dockerfile # Dockerfile for containerizing the application
└── README.md # Documentation file
cd 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
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.