Skip to content

Commit 5542a32

Browse files
committed
Reinject descriptions
1 parent b5a207e commit 5542a32

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

mistralrs-core/src/engine/search_request.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,15 @@ async fn do_search(
199199
message.insert("role".to_string(), Either::Left("tool".to_string()));
200200
message.insert(
201201
"content".to_string(),
202-
Either::Left(format!("{{\"output\": \"{tool_result}\"}}")),
202+
Either::Left(
203+
// Format the tool output JSON and append the search tool description for context
204+
format!(
205+
"{{\"output\": \"{}\"}}\n\n{}\n\n{}",
206+
tool_result,
207+
search::SEARCH_DESCRIPTION,
208+
search::EXTRACT_DESCRIPTION,
209+
),
210+
),
203211
);
204212
messages.push(message);
205213
}

mistralrs-core/src/search/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub(crate) const SEARCH_TOOL_NAME: &str = "search_the_web";
2222
pub(crate) const EXTRACT_TOOL_NAME: &str = "website_content_extractor";
2323

2424
const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
25-
const SEARCH_DESCRIPTION: &str = r#"This tool is used to search the web given a query.
25+
pub(crate) const SEARCH_DESCRIPTION: &str = r#"This tool is used to search the web given a query.
2626
If the user wants up-to-date information or you want to retrieve new information, call this tool.
2727
If you call this tool, then you MUST complete your answer using the output.
2828
The input can be a query. It should not be a URL. Either is fine.
@@ -41,7 +41,7 @@ You should expect output like this:
4141
]
4242
}
4343
"#;
44-
const EXTRACT_DESCRIPTION: &str = r#"This tool is used to extract the content of a website.
44+
pub(crate) const EXTRACT_DESCRIPTION: &str = r#"This tool is used to extract the content of a website.
4545
If the user wants information about a specific site or you want to extract the content of a specific site, call this tool.
4646
The input must be a URL.
4747
Additionally, if you have any questions that require a follow-up, you can call this tool repeatedly.

0 commit comments

Comments
 (0)