Skip to content

Building chat bots: How to save a Conversation for later use? #437

Answered by andreibondarev
onerinas asked this question in Q&A
Discussion options

You must be logged in to vote

@onerinas You'd instantiate a Langchain::Thread and pass the messages to it here: https://github.com/andreibondarev/langchainrb/pull/422/files#diff-6ec65bec0259e981b815da287e8340a8d0241372cd5efd973887db9786d8453eR8

thread = Langchain::Thread.new messages: old_messages
assistant = Langchain::Assistant.new thread: thread, ...

Keep in mind that the thread.messages also contain tool information and tool calls and outputs from tools. All of this will be needed to rebuild the full conversation history.

Would that work for you?

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@onerinas
Comment options

@andreibondarev
Comment options

@onerinas
Comment options

@andreibondarev
Comment options

Answer selected by onerinas
@onerinas
Comment options

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