From 36bd3b32a65127e200dc3dd31833813b55d61be3 Mon Sep 17 00:00:00 2001 From: pseco Date: Mon, 16 Feb 2026 17:58:18 +0100 Subject: [PATCH] generate working schema --- .devcontainer/.env.example | 6 ---- .devcontainer/Dockerfile_v1 | 36 ------------------- .devcontainer/devcontainer.env | 8 ----- .devcontainer/devcontainer.json | 30 +++++++--------- .dockerignore | 53 ++++++++++++++++++++++++++++ Dockerfile | 1 + Makefile | 22 ++++++++++++ docker-compose.yaml | 3 ++ pyproject.toml | 1 + requirements.txt | 27 +++++++++++--- scratches/pseco/tst_elastic_seach.py | 5 +++ scripts/start-tunnels.sh | 6 ---- uv.lock | 17 ++++++++- 13 files changed, 137 insertions(+), 78 deletions(-) delete mode 100644 .devcontainer/.env.example delete mode 100644 .devcontainer/Dockerfile_v1 delete mode 100644 .devcontainer/devcontainer.env create mode 100644 .dockerignore create mode 100644 Makefile create mode 100644 scratches/pseco/tst_elastic_seach.py diff --git a/.devcontainer/.env.example b/.devcontainer/.env.example deleted file mode 100644 index 8266b5b..0000000 --- a/.devcontainer/.env.example +++ /dev/null @@ -1,6 +0,0 @@ -MODEL_NAME=gpt-4-turbo-preview - -OPENAI_API_KEY=sk-xxxx.. -LANGFUSE_PUBLIC_KEY=pk-lf-... -LANGFUSE_SECRET_KEY=sk-lf-... -LANGFUSE_HOST=http://brunix-observability:3000 diff --git a/.devcontainer/Dockerfile_v1 b/.devcontainer/Dockerfile_v1 deleted file mode 100644 index 541de53..0000000 --- a/.devcontainer/Dockerfile_v1 +++ /dev/null @@ -1,36 +0,0 @@ -FROM python:3.11-slim - -ENV PYTHONDONTWRITEBYTECODE=1 -ENV PYTHONUNBUFFERED=1 - -WORKDIR /app - -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - curl \ - protobuf-compiler \ - && rm -rf /var/lib/apt/lists/* - -RUN pip install --no-cache-dir --upgrade pip - -RUN pip install --no-cache-dir \ - langchain==0.1.0 \ - langchain-community==0.0.10 \ - langchain-elasticsearch \ - grpcio \ - grpcio-tools \ - grpcio-reflection \ - pydantic - -COPY ./protos ./protos -COPY . . - -RUN python -m grpc_tools.protoc \ - --proto_path=./protos \ - --python_out=./src \ - --grpc_python_out=./src \ - ./protos/brunix.proto - -EXPOSE 50051 - -CMD ["python", "src/server.py"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.env b/.devcontainer/devcontainer.env deleted file mode 100644 index 6335e10..0000000 --- a/.devcontainer/devcontainer.env +++ /dev/null @@ -1,8 +0,0 @@ -ELASTICSEARCH_URL=http://host.docker.internal:9200 -DATABASE_URL=postgresql://postgres:brunix_pass@host.docker.internal:5432/postgres - -LANGFUSE_HOST=http://45.77.119.180 -LANGFUSE_PUBLIC_KEY=pk-lf-0e6db694-3e95-4dd4-aedf-5a2694267058 -LANGFUSE_SECRET_KEY=sk-lf-dbf28bb9-15bb-4d03-a8c3-05caa3e3905f -LLM_BASE_URL=http://host.docker.internal:11434 -OPENAI_API_KEY=MTswYuNlhhRLLw7EGSAz_ID9qeELinoB9x4zF8qVyQo4T3BlbkFJvS3HrA3Rqr0CtlET442uQ1nEiJtWD \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2cac9d9..9cdf986 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,30 +1,26 @@ { "name": "brunix-assistance-engine", - "build": { - "dockerfile": "Dockerfile", - "dockerComposeFile": "docker-compose.yaml", - "context": "../" - }, + "dockerComposeFile": "../docker-compose.yaml", + "service": "brunix-engine", + "workspaceFolder": "/workspace", + "remoteUser": "root", "runArgs": [ - "-p", - "50052:50051", - "--env-file", - ".devcontainer/devcontainer.env", "--add-host", "host.docker.internal:host-gateway" ], "customizations": { "vscode": { "extensions": [ - "quarto.quarto", - "ms-azuretools.vscode-docker", "ms-python.python", - "ms-vscode-remote.remote-containers", - "yzhang.markdown-all-in-one", - "redhat.vscode-yaml", - "ms-toolsai.jupyter", - "hediet.vscode-drawio" - ] + "ms-python.vscode-pylance", + "ms-python.debugpy", + "astral-sh.ruff", + "ms-python.black-formatter", + "njpwerner.autodocstring" + ], + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python" + } } } } \ No newline at end of file diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b7acc73 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,53 @@ +# Documentation +*.md +documentation/ + +# Build and dependency files +Makefile +*.pyc +__pycache__/ +*.egg-info/ +dist/ +build/ + +# Development and testing +.venv/ +venv/ +env/ +.pytest_cache/ +.coverage + +# Git and version control +.git/ +.gitignore +.gitattributes + +# IDE and editor files +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# Environment files +.env +.env.local +.env.*.local + +# Docker files (no copy Docker files into the image) +Dockerfile +docker-compose.yaml + +# CI/CD +.github/ +.gitlab-ci.yml + +# Temporary files +*.tmp +*.log +scratches/ + +# Node modules (if any) +node_modules/ +npm-debug.log diff --git a/Dockerfile b/Dockerfile index 240cf50..ade55a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 + WORKDIR /app COPY ./requirements.txt . diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2ab4b36 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: help requirements docker-build docker-up docker-down clean start tunnels_up + +help: + @echo "Available commands:" + @echo " make sync_requirements - Export dependencies from pyproject.toml to requirements.txt" + @echo " make tunnels_up - Start tunnels" + @echo " make compose_up - Run tunnels script and start Docker Compose" + +sync_requirements: + @echo "Exporting dependencies from pyproject.toml to requirements.txt..." + uv export --format requirements-txt --no-hashes --no-dev -o requirements.txt + @echo "✓ requirements.txt updated successfully" + +tunnels_up: + bash ./scripts/start-tunnels.sh < /dev/null & + @echo "✓ Tunnels started!" + +compose_up: + bash ./scripts/start-tunnels.sh < /dev/null & + sleep 2 + docker compose up -d --build + @echo "✓ Done!" diff --git a/docker-compose.yaml b/docker-compose.yaml index da90d10..9a3fe85 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,6 +4,9 @@ services: brunix-engine: build: . container_name: brunix-assistance-engine + volumes: + - .:/workspace + env_file: .env ports: - "50052:50051" environment: diff --git a/pyproject.toml b/pyproject.toml index 4687ac0..fd6f881 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ readme = "README.md" requires-python = ">=3.11" dependencies = [ "grpcio>=1.78.0", + "grpcio-reflection>=1.78.0", "grpcio-tools>=1.78.0", "langchain>=1.2.10", "langchain-community>=0.4.1", diff --git a/requirements.txt b/requirements.txt index 3f512f1..872b430 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,6 +20,10 @@ certifi==2026.1.4 # requests charset-normalizer==3.4.4 # via requests +colorama==0.4.6 ; sys_platform == 'win32' + # via + # loguru + # tqdm dataclasses-json==0.6.7 # via langchain-community elastic-transport==8.17.1 @@ -67,7 +71,7 @@ langchain-classic==1.0.1 # via langchain-community langchain-community==0.4.1 # via assistance-engine -langchain-core==1.2.12 +langchain-core==1.2.11 # via # langchain # langchain-classic @@ -96,6 +100,8 @@ langsmith==0.7.1 # langchain-classic # langchain-community # langchain-core +loguru==0.7.3 + # via assistance-engine marshmallow==3.26.2 # via dataclasses-json multidict==6.7.1 @@ -106,8 +112,10 @@ mypy-extensions==1.1.0 # via typing-inspect numpy==2.4.2 # via + # assistance-engine # elasticsearch # langchain-community + # pandas orjson==3.11.7 # via # langgraph-sdk @@ -119,6 +127,8 @@ packaging==26.0 # langchain-core # langsmith # marshmallow +pandas==3.0.0 + # via assistance-engine propcache==0.4.1 # via # aiohttp @@ -129,7 +139,6 @@ protobuf==6.33.5 # grpcio-tools pydantic==2.12.5 # via - # assistance-engine # langchain # langchain-classic # langchain-core @@ -141,9 +150,13 @@ pydantic-core==2.41.5 pydantic-settings==2.12.0 # via langchain-community python-dateutil==2.9.0.post0 - # via elasticsearch + # via + # elasticsearch + # pandas python-dotenv==1.2.1 - # via pydantic-settings + # via + # assistance-engine + # pydantic-settings pyyaml==6.0.3 # via # langchain-classic @@ -171,6 +184,8 @@ tenacity==9.1.4 # via # langchain-community # langchain-core +tqdm==4.67.3 + # via assistance-engine typing-extensions==4.15.0 # via # aiosignal @@ -189,6 +204,8 @@ typing-inspection==0.4.2 # via # pydantic # pydantic-settings +tzdata==2025.3 ; sys_platform == 'emscripten' or sys_platform == 'win32' + # via pandas urllib3==2.6.3 # via # elastic-transport @@ -197,6 +214,8 @@ uuid-utils==0.14.0 # via # langchain-core # langsmith +win32-setctime==1.2.0 ; sys_platform == 'win32' + # via loguru xxhash==3.6.0 # via # langgraph diff --git a/scratches/pseco/tst_elastic_seach.py b/scratches/pseco/tst_elastic_seach.py new file mode 100644 index 0000000..a4b00ec --- /dev/null +++ b/scratches/pseco/tst_elastic_seach.py @@ -0,0 +1,5 @@ +from langchain_elasticsearch import ElasticsearchStore +print("Hello world") + + + diff --git a/scripts/start-tunnels.sh b/scripts/start-tunnels.sh index 12593b4..6538fec 100755 --- a/scripts/start-tunnels.sh +++ b/scripts/start-tunnels.sh @@ -3,8 +3,6 @@ # Start Infrastructure Tunnels for Brunix Assistance Engine # Connects to the Devaron Cluster in Vultr Cloud -set -e - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" KUBECONFIG_PATH="$PROJECT_ROOT/$(grep KUBECONFIG_PATH "$PROJECT_ROOT/.env" | cut -d '=' -f2)" @@ -49,7 +47,3 @@ echo "" echo "To stop all tunnels, run:" echo " kill $OLLAMA_PID $ES_PID $PG_PID" echo "" -echo "Press Ctrl+C to stop all tunnels and exit..." - -# Wait for all background processes -wait diff --git a/uv.lock b/uv.lock index 34662f2..251221b 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.11" resolution-markers = [ "python_full_version >= '3.14' and sys_platform == 'win32'", @@ -165,6 +165,7 @@ version = "0.1.0" source = { virtual = "." } dependencies = [ { name = "grpcio" }, + { name = "grpcio-reflection" }, { name = "grpcio-tools" }, { name = "langchain" }, { name = "langchain-community" }, @@ -179,6 +180,7 @@ dependencies = [ [package.metadata] requires-dist = [ { name = "grpcio", specifier = ">=1.78.0" }, + { name = "grpcio-reflection", specifier = ">=1.78.0" }, { name = "grpcio-tools", specifier = ">=1.78.0" }, { name = "langchain", specifier = ">=1.2.10" }, { name = "langchain-community", specifier = ">=0.4.1" }, @@ -544,6 +546,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/48/b2/b096ccce418882fbfda4f7496f9357aaa9a5af1896a9a7f60d9f2b275a06/grpcio-1.78.0-cp314-cp314-win_amd64.whl", hash = "sha256:dce09d6116df20a96acfdbf85e4866258c3758180e8c49845d6ba8248b6d0bbb", size = 4929852, upload-time = "2026-02-06T09:56:45.885Z" }, ] +[[package]] +name = "grpcio-reflection" +version = "1.78.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "grpcio" }, + { name = "protobuf" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/31/06/337546aae558675f79cae2a8c1ce0c9b1952cbc5c28b01878f68d040f5bb/grpcio_reflection-1.78.0.tar.gz", hash = "sha256:e6e60c0b85dbcdf963b4d4d150c0f1d238ba891d805b575c52c0365d07fc0c40", size = 19098, upload-time = "2026-02-06T10:01:52.225Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/df/6d/4d095d27ccd049865ecdafc467754e9e47ad0f677a30dda969c3590f6582/grpcio_reflection-1.78.0-py3-none-any.whl", hash = "sha256:06fcfde9e6888cdd12e9dd1cf6dc7c440c2e9acf420f696ccbe008672ed05b60", size = 22800, upload-time = "2026-02-06T10:01:33.822Z" }, +] + [[package]] name = "grpcio-tools" version = "1.78.0"