Dockerfiles for Actor container (#18)
#### Summary This PR introduces key updates to the Arcade AI codebase, focusing on improving the CLI tool, refining the Docker build process, and enhancing documentation within the Gmail toolkit. #### Key Changes: 1. **Docker Build**: - Added the `--no-cache` option to the `docker-build` target in the Makefile to ensure fresh builds, preventing issues related to cached layers. 2. **CLI Tool**: - Introduced a new optional `prompt` parameter in the `chat` command, allowing users to customize the system role's prompt. A default prompt is now provided if none is specified. 3. **Gmail Toolkit**: - Updated the `write_draft` function with improved docstrings for clearer guidance and maintainability. #### Impact: - **Developer Workflow**: Improved Docker reliability and enhanced CLI flexibility. - **User Experience**: More customizable interactions in the CLI and better documentation in the Gmail toolkit. Please review and provide feedback.
This commit is contained in:
parent
ab703b75ef
commit
e7ccbe0efa
9 changed files with 110 additions and 7 deletions
|
|
@ -1,3 +1,16 @@
|
||||||
|
VENDOR ?= ArcadeAI
|
||||||
|
PROJECT ?= ArcadeAI
|
||||||
|
SOURCE ?= https://github.com/ArcadeAI/arcade-ai
|
||||||
|
LICENSE ?= MIT
|
||||||
|
DESCRIPTION ?= "Arcade AI for LLM Tool Serving"
|
||||||
|
REPOSITORY ?= arcadeai/arcade-ai
|
||||||
|
|
||||||
|
VERSION ?= dev
|
||||||
|
COMMIT ?= $(shell git describe --dirty --always --abbrev=15)
|
||||||
|
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
IMAGE_NAME ?= actor
|
||||||
|
PORT ?= 8000
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: ## Install the poetry environment and install the pre-commit hooks
|
install: ## Install the poetry environment and install the pre-commit hooks
|
||||||
@echo "🚀 Creating virtual environment using pyenv and poetry"
|
@echo "🚀 Creating virtual environment using pyenv and poetry"
|
||||||
|
|
@ -47,8 +60,35 @@ docs-test: ## Test if documentation can be built without warnings or errors
|
||||||
docs: ## Build and serve the documentation
|
docs: ## Build and serve the documentation
|
||||||
@poetry run mkdocs serve -a localhost:8777
|
@poetry run mkdocs serve -a localhost:8777
|
||||||
|
|
||||||
|
.PHONY: docker-build
|
||||||
|
docker-build: ## Build the Docker container
|
||||||
|
@echo "🛠️ Building Docker image ($(VERSION)).."
|
||||||
|
@echo "- Commit: $(COMMIT)"
|
||||||
|
@echo "- Build Date: $(BUILD_DATE)"
|
||||||
|
@docker build -f ../docker/Dockerfile ../ -t $(REPOSITORY):$(VERSION) \
|
||||||
|
--build-arg PORT=$(PORT) \
|
||||||
|
--build-arg VERSION="$(VERSION)" \
|
||||||
|
--build-arg COMMIT="$(COMMIT)" \
|
||||||
|
--build-arg BUILD_DATE="$(BUILD_DATE)" \
|
||||||
|
--label=org.opencontainers.image.vendor="$(VENDOR)" \
|
||||||
|
--label=org.opencontainers.image.title="$(PROJECT)" \
|
||||||
|
--label=org.opencontainers.image.revision="$(COMMIT)" \
|
||||||
|
--label=org.opencontainers.image.version="$(VERSION)" \
|
||||||
|
--label=org.opencontainers.image.created="$(BUILD_DATE)" \
|
||||||
|
--label=org.opencontainers.image.source="$(SOURCE)" \
|
||||||
|
--label=org.opencontainers.image.licenses="$(LICENSE)" \
|
||||||
|
--label=org.opencontainers.image.description=$(DESCRIPTION)
|
||||||
|
|
||||||
|
.PHONY: docker-run
|
||||||
|
docker-run: ## Run the Docker container
|
||||||
|
@echo "🚀 Running Docker container ($(VERSION)).."
|
||||||
|
@docker run -p $(PORT):$(PORT) \
|
||||||
|
-e WORK_DIR=/app/docker/ \
|
||||||
|
$(REPOSITORY):$(VERSION)
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
@echo "🛠️ Arcade AI Dev Commands:\n"
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
[virtualenvs]
|
|
||||||
in-project = true
|
|
||||||
53
docker/Dockerfile
Normal file
53
docker/Dockerfile
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Use a lightweight Python image
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV POETRY_VERSION=1.8.3
|
||||||
|
ENV PORT=8001
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
apt-utils \
|
||||||
|
build-essential \
|
||||||
|
libssl-dev \
|
||||||
|
libffi-dev \
|
||||||
|
python3-dev \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Poetry
|
||||||
|
RUN python -m pip install "poetry==$POETRY_VERSION"
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the parent directory contents into the container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
WORKDIR /app/arcade
|
||||||
|
|
||||||
|
# Build the project and install the wheel with extras
|
||||||
|
RUN python -m poetry build && \
|
||||||
|
pip install dist/arcade_ai-0.1.0-py3-none-any.whl[fastapi,dev]
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install toolkits from the toolkits directory
|
||||||
|
RUN set -e; \
|
||||||
|
for toolkit in /app/toolkits/*; do \
|
||||||
|
echo "Installing toolkit $(basename $toolkit) "; \
|
||||||
|
cd $toolkit; \
|
||||||
|
python -m poetry build; \
|
||||||
|
pip install dist/*.whl; \
|
||||||
|
done
|
||||||
|
|
||||||
|
# Expose the port
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
|
WORKDIR /app/arcade
|
||||||
|
|
||||||
|
RUN pip install uvicorn
|
||||||
|
|
||||||
|
# Run the arcade dev command
|
||||||
|
CMD arcade dev --host $HOST --port $PORT
|
||||||
8
docker/arcade.toml
Normal file
8
docker/arcade.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[api]
|
||||||
|
key = "123456789"
|
||||||
|
secret = "196a8a25-fde8-453a-9f58-ff646a6e034d"
|
||||||
|
|
||||||
|
[engine]
|
||||||
|
host = "arcade-engine"
|
||||||
|
port = "9099"
|
||||||
|
tls = false
|
||||||
3
docker/toolkits.txt
Normal file
3
docker/toolkits.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
gmail
|
||||||
|
github
|
||||||
|
websearch
|
||||||
|
|
@ -6,7 +6,7 @@ authors = ["Nate Barbettini <nate@arcade-ai.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.10"
|
python = "^3.10"
|
||||||
arcade-ai = "^0.1.0"
|
arcade-ai = "*"
|
||||||
requests = "^2.32.3"
|
requests = "^2.32.3"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,14 @@ authors = ["Sam Partee <sam@arcade-ai.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.10"
|
python = "^3.10"
|
||||||
arcade-ai = "^0.1.0"
|
arcade-ai = "*"
|
||||||
google-api-core = "2.19.1"
|
google-api-core = "2.19.1"
|
||||||
google-api-python-client = "2.137.0"
|
google-api-python-client = "2.137.0"
|
||||||
google-auth = "2.32.0"
|
google-auth = "2.32.0"
|
||||||
google-auth-httplib2 = "0.2.0"
|
google-auth-httplib2 = "0.2.0"
|
||||||
google-auth-oauthlib = "1.2.1"
|
google-auth-oauthlib = "1.2.1"
|
||||||
googleapis-common-protos = "1.63.2"
|
googleapis-common-protos = "1.63.2"
|
||||||
|
beautifulsoup4 = "^4.10.0"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pytest = "^7.4.0"
|
pytest = "^7.4.0"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ authors = ["Nate <nate@arcade-ai.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.10"
|
python = "^3.10"
|
||||||
arcade-ai = {path = "../../arcade", develop = true}
|
arcade-ai = "*"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pytest = "^7.4"
|
pytest = "^7.4"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ authors = ["Sam Partee <sam@arcade-ai.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.10"
|
python = "^3.10"
|
||||||
arcade-ai = "^0.1.0"
|
arcade-ai = "*"
|
||||||
serpapi = "^0.1.5"
|
serpapi = "^0.1.5"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue