Chatbot with structured output to drive forms for input #2074
-
I've been experimenting with Spring AI for a while now (latest M4) but I can't get right what I want to achieve. It might be that I'm expecting too much of Spring AI or the LLM? Or I lack understanding. My chatbot should perform a guided conversation with the user to gather a number of details. Here and there it should present a form. I've been using structured output and a field 'intent' to trigger showing some UI elements. What I don't get so far is how to keep track of the details provided by the user. Am I supposed to "read it back to the LLM' with every prompt/request in textual form? Does Spring AI help with that via a advisor? A pointer to an example would be helpful also. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Spring AI have builtin advisors that can help you with that. Check it out: https://docs.spring.io/spring-ai/reference/api/advisors.html |
Beta Was this translation helpful? Give feedback.
-
If you want to track the conversations with user, you can simply use a table to capture all the chat history and use an advisor to stuff the prompt with chat memory. To start with, you can use InMemoryChatMemory and understand the flow, and later switch to a DB based chatMemory. Something like this
This internally fetches conversations and stuffs your prompt with all the chats you had earlier to help LLM get context. |
Beta Was this translation helpful? Give feedback.
If you want to track the conversations with user, you can simply use a table to capture all the chat history and use an advisor to stuff the prompt with chat memory. To start with, you can use InMemoryChatMemory and understand the flow, and later switch to a DB based chatMemory.
Something like this
`