File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
spring-ai-docs/src/main/antora/modules/ROOT/pages/api Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,16 @@ You can configure existing advisors using the xref:api/chatclient.adoc#_advisor_
13
13
----
14
14
var chatClient = ChatClient.builder(chatModel)
15
15
.defaultAdvisors(
16
- new MessageChatMemoryAdvisor(chatMemory), // chat-memory advisor
17
- new QuestionAnswerAdvisor( vectorStore) // RAG advisor
16
+ MessageChatMemoryAdvisor.builder (chatMemory).build( ), // chat-memory advisor
17
+ QuestionAnswerAdvisor.builder(( vectorStore).builder() // RAG advisor
18
18
)
19
19
.build();
20
20
21
+ var conversationId = "678";
22
+
21
23
String response = this.chatClient.prompt()
22
- // Set advisor parameters at runtime
23
- .advisors(advisor -> advisor.param("chat_memory_conversation_id", "678")
24
- .param("chat_memory_response_size", 100))
24
+ // Set advisor parameters at runtime
25
+ .advisors(advisor -> advisor.param(ChatMemory.CONVERSATION_ID, conversationId))
25
26
.user(userText)
26
27
.call()
27
28
.content();
@@ -31,7 +32,8 @@ It is recommend to register the advisors at build time using builder's `defaultA
31
32
32
33
Advisors also participate in the Observability stack, so you can view metrics and traces related to their execution.
33
34
34
- xref:ROOT:api/retrieval-augmented-generation.adoc#_questionansweradvisor[Learn about Question Answer Advisor]
35
+ - xref:ROOT:api/retrieval-augmented-generation.adoc#_questionansweradvisor[Learn about Question Answer Advisor]
36
+ - xref:ROOT:api/chat-memory.adoc#_memory_in_chat_client[Learn about Chat Memory Advisor]
35
37
36
38
== Core Components
37
39
You can’t perform that action at this time.
0 commit comments