Feature cache cleaning#5
Conversation
Merge pull request #3 from Imaging-Plaza/dev
…nker and software finder)
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces an experimental Pydantic AI agent architecture with tool-based retrieval, along with Docker deployment infrastructure, developer environment improvements, and enhanced temp file cleanup. The agent provides an alternative execution pathway (feature flag USE_AGENT=1) that uses structured tool calls instead of the original VLM pipeline for tool selection.
Key Changes:
- Adds Pydantic AI agent with tool-based retrieval (search, rerank, repo_info, resolve_demo_link)
- Introduces Docker/devcontainer infrastructure for reproducible development and deployment
- Implements systematic temp file cleanup for preview and DICOM extraction directories
- Simplifies environment variable naming (consolidates model configuration)
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/ai_agent/agent/agent.py |
New agent orchestration with tool registration and execution flow |
src/ai_agent/agent/tools/*.py |
Tool implementations for search, rerank, repo_info, and Gradio space interaction |
src/ai_agent/agent/utils.py |
Agent state management and per-tool quota enforcement |
src/ai_agent/api/pipeline.py |
Adds agent-facing APIs (retrieve_no_rerank, rerank_only, get_doc) |
src/ai_agent/ui/app.py |
Integrates agent pathway with USE_AGENT flag and port fallback logic |
src/ai_agent/utils/*.py |
Enhanced temp file cleanup, improved runnable link selection |
tools/image/Dockerfile |
Production Docker image with uv package manager |
.devcontainer/* |
VS Code devcontainer setup for consistent development |
.github/workflows/publish_image_in_GHCR.yaml |
CI/CD workflow for automated Docker publishing |
pyproject.toml |
Version bump and pydantic-ai dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| RUN source .venv/bin/activate && uv pip install -e . | ||
|
|
||
| EXPOSE 7860 | ||
| ENTRYPOINT ["source .venv/bin/activate && python -m ai_agent.app"] No newline at end of file |
There was a problem hiding this comment.
ENTRYPOINT exec form does not invoke a shell, so this will attempt to execute 'source' as a binary rather than sourcing the venv. Use CMD with shell form or switch to: ENTRYPOINT [\"/bin/bash\", \"-c\", \"source .venv/bin/activate && python -m ai_agent.app\"]
| ENTRYPOINT ["source .venv/bin/activate && python -m ai_agent.app"] | |
| ENTRYPOINT ["/bin/bash", "-c", "source .venv/bin/activate && python -m ai_agent.app"] |
| t = str(spec.get("type") or spec.get("component") or "").lower() | ||
| # Gradio client supports passing file paths for image inputs | ||
| if "image" in t and image_path: | ||
| payload.append(handle_file(image_path) if handle_file else image_path) |
There was a problem hiding this comment.
The conditional if handle_file will always be True since handle_file is imported at the module level. If the intention is to guard against import failures, wrap the import in a try/except and set a default. Otherwise, remove the conditional.
| payload.append(handle_file(image_path) if handle_file else image_path) | |
| payload.append(handle_file(image_path)) |
There was a problem hiding this comment.
No need to modify that because gradio space tool will be changed soon
| """Return the best runnable demo link for a tool (if any).""" | ||
| link = None | ||
| try: | ||
| pipe = RAGImagingPipeline(docs=[]) |
There was a problem hiding this comment.
Creating a new empty RAGImagingPipeline instance will not have access to the loaded catalog docs. Use get_pipeline() from .tools.utils instead to access the shared pipeline instance with the full catalog.
| return | ||
| except OSError as e: # port busy | ||
| last_err = e | ||
| busy = "Cannot find empty port" in str(e) |
There was a problem hiding this comment.
The error message check 'Cannot find empty port' may not match the actual OSError message for port-in-use conditions. Verify the actual error message or use errno.EADDRINUSE for more reliable detection.
| - name: Extract version from pyproject.toml | ||
| id: project_version | ||
| run: | | ||
| VERSION=$(grep 'version =' pyproject.toml | sed -E 's/version = "([^"]+)"/\1/') |
There was a problem hiding this comment.
The grep pattern 'version =' (with space before equals) won't match the actual format in pyproject.toml which uses 'version=' (no space). Change to grep 'version=' pyproject.toml or use a more flexible pattern.
| VERSION=$(grep 'version =' pyproject.toml | sed -E 's/version = "([^"]+)"/\1/') | |
| VERSION=$(grep -E '^\s*version\s*=' pyproject.toml | sed -E 's/^\s*version\s*=\s*["'\'']([^"'\''"]+)["'\'']/\1/') |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
For more readability Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces several improvements for development workflow, deployment, and project documentation. It adds a full devcontainer setup for VS Code, a GitHub Actions workflow for building and publishing Docker images, and updates documentation to reflect these changes. It also includes a new changelog and minor configuration and dependency updates.
Development Environment & Tooling
.devcontainersetup (.devcontainer/Dockerfile,.devcontainer/devcontainer.json) for reproducible VS Code development environments using a prebuilt Python 3.12 image, user setup, and convenient extensions. [1] [2]justfilewith common development and serving commands for streamlined local workflows.Deployment & CI/CD
.github/workflows/publish_image_in_GHCR.yaml) to automatically build, tag, and publish Docker images to GHCR on pushes and PRs, including release note extraction from the changelog and cleanup of PR images.Documentation & Project Organization
.github/copilot-instructions.md, covering system design, data flow, error handling, and conventions.CHANGELOG.mdfollowing Keep a Changelog conventions, and updated the project version inpyproject.toml. [1] [2].env.distandREADME.mdto clarify environment variable usage and reflect changes to model configuration. [1] [2]Dependencies
pydantic-aito the project dependencies inpyproject.toml.These changes collectively improve the developer experience, streamline deployment, and clarify project usage and structure.