Skip to content

Commit 1d8adb2

Browse files
authored
Merge pull request #16 from Imaging-Plaza/feature/tool-retrieval
Feature/tool retrieval
2 parents f95fb36 + bad59d8 commit 1d8adb2

20 files changed

Lines changed: 2090 additions & 359 deletions

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ All notable changes to this project will be documented in this file.
2828
- **Imaging Plaza branding**: Custom CSS theme with Plaza green colors (#00A991)
2929
- **Logo integration**: Official Imaging Plaza white logo displayed in header
3030
- **Redesigned layout**: Reorganized UI with header banner, left chat panel, and right sidebar for files and state
31+
- **Similarity-Based Query Expansion**: Replaced hard-coded synonym dictionaries with dynamic embedding-based similarity matching using BGE-M3 embeddings. Vocabulary is automatically extracted from catalog and updated on catalog changes.
32+
- **Iterative Retrieval with Retry**: Added automatic retry logic (up to 2 attempts) when initial search returns insufficient results (<5 candidates). System generates alternative queries using semantic neighbors.
33+
- **Agent Alternative Search Tool**: New `search_alternative` tool allows agent to explicitly request searches with different query formulations (up to 3 per conversation). Enables agent-driven iterative refinement.
34+
- **YAML Model Configuration**: New `config.yaml` file for flexible model configuration supporting OpenAI, EPFL inference server, and any OpenAI-compatible API endpoints.
35+
- **Multi-Model Support**: Can now configure different models for agent (main reasoning & tool selection).
36+
- **Configuration Module**: New `utils/config.py` with Pydantic models for type-safe configuration loading and validation.
3137

3238
### Changed
3339
- CLI now supports `ai_agent chat`
@@ -40,6 +46,10 @@ All notable changes to this project will be documented in this file.
4046
- **YAML Model Configuration**: New `config.yaml` file for flexible model configuration supporting OpenAI, EPFL inference server, and any OpenAI-compatible API endpoints.
4147
- **Multi-Model Support**: Can now configure different models for agent (main reasoning & tool selection).
4248
- **Configuration Module**: New `utils/config.py` with Pydantic models for type-safe configuration loading and validation.
49+
- **Query Expansion Method**: Moved from dictionary-based to similarity-based expansion using catalog vocabulary. Queries are now expanded with semantically related terms found via cosine similarity.
50+
- **Retrieval Pipeline**: Enhanced `retrieve_no_rerank()` with automatic retry and alternative query generation when results are insufficient.
51+
- **Agent Prompt**: Updated to explain new retrieval capabilities including similarity expansion, automatic retry, and when/how to use `search_alternative` tool.
52+
- **Import Paths**: Fixed and standardized all import paths to use `ai_agent.` prefix for consistency.
4353
- **Model Initialization**: Agent now uses configuration from `config.yaml`.
4454
- **API Client Creation**: OpenAI clients now support custom `base_url` for alternative API endpoints (EPFL, custom deployments).
4555
- **Dependency**: Added `pyyaml` to `pyproject.toml` dependencies.
@@ -62,6 +72,7 @@ All notable changes to this project will be documented in this file.
6272
- CLI no more supports `ai_agent ui` command
6373

6474
### Fixed
75+
- **Pydantic Forward Reference**: Reordered class definitions in `schema.py` so `Conversation` and `ConversationStatus` are defined before `ToolSelection` to prevent "class-not-fully-defined" errors.
6576
- **Conversation Context**: Agent now properly maintains conversation history, enabling natural understanding of follow-up requests like "show me alternatives".
6677
- **Clear Button**: Disabled during processing to prevent race conditions with ongoing requests.
6778
- **Alternative Tool Requests**: All recommended tools are now automatically added to the exclusion list (banlist) and properly passed to the agent through AgentState, ensuring follow-up requests like "I would like another tool" correctly return different tools.

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Default config
44
# agent_model:
5-
# name: "gpt-4o" # Model name
5+
# name: "gpt-5.1" # "gpt-4o" # Model name
66
# base_url: null # null for default OpenAI endpoint
77
# api_key_env: "OPENAI_API_KEY" # Environment variable containing API key
88

0 commit comments

Comments
 (0)