diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..a4d53cf --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,43 @@ +name: Build and Publish Docker Image + +on: + push: + branches: + - main + - docker-build-publish + +env: + REGISTRY: public.ecr.aws/b7u8b0a6 + IMAGE_NAME: project-zeno/zeno + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to Amazon ECR Public + id: login-ecr-public + uses: aws-actions/amazon-ecr-login@v2 + with: + registry-type: public + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1e463d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM python:3.12-slim-bookworm + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +# The installer requires curl (and certificates) to download the release archive +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +ADD https://astral.sh/uv/0.5.4/install.sh /uv-installer.sh + +# Run the installer then remove it +RUN sh /uv-installer.sh && rm /uv-installer.sh + +# Ensure the installed binary is on the `PATH` +ENV PATH="/root/.local/bin/:$PATH" + +# Copy the project into the image +ADD . /app + +# Sync the project into a new environment, using the frozen lockfile +WORKDIR /app + +# Install the dependencies +RUN uv sync --frozen + +# Command to run the application. +CMD ["uv", "run", "uvicorn", "api:app", "--reload"] diff --git a/zeno/agents/maingraph/utils/nodes.py b/zeno/agents/maingraph/utils/nodes.py index 9672014..da17172 100644 --- a/zeno/agents/maingraph/utils/nodes.py +++ b/zeno/agents/maingraph/utils/nodes.py @@ -1,10 +1,11 @@ import json from langchain_core.messages import HumanMessage, SystemMessage -from langchain_ollama import ChatOllama +from langchain_ollama import ChatOllama # noqa +from langchain_anthropic import ChatAnthropic -llm_json_mode = ChatOllama(model="qwen2.5:7b", temperature=0, format="json") -# llm_json_mode = ChatAnthropic(model="claude-3-5-sonnet-20241022", temperature=0, format="json") +# llm_json_mode = ChatOllama(model="qwen2.5:7b", temperature=0, format="json") +llm_json_mode = ChatAnthropic(model="claude-3-5-sonnet-20241022", temperature=0) def generate(state): diff --git a/zeno/tools/location/tool.py b/zeno/tools/location/tool.py index 365cf37..58a6a91 100644 --- a/zeno/tools/location/tool.py +++ b/zeno/tools/location/tool.py @@ -3,7 +3,7 @@ from zeno.tools.location.location_matcher import LocationMatcher -GADM_CSV_PATH = "../data/gadm.csv" +GADM_CSV_PATH = "data/gadm.csv" location_matcher = LocationMatcher(GADM_CSV_PATH)