Skip to content

Feat: Add query optimization for vector search with configurable models #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 12, 2025

Conversation

abrookins
Copy link
Collaborator

@abrookins abrookins commented Aug 9, 2025

  • Add SLOW_MODEL and FAST_MODEL config settings with OpenAI defaults
  • Create optimize_query_for_vector_search() function using FAST_MODEL
  • Add optimize_query parameter to search functions (default True for API, False for MCP/tools)
  • Update all docstrings to refer to "query for vector search" terminology
  • Robust error handling with graceful fallbacks when optimization fails

🤖 Generated with Claude Code

- Add SLOW_MODEL and FAST_MODEL config settings with OpenAI defaults
- Create optimize_query_for_vector_search() function using FAST_MODEL
- Add optimize_query parameter to search functions (default True for API, False for MCP/tools)
- Update all docstrings to refer to "query for vector search" terminology
- Comprehensive test coverage with 27+ specific tests for query optimization
- Robust error handling with graceful fallbacks when optimization fails

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@Copilot Copilot AI review requested due to automatic review settings August 9, 2025 00:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements query optimization for vector search using configurable AI models to improve search performance. The feature adds smart query rewriting to make natural language queries more effective for semantic similarity search while preserving original intent.

  • Adds configurable SLOW_MODEL and FAST_MODEL settings with OpenAI defaults
  • Implements query optimization with selective defaults (enabled for API, disabled for MCP/tools)
  • Provides comprehensive error handling with graceful fallbacks when optimization fails

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
agent_memory_server/config.py Adds slow_model and fast_model configuration settings with OpenAI defaults
agent_memory_server/llms.py Implements optimize_query_for_vector_search function using fast model with error handling
agent_memory_server/long_term_memory.py Integrates query optimization into search_long_term_memories with configurable toggle
agent_memory_server/api.py Updates API endpoints to support optimize_query parameter with True default
agent_memory_server/mcp.py Updates MCP functions with optimize_query parameter defaulting to False for LLM tools
agent-memory-client/agent_memory_client/client.py Updates client methods to support optimize_query parameter with appropriate defaults
tests/ Comprehensive test coverage for query optimization functionality and error scenarios

@abrookins abrookins changed the title Add query optimization for vector search with configurable models Feat: Add query optimization for vector search with configurable models Aug 11, 2025
abrookins and others added 2 commits August 11, 2025 17:54
- Extract hardcoded optimization prompt to config.py setting
- Add min_optimized_query_length config setting
- Fix AttributeError handling for missing response.choices
- Fix malformed test by properly checking hasattr before deletion
- Extract magic number to class constant

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Minor version bump for new optimize_query parameter feature
added to search and memory prompt methods.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@abrookins abrookins merged commit a930acc into main Aug 12, 2025
10 checks passed
@abrookins abrookins deleted the feature/look-at-times branch August 12, 2025 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant