Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve message data model #24

Open
mieslep opened this issue Apr 23, 2024 · 0 comments
Open

improve message data model #24

mieslep opened this issue Apr 23, 2024 · 0 comments

Comments

@mieslep
Copy link
Collaborator

mieslep commented Apr 23, 2024

https://github.com/langchain-ai/langchain-datastax/blob/main/libs/astradb/langchain_astradb/chat_message_histories.py

creates a new Document per message, and searches are based on

            filter={
                "session_id": self.session_id,
            },

However, this not terribly efficient once we start getting into 10s or 100s of messages in history: many documents need to be returned and then ordered.

Alternate data models could include:

  1. Maintaining a list of Message within a single document where the key is the conversation ID
  2. Use CassandraChatMessageHistory https://python.langchain.com/docs/integrations/memory/cassandra_chat_message_history/ which stores within a standard Cassandra table that has the conversation ID as the partition key; the Cassandra libraries do have some intelligence around maintaining connections so it does not require a new connection per interaction, and the library correctly supports token/endpoint connection paradigm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant