Backend part contains basic infastructure for POC your ideas.
You can find there two main features
- Process from frontend to backend text to text content
- Process from frontend to backend image to text content
- FastAPI: Modern, fast (high-performance) Python web framework
- Anthropic: AI integration for advanced natural language processing
backend/
├── app/
│ ├── api/
│ │ └── chat.py
│ ├── core/
│ │ ├── config.py
│ │ └── logging.py
│ ├── models/
│ │ └── request_models.py
│ ├── services/
│ │ └── anthropic_service.py
│ ├── utils/
│ │ └── prompt.py
│ └── main.py
├── .env.example
├── docker-compose.yml
├── Dockerfile
├── README.md
├── Requirements.txt
└── setup.sh
Run the development server:
fastapi dev ./app/main.py
Serving at: http://localhost:8000
API docs: http://localhost:8000/docs
For remote development, you will need:
- Server Access (ssh user@ip & password || SSH key)
- Visual Studio Code
Pre-installed software on the server:
- vim
- build-essential
- python3
- python3-venv
- docker-ce
- docker-ce-cli
- docker-buildx-plugin
- docker-compose-plugin
To deploy a container to a cloud server, you will need:
- Downloaded Docker program
- Account on DockerHub
- Create a repository
- Anthropic API token
- Linux or MacOS operating system
- In the
Makefile
, add USERNAME and REPO to the existing tokens:
USERNAME=UserNameDockerHub
REPO=RepositoryNameDockerHub
TAG=v1
TELEGRAM_BOT_TOKEN=1235
OPENAI_API_KEY=1234
- Make sure your ANTHROPIC_API_KEY in .env
- Build the image for Linux
make build_docker
- Run the container with the application
make run_docker
- Also, you can publish the image on DockerHub
make push_docker
- Log into the server
ssh -i PATH_TO_YOUR_KEY.pem ubuntu@SERVER_IP_ADDRESS
- Find the published image on DockerHub:
docker search username/projectname
- Download the image:
docker pull username/projectname:v1
- Run the container with Telegram bot and OpenAI API tokens:
sudo docker run -d -p 8000:8000 -e ANTHROPIC_API_KEY=YOUR_API_KEY ContainerID