Skip to content

feat(agent): add Querit Python search tool - #2

Merged
ethan7zhanghx merged 1 commit into
feat/querit-search-toolfrom
feat/querit-python-tool
Jul 27, 2026
Merged

ethan7zhanghx merged 1 commit into
feat/querit-search-toolfrom
feat/querit-python-tool

Conversation

@ethan7zhanghx

Copy link
Copy Markdown

Summary

Add the Python Canvas tool implementation for Querit Search. This PR is limited to the Python runtime and its unit tests; it does not expose the frontend node or add the Go runtime implementation.

Request contract

RAGFlow field Querit API field Behavior
query query Required string
count count Defaults to 10, minimum 1
chunks_per_doc chunksPerDoc Defaults to 3, accepts 1–3, omitted when None
site_include filters.sites.include Optional string array
site_exclude filters.sites.exclude Optional string array
time_range filters.timeRange.date Optional Querit relative or absolute date range
country_include filters.geo.countries.include Optional string array passed through unchanged
language_include filters.languages.include Optional string array passed through unchanged

The tool calls POST https://api.querit.ai/v1/search with Bearer authentication. A node-level api_key takes precedence, with QUERIT_API_KEY as the fallback. Empty filters are omitted.

Response and error behavior

  • Builds RAGFlow references from results.result[] using title, url, and snippet.
  • Returns formatted references through formalized_content.
  • Returns the complete Querit JSON Object through json, including unknown fields and large integer search_id values.
  • Retries network errors and HTTP 429/500/502/503/504 up to three total attempts.
  • Does not retry 401, 403, or other non-retryable HTTP errors.
  • Converts failures to RAGFlow _ERROR output and redacts the active API key from errors and logs.

Tests

  • uv run --group test pytest test/unit_test/agent/tools/test_querit_unit.py -q — 23 passed
  • uv run --group test pytest test/unit_test/agent/tools/test_querit_unit.py test/unit_test/agent/tools/test_http_timeout.py -q — 48 passed
  • uv tool run ruff check agent/tools/querit.py test/unit_test/agent/tools/test_querit_unit.py — passed
  • uv tool run ruff format --check agent/tools/querit.py test/unit_test/agent/tools/test_querit_unit.py — 2 files already formatted
  • git diff --cached --check — passed before commit

All API tests use mocks and do not require or access a real Querit API key.

@ethan7zhanghx
ethan7zhanghx merged commit add56d7 into feat/querit-search-tool Jul 27, 2026
ethan7zhanghx pushed a commit that referenced this pull request Aug 7, 2026
…17937)

Collapses three duplicated/dead code smells in the canvas debug-result
path of `internal/ingestion/task` (remaining findings #2/#3/#4 from the
package CTO review):

- **#2 — vector-key stripping duplication.** `isVectorKey` (the full
stripper: fixed legacy keys `vector`/`embedding`/`feature`/`q_vec` plus
the `q_<dim>_vec` pattern) was re-implemented as a weaker inline copy in
the golden-compare tool (`tool/compare_pipeline_golden.go`) that only
matched `q_<dim>_vec` and let real vectors leak into the diff. Exported
as `IsVectorKey` and reused by the tool.
- **#3 — near-duplicate deep copy.** `deepCopy` and `deepCopyStrip` were
identical walkers differing only in vector stripping. Parameterized
`deepCopy(v any, stripVector bool) any` and deleted `deepCopyStrip`.
- **#4 — redundant switch.** `lookupComponentOutput` had two switch
cases with identical bodies (both the `map[string]map[string]any` and
`map[string]any` state shapes). Unified into a single `found`/`ok`
resolution; nested-state and flat-fallback semantics unchanged.
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