The backend service that powers Specif AI's intelligent document generation and processing capabilities.
You can set up the backend in two ways:
- Python >= 3.11
- pip package manager
- Virtual environment tool
# MacOS/Linux
python3 -m venv .venv
# Windows
py -m venv .venv
# MacOS/Linux
source .venv/bin/activate
# Windows
.\.venv\Scripts\activate
💡 Tip: Verify activation by checking Python interpreter location:
# MacOS/Linux which python # Windows where python
pip install -r requirements.txt
Ensure that an env.sh
file is present in the root of the backend directory. Update the env.sh
file with the appropriate values, then source it using the following command:
source env.sh
Available environment variables:
APP_PASSCODE_KEY="7654321" # Electron app passcode (For local development only)
HOST="0.0.0.0" # Backend server host
PORT=5001 # Backend server port
DEBUG=false # Log level
ENABLE_SENTRY=false # Enable sentry monitoring
SENTRY_DSN= # Sentry DNS
SENTRY_ENVIRONMENT= # Sentry environment
SENTRY_RELEASE= # Sentry release name
DEFAULT_API_PROVIDER="OPENAI_COMPATIBLE_AZURE" # Default API provider
DEFAULT_MODEL="gpt-4o" # Default model
# OpenAI Config
OPENAI_API_KEY=""
OPENAI_API_BASE=""
# Azure Config
AZUREAI_API_BASE=""
AZUREAI_API_KEY=""
AZUREAI_API_VERSION=""
# Bedrock Config
CLAUDE_API_KEY=""
CLAUDE_ENDPOINT=""
python init.py
For containerized deployment, use Docker:
# Update the env.sh file with the appropriate values, then source it using the following command
source env.sh
# Build the image
docker build . --tag hai-build-requirement-backend
# Run the container
docker run -p 5001:5001 \
-e APP_PASSCODE_KEY=$APP_PASSCODE_KEY \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e OPENAI_API_BASE=$OPENAI_API_BASE \
-e AZUREAI_API_BASE=$AZUREAI_API_BASE \
-e AZUREAI_API_KEY=$AZUREAI_API_KEY \
-e AZUREAI_API_VERSION=$AZUREAI_API_VERSION \
-e CLAUDE_API_KEY=$CLAUDE_API_KEY \
-e CLAUDE_ENDPOINT=$CLAUDE_ENDPOINT \
-e HOST=$HOST \
-e PORT=$PORT \
-e DEBUG=$DEBUG \
-e ENABLE_SENTRY=$ENABLE_SENTRY \
-e SENTRY_DSN=$SENTRY_DSN \
-e SENTRY_ENVIRONMENT=$SENTRY_ENVIRONMENT \
-e SENTRY_RELEASE=$SENTRY_RELEASE \
-it hai-build-requirement-backend
Please read our Contributing Guidelines for details on submitting patches and the contribution workflow.
-
Issue: Backend server not starting.
- Solution: Ensure the virtual environment is activated and all dependencies are installed.
-
Issue: Docker container fails to run.
- Solution: Verify that the Docker daemon is running and the
env.sh
file is correctly configured.
- Solution: Verify that the Docker daemon is running and the