Repository navigation
feat(agent): add Querit search tool - #5
Conversation
ethan7zhanghx
left a comment
There was a problem hiding this comment.
Re-review result: REQUEST CHANGES. The current head (d7cbadf5a13c2df4989fb89603991d4d914d3575) is not merge-ready.
Required changes:
-
The new component test does not compile.
ToolBackedComponent.Invokerequires(ctx, db, inputs), but the calls atinternal/agent/component/tool_component_test.go:499and:506omit thedbargument. Passnilas the second argument. -
Align
time_rangewith the already merged Querit contract. The frontend and Python implementation acceptdN,wN,mN,yN, andYYYY-MM-DDtoYYYY-MM-DD; the Go implementation currently accepts onlydN/mNand comma/..date separators. It also adds calendar/order validation that the shared contract does not define. Values accepted and persisted by the UI, such asw1,y1, and2026-01-01to2026-01-31, currently fail at runtime. -
Preserve large numeric fields in the complete Canvas JSON output.
parseToolEnvelopedecodes intomap[string]anywithjson.Unmarshal, so a real Queritsearch_idsuch as11099848653006015581becomes afloat64and changes to11099848653006016512. Usejson.Decoder.UseNumber()or an equivalent lossless representation, and add a fullToolBackedComponentregression test with a numericsearch_id. -
Complete the non-string query validation. Numeric query values are rejected, but
{"query": null}and a missing query decode to an empty Go string and are treated as successful empty searches. The established Python behavior only treats an actual empty string as a no-op; null or missing/non-string values must return_ERRORwithout a network request. -
Validate the Querit response shape. The Go path checks only that the top level is a JSON object. A non-object
resultsor non-arrayresults.resultis silently converted into zero references. Match the Python behavior and return a soft_ERRORfor malformed response shapes so upstream contract changes are not reported as successful empty searches. -
Keep Canvas output/reference behavior aligned with the existing implementation. An empty query currently returns
{"results":{"result":[]}}instead ofjson: {}. Reference construction should also skip empty snippets, remove inline base64 image payloads, and cap each snippet at 10,000 characters, as the existing Python/Tavily paths do. -
Align explicit
chunks_per_doc: nullhandling. The Python contract and its regression test omitchunksPerDocin this case; the Go implementation currently converts null to zero and returns a validation error.
Verification performed:
gofmton all changed Go files: passed.git diff --check: passed.- Targeted Go component tests: compilation failed at the two
Invokecalls above. - The tool package reached native linking but could not complete locally because this checkout does not contain
internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a; this is a local environment limitation, not evidence that the package tests pass. - GitHub currently reports no CI checks for this PR.
Please also replace the placeholder PR description with the implemented behavior, contract mapping, and exact validation evidence before requesting another review.
|
曾昭鑫已收到您的邮件,将在第一时间回复您,谢谢。
|
|
Follow-up after reviewing the latest head (
One additional required security fix was found during the cross-PR review: The PR description is still the placeholder template and GitHub still reports no CI checks. |
Summary
Add Querit web search support to the Go Agent runtime and expose it as the
QueritSearchCanvas component, aligned with the existing Python/frontend contract.Behavior
querit,querit_search, andqueritsearchaliases.QUERIT_API_KEY; model-emitted runtime arguments cannot override credentials.query,count,chunks_per_doc, site filters,time_range, country filters, and language filters.dN,wN,mN,yN, andYYYY-MM-DDtoYYYY-MM-DDtime ranges.nullresponse containers while allowing omittedresultsorresultfields.Validation
CGO_ENABLED=0using the repository's no-CGO compatibility path.TestToolBackedComponentQueritIntegrationandTestParseToolEnvelopeLosslessRejectsTrailingContentpassed.gofmtpassed for all changed Go files.git diff --checkpassed.build.sh --testnative-link path could not run on the local Apple Silicon host because the required x86/Linux native archives are unavailable; this is an environment limitation rather than a test failure.Scope
This PR adds only the Go runtime and Canvas adapter for the already implemented Querit integration. It does not change the Python/frontend parameter contract or other search tools.