fix(agent): implement filter_vector_data tool to prevent LLM hallucin… #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| jobs: | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgis/postgis:16-3.4 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: gis_agent_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| libspatialindex-dev \ | |
| postgresql-client \ | |
| gdal-bin \ | |
| libgdal-dev | |
| - name: Install Python dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gis_agent_test | |
| CHAINLIT_AUTH_SECRET: ci-test-secret-key-not-for-production | |
| run: | | |
| python -m pytest data_agent/ \ | |
| --ignore=data_agent/test_knowledge_agent.py \ | |
| --junitxml=test-results/junit.xml \ | |
| -q | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: test-results/ | |
| frontend: | |
| name: Frontend Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install and build | |
| working-directory: frontend | |
| run: | | |
| npm ci | |
| npm run build | |
| evaluate: | |
| name: Agent Evaluation | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| libspatialindex-dev \ | |
| gdal-bin \ | |
| libgdal-dev | |
| - name: Install Python dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run multi-pipeline evaluation | |
| env: | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }} | |
| GOOGLE_CLOUD_LOCATION: us-central1 | |
| run: | | |
| python data_agent/run_evaluation.py | |
| - name: Check evaluation results | |
| if: always() | |
| run: | | |
| python -c " | |
| import json, sys | |
| with open('data_agent/eval_results/eval_summary.json') as f: | |
| s = json.load(f) | |
| print(f'Passed: {s[\"total_passed\"]}/{s[\"total_tests\"]}') | |
| for name, p in s['pipelines'].items(): | |
| st = 'SKIP' if p.get('status') == 'skipped' else f'{p.get(\"passed\",0)}/{p.get(\"total\",0)}' | |
| print(f' {name}: {st}') | |
| if not s['overall_pass']: | |
| print('EVALUATION FAILED') | |
| sys.exit(1) | |
| " | |
| - name: Upload evaluation results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eval-results | |
| path: data_agent/eval_results/ |