mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:40:44 +00:00
fix(search): share web search count schema limit
Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
MAX_SEARCH_COUNT,
|
||||
buildUnsupportedSearchFilterResponse,
|
||||
isoToPerplexityDate,
|
||||
normalizeToIsoDate,
|
||||
normalizeFreshness,
|
||||
} from "./web-search-provider-common.js";
|
||||
import { mergeScopedSearchConfig } from "./web-search-provider-config.js";
|
||||
import { createWebSearchTool } from "./web-search.js";
|
||||
|
||||
describe("web_search tool schema", () => {
|
||||
it("advertises the shared runtime count limit", () => {
|
||||
const tool = createWebSearchTool();
|
||||
const parameters = tool?.parameters as
|
||||
| { properties?: { count?: { maximum?: unknown } } }
|
||||
| undefined;
|
||||
|
||||
expect(parameters?.properties?.count?.maximum).toBe(MAX_SEARCH_COUNT);
|
||||
});
|
||||
});
|
||||
|
||||
describe("web_search freshness normalization", () => {
|
||||
it("accepts Brave shortcut values and maps for Perplexity", () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { RuntimeWebSearchMetadata } from "../../secrets/runtime-web-tools.t
|
||||
import { resolveWebSearchProviderId, runWebSearch } from "../../web-search/runtime.js";
|
||||
import type { AnyAgentTool } from "./common.js";
|
||||
import { asToolParamsRecord, jsonResult } from "./common.js";
|
||||
import { SEARCH_CACHE } from "./web-search-provider-common.js";
|
||||
import { MAX_SEARCH_COUNT, SEARCH_CACHE } from "./web-search-provider-common.js";
|
||||
|
||||
const WebSearchSchema = {
|
||||
type: "object",
|
||||
@@ -14,7 +14,7 @@ const WebSearchSchema = {
|
||||
type: "number",
|
||||
description: "Number of results to return.",
|
||||
minimum: 1,
|
||||
maximum: 20,
|
||||
maximum: MAX_SEARCH_COUNT,
|
||||
},
|
||||
country: {
|
||||
type: "string",
|
||||
|
||||
Reference in New Issue
Block a user