Skip to content

chat memory and conversation id #2997

Closed Answered by markpollack
hstaudacher asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry, we need to document this better. Here is some example code that shows how to do it.

https://github.com/ThomasVitale/llm-apps-java-spring-ai/blob/main/patterns/memory/memory-jdbc/src/main/java/com/thomasvitale/ai/spring/MemoryController.java

@RestController
class MemoryController {

    private final ChatClient chatClient;

    MemoryController(ChatClient.Builder chatClientBuilder, ChatMemory chatMemory) {
        this.chatClient = chatClientBuilder.clone()
                .defaultAdvisors(new MessageChatMemoryAdvisor(chatMemory))
                .build();
    }

    @PostMapping("/memory/jdbc/{conversationId}")
    String chat(@PathVariable String conversationId, @RequestBody Strin…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hstaudacher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants