-
Notifications
You must be signed in to change notification settings - Fork 271
feat(checkpoint-postgres): Add PostgresStore for LangGraph.js #1242
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
base: 0.4
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,87 @@ | |||
/* eslint-disable no-process-env */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've decided to group and split integration tests by tested module/functionality, as originally the file had over 1,5 k lines of code and would be harder to maintain
🦋 Changeset detectedLatest commit: b62ee3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Is there a chance this will be reviewed? Is there anyone I could mention? Perhaps @dqbd |
Hello! Thank you for the PR, will be reviewing thoroughly shortly. At first glance I think we want to have this implementation in the same package as the checkpointer |
2abafe9
to
116fc46
Compare
Awesome, thank you for applying changes, lmk if there's anything I should work on/adjust :) |
constructor(private core: DatabaseCore) {} | ||
|
||
async initialize(): Promise<void> { | ||
await this.core.withClient(async (client) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth adding a migration mechanism similar to the postgres checkpointer?
updated_at, | ||
CASE | ||
WHEN $2::text IS NOT NULL THEN | ||
ts_rank(to_tsvector('english', value::text), plainto_tsquery('english', $2::text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth making this configurable?
/** | ||
* Close all database connections. | ||
*/ | ||
async end(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we consolidate end()
with stop()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, we need to make start()
and stop()
potentially async as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, technically the BasteStore
interface requires these methods to be synchronous. I'll apply the changes, but from what I can see, to maintain cohesion, I will:
- make
start
/stop
asynchronous inBaseStore
- I'll make
PregelLoop.initialize()
andPregelLoop.tick()
methods await thestore.start()
- make all other concrete implementations use async
start
/stop
Implement PostgreSQL Store with Vector Search Capabilities
Overview
This PR implements a PostgreSQL-based store for LangGraph.js inspired by #887 and Python implementation. The implementation includes comprehensive vector similarity search, hybrid search (combining vector and text search), and TTL management for automatic data expiration.
Key Features
Implementation Details
database-core.js
: Core connection and transaction managementdatabase-setup.js
: Schema initialization and migrationcrud-operations.js
: Basic CRUD operationssearch-operations.js
: Advanced search capabilitiesvector-operations.js
: Vector embedding and similarity calculationsttl-manager.js
: Expiration and cleanup managementquery-builder.js
: SQL query construction