Remove filter from the search tool
This commit is contained in:
parent
99ca3605e7
commit
70273ecf5b
1 changed files with 1 additions and 4 deletions
|
|
@ -5,7 +5,6 @@ from pydantic_ai import FunctionToolset, RunContext
|
||||||
from haiku.rag.config.models import AppConfig
|
from haiku.rag.config.models import AppConfig
|
||||||
from haiku.rag.store.models import SearchResult
|
from haiku.rag.store.models import SearchResult
|
||||||
from haiku.rag.tools.context import RAGDeps
|
from haiku.rag.tools.context import RAGDeps
|
||||||
from haiku.rag.tools.filters import combine_filters
|
|
||||||
|
|
||||||
|
|
||||||
def create_search_toolset(
|
def create_search_toolset(
|
||||||
|
|
@ -35,21 +34,19 @@ def create_search_toolset(
|
||||||
ctx: RunContext[RAGDeps],
|
ctx: RunContext[RAGDeps],
|
||||||
query: str,
|
query: str,
|
||||||
limit: int | None = None,
|
limit: int | None = None,
|
||||||
filter: str | None = None,
|
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Search the knowledge base for relevant documents.
|
"""Search the knowledge base for relevant documents.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: The search query (what to search for).
|
query: The search query (what to search for).
|
||||||
limit: Number of results to return (default: from config).
|
limit: Number of results to return (default: from config).
|
||||||
filter: Optional SQL WHERE clause to filter documents.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Formatted search results with content and metadata.
|
Formatted search results with content and metadata.
|
||||||
"""
|
"""
|
||||||
client = ctx.deps.client
|
client = ctx.deps.client
|
||||||
|
|
||||||
effective_filter = combine_filters(base_filter, filter)
|
effective_filter = base_filter
|
||||||
effective_limit = limit or config.search.limit
|
effective_limit = limit or config.search.limit
|
||||||
results = await client.search(
|
results = await client.search(
|
||||||
query, limit=effective_limit, filter=effective_filter
|
query, limit=effective_limit, filter=effective_filter
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue