Skip to content

Commit bdb0dc7

Browse files
authored
Merge pull request #111 from OpenAgentPlatform/host
feat: make model verify token shorter
2 parents a8c276b + bd4e92e commit bdb0dc7

File tree

3 files changed

+16
-36
lines changed

3 files changed

+16
-36
lines changed

Diff for: services/prompt/system.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export const systemPrompt = (customRules: string) => {
1010
- Always check and comply with User_Defined_Rules first before applying any other rules or guidelines
1111
1212
I will strictly follow these directives and rules in the following XML tags:
13-
- <User_Defined_Rules> (HIGHEST PRIORITY)
14-
- <Core_Guidelines>
15-
- <System_Specific_Rules>
13+
- User_Defined_Rules (HIGHEST PRIORITY)
14+
- Core_Guidelines
15+
- System_Specific_Rules
1616
1717
<User_Defined_Rules>
1818
${customRules}

Diff for: services/routes/modelVerify.ts

+3-26
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ModelVerificationService {
5656
let fullResponse = "";
5757
let hasGenToolCall = false;
5858

59-
for await (const chunk of await model.stream("Use the web_search tool to search for 'iphone16'", {
59+
for await (const chunk of await model.stream("Use [web_search] tool to search 'iphone16'", {
6060
tools: testTools,
6161
signal,
6262
})) {
@@ -97,7 +97,7 @@ class ModelVerificationService {
9797
const model = await initChatModel(modelName, {
9898
...settings,
9999
baseUrl,
100-
max_tokens: 5,
100+
max_tokens: 100,
101101
});
102102

103103
const modelResult: ModelVerificationResult = {
@@ -236,37 +236,14 @@ const testTools = [
236236
function: {
237237
name: "web_search",
238238
description:
239-
"Performs a web search using SearXNG, ideal for general queries, news, articles and online content. Supports multiple search categories, languages, time ranges and safe search filtering. Returns relevant results from multiple search engines combined.",
239+
"Web search",
240240
parameters: {
241241
type: "object",
242242
properties: {
243243
query: {
244244
type: "string",
245245
description: "Search query",
246246
},
247-
page: {
248-
type: "number",
249-
description: "Page number (default 1)",
250-
},
251-
language: {
252-
type: "string",
253-
description: "Search language code (e.g. 'en', 'zh', 'jp', 'all')",
254-
},
255-
categories: {
256-
type: "array",
257-
items: {
258-
type: "string",
259-
enum: ["general", "news", "science", "files", "images", "videos", "music", "social media", "it"],
260-
},
261-
},
262-
time_range: {
263-
type: "string",
264-
enum: ["none", "day", "week", "month", "year"],
265-
},
266-
safesearch: {
267-
type: "number",
268-
description: "0: None, 1: Moderate, 2: Strict",
269-
},
270247
},
271248
required: ["query"],
272249
additionalProperties: false,

Diff for: services/webServer.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -305,23 +305,26 @@ export class WebServer {
305305
const model = await initChatModel(modelName, {
306306
...(modelSettings as ModelSettings),
307307
baseUrl,
308-
max_tokens: 5,
308+
max_tokens: 100,
309309
});
310310

311311
const testTools = [
312312
{
313313
type: "function",
314314
function: {
315-
name: "test",
316-
description: "meaningless tool",
315+
name: "web_search",
316+
description:
317+
"Web search",
317318
parameters: {
318319
type: "object",
319320
properties: {
320-
url: { description: "test" },
321+
query: {
322+
type: "string",
323+
description: "Search query",
324+
}
321325
},
322-
required: ["url"],
326+
required: ["query"],
323327
additionalProperties: false,
324-
title: "test",
325328
},
326329
},
327330
},
@@ -348,7 +351,7 @@ export class WebServer {
348351

349352
// check if support tools
350353
try {
351-
const result = await model.invoke("Only return 'Hi' strictly", {
354+
const result = await model.invoke("Use [web_search] tool to search 'iphone16'", {
352355
tools: testTools,
353356
});
354357
supportTools = true;

0 commit comments

Comments
 (0)