File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ pub(crate) const SEARCH_TOOL_NAME: &str = "search_the_web";
2222pub ( crate ) const EXTRACT_TOOL_NAME : & str = "website_content_extractor" ;
2323
2424const 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.
2626If the user wants up-to-date information or you want to retrieve new information, call this tool.
2727If you call this tool, then you MUST complete your answer using the output.
2828The 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.
4545If the user wants information about a specific site or you want to extract the content of a specific site, call this tool.
4646The input must be a URL.
4747Additionally, if you have any questions that require a follow-up, you can call this tool repeatedly.
You can’t perform that action at this time.
0 commit comments