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

feat(azure-cosmosdb): add session context and retrieve all sessions for a user #7242

Merged
merged 6 commits into from
Dec 3, 2024

Conversation

sinedied
Copy link
Contributor

@sinedied sinedied commented Nov 22, 2024

  • Added generic context object saved along the session. This can be used for example to give a title or save any additional properties along with a session.
  • Added method to retrieve all sessions for a user (without the messages)
  • Update to latest CosmosDB SDK (had to fix a few types in vector search integrations)

@jacoblee93 Not directly related to the PR, but I've found some memory integration that uses RunnableWithMessageHistory like ours, and other using BufferMemory which one is the recommended approach? Thanks

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. auto:improvement Medium size change to existing code to handle new use-cases auto:question A specific question about the codebase, product, project, or how to use a feature labels Nov 22, 2024
Copy link

vercel bot commented Nov 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2024 10:39pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Dec 3, 2024 10:39pm

Copy link
Contributor

@aditishree1 aditishree1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should we add this in example or doc-comment to let the user know that they have the option to add context in input?

Otherwise, this PR LGTM.

@aditishree1
Copy link
Contributor

hey @sinedied, Jacob suggested to prefer RunnableWithMessageHistory.
#7057 (comment)

@sinedied
Copy link
Contributor Author

nit: Should we add this in example or doc-comment to let the user know that they have the option to add context in input?

Otherwise, this PR LGTM.

Good callout! I'll update the example with the new methods.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Nov 25, 2024
@sinedied
Copy link
Contributor Author

@aditishree1 I completed the code example with the new APIs usage.

I also had to fix a few types in the vector search integration due to the updated Cosmos SDK.

@jacoblee93
Copy link
Collaborator

which one is the recommended approach?

We have been leaning more and more on LangGraph as the memory abstraction of choice (you are defining a state with whatever keys you want) but if you need to stay in LangChain then RunnableWithMessageHistory

@jacoblee93 jacoblee93 changed the title azure-cosmosdb[minor]: add session context and retrieve all sessions for a user feat(azure-cosmosdb): add session context and retrieve all sessions for a user Nov 25, 2024
@jacoblee93 jacoblee93 added the question Further information is requested label Nov 25, 2024
@sinedied
Copy link
Contributor Author

@jacoblee93 @aditishree1 I've reworked how the helper methods works so it makes more sense, and fixed handling of existing context in a session.

@sinedied sinedied changed the title feat(azure-cosmosdb): add session context and retrieve all sessions for a user azure-cosmosdb[minor] add session context and retrieve all sessions for a user Dec 2, 2024
Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good

@dosubot dosubot bot added the lgtm PRs that are ready to be merged as-is label Dec 3, 2024
@jacoblee93 jacoblee93 removed the question Further information is requested label Dec 3, 2024
@jacoblee93 jacoblee93 changed the title azure-cosmosdb[minor] add session context and retrieve all sessions for a user feat(azure-cosmosdb): add session context and retrieve all sessions for a user Dec 3, 2024
@jacoblee93 jacoblee93 merged commit e8822ad into langchain-ai:main Dec 3, 2024
25 checks passed
syntaxsec pushed a commit to aks-456/langchainjs that referenced this pull request Dec 13, 2024
…or a user (langchain-ai#7242)

Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases auto:question A specific question about the codebase, product, project, or how to use a feature lgtm PRs that are ready to be merged as-is size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants