Skip to content

Commit b9199d7

Browse files
committed
Make the web-search example more reliable in answering questions related to today's date
1 parent 4fe7711 commit b9199d7

File tree

1 file changed

+8
-0
lines changed
  • samples/chatbot-web-search/src/main/java/io/quarkiverse/langchain4j/sample/chatbot

1 file changed

+8
-0
lines changed

samples/chatbot-web-search/src/main/java/io/quarkiverse/langchain4j/sample/chatbot/Bot.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkiverse.langchain4j.sample.chatbot;
22

3+
import dev.langchain4j.service.SystemMessage;
34
import dev.langchain4j.service.UserMessage;
45
import dev.langchain4j.web.search.WebSearchTool;
56
import io.quarkiverse.langchain4j.RegisterAiService;
@@ -9,6 +10,13 @@
910
@SessionScoped
1011
public interface Bot {
1112

13+
@SystemMessage("""
14+
You have access to a function that looks up data using the Tavily web search engine.
15+
The web search engine doesn't understand the concept of 'today',
16+
so if the user asks something
17+
that requires the knowledge of today's date, use the getTodaysDate function before
18+
calling the search engine.
19+
""")
1220
String chat(@UserMessage String question);
1321

1422
}

0 commit comments

Comments
 (0)