Conversation
…mproved clarity and flexibility.
… registration and prompt rendering.
… update method signatures for improved clarity and usability.
…hain_tools.py` and update imports across executors.
…lity across executors.
… `RUN_SQL_QUERY_TOOL_DESCRIPTION` for improved clarity
# Conflicts: # databao/agent/api.py # databao/agent/duckdb/react_tools.py # databao/agent/executors/base.py # databao/agent/executors/claude_code/claude_model_wrapper.py # databao/agent/executors/claude_code/executor.py # databao/agent/executors/langchain_tools.py # databao/agent/executors/utils.py
|
model does in fact use dce, but subsequent |
There was a problem hiding this comment.
Pull request overview
Adds Databao Context Engine (DCE) context-search tooling support to the Claude Code executor path, and refactors shared DuckDB SQL execution + context-search logic to reusable utilities.
Changes:
- Centralize
execute_duckdb_sqlinto a newdatabao.agent.duckdb.utilsmodule and update executors to use it. - Add DCE context search helpers (including query expansion + RRF) into
executors/utils.pyand reuse them from LangChain tools. - Enable and wire a
search_contextMCP tool for Claude Code when the active domain supports DCE context.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| databao/agent/executors/utils.py | Adds DCE context search helpers and query-expansion search implementation. |
| databao/agent/executors/react_duckdb/executor.py | Updates DuckDB SQL execution import to the new shared helper. |
| databao/agent/executors/langchain_tools.py | Refactors DCE search tools to reuse shared search helpers; introduces tool description constants. |
| databao/agent/executors/claude_code/executor.py | Enables DCE search for Claude Code when domain supports context; passes domain into wrapper. |
| databao/agent/executors/claude_code/claude_model_wrapper.py | Adds MCP search_context tool when domain is _DCEProjectDomain. |
| databao/agent/duckdb/utils.py | New shared implementation of execute_duckdb_sql. |
| databao/agent/duckdb/react_tools.py | Removes duplicated SQL helper; imports shared helper; avoids potential circular import via local import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| to get the best results. | ||
|
|
||
| Args: | ||
| query: Natural language query to search the context for relevant results. |
| @@ -0,0 +1,16 @@ | |||
| import pandas as pd | |||
| from _duckdb import DuckDBPyConnection | |||
| if self._domain.supports_context: | ||
| if isinstance(self._domain, _DCEProjectDomain): | ||
|
|
||
| @tool( | ||
| "search_context", | ||
| SEARCH_CONTEXT_TOOL_DESCRIPTION, | ||
| {"retrieve_text": str}, | ||
| annotations=ToolAnnotations(readOnlyHint=True), | ||
| ) | ||
| async def search_context(args: dict[str, Any]) -> dict[str, Any]: | ||
| if retrieve_text := args.get("retrieve_text", ""): | ||
| return { | ||
| "content": [ | ||
| { | ||
| "type": "text", | ||
| "text": json.dumps(_search_context(retrieve_text, domain=self._domain)), # type: ignore[arg-type] | ||
| } | ||
| ] | ||
| } | ||
| return {"content": [{"type": "text", "text": json.dumps({"error": "No retrieve text provided"})}]} | ||
|
|
||
| tools.append(search_context) | ||
| else: | ||
| raise ValueError(f"Search context tool is not supported for domain type: {type(self._domain)}") | ||
|
|
| "content": [ | ||
| { | ||
| "type": "text", | ||
| "text": json.dumps(_search_context(retrieve_text, domain=self._domain)), # type: ignore[arg-type] |
| def search_context(query: str, *, domain: _DCEProjectDomain) -> list[dict[str, Any]]: | ||
| """Search the context for relevant information matching the given query text. | ||
| Args: | ||
| query: Natural language query to search the context for relevant results. | ||
| domain: The domain object to use to search the context. | ||
| """ | ||
| search_result_list = domain.search_context(query, datasource_name=None) |
Uh oh!
There was an error while loading. Please reload this page.