Commit Graph

2771 Commits

Author SHA1 Message Date
Nuno Campos 5afa2f1832 Implement interruptAfter and interruptBefore
- moar types
2024-05-15 18:02:41 -07:00
Nuno Campos 69e754b6a8 Merge pull request #139 from langchain-ai/nc/14may/conditional-entry
Support conditional edge from START node
2024-05-15 18:02:02 -07:00
Nuno Campos afd81cda7e Merge pull request #146 from langchain-ai/nc/15may/branch-then
Add conditional edge "then" arg
2024-05-15 16:55:59 -07:00
Nuno Campos 8ea764f57f Lint 2024-05-15 16:49:57 -07:00
Nuno Campos c6f86e191d Add conditional edge "then" arg
- fix serialization of named barrier value
- fix serialization of topic channel
2024-05-15 16:49:24 -07:00
Nuno Campos 589d0da083 Merge pull request #145 from langchain-ai/nfcampos-patch-1
Run Node.js 22 in CI
2024-05-15 13:08:23 -07:00
Nuno Campos f31bed138f Run Node.js 22 in CI 2024-05-15 13:05:11 -07:00
Nuno Campos 514d09b155 Merge pull request #142 from langchain-ai/nc/15may/checkpoint-id
Rename thread_ts to checkpoint_id
2024-05-15 13:03:51 -07:00
Nuno Campos 988b66a88d Merge pull request #144 from langchain-ai/nc/15may/checkpoint-id-uuid6
Use uuid6 for checkpoint id
2024-05-15 13:02:17 -07:00
Nuno Campos 635f5c6d74 Compat w node 18 2024-05-15 13:00:34 -07:00
Nuno Campos 3da0996f45 Use uuid6 for checkpoint id 2024-05-15 11:39:13 -07:00
William FH e5d03a84a4 Fixup npm link (#143) 2024-05-15 10:54:03 -07:00
Nuno Campos c93b41bef0 Rename thread_ts to checkpoint_id
- Also rework any objects that will be saved in db / server over api to use snake_case keys (to match py)
2024-05-15 10:51:57 -07:00
William FH 958651af46 Update Footer (#141)
* Add shields

* fix imports

* python

* links
2024-05-14 19:15:28 -07:00
William FH ebd2e29387 Update ref + concept links (#137) 2024-05-14 17:37:51 -07:00
Nuno Campos 42ec420797 Support conditional edge from START node
- ie. conditional entrypoint
2024-05-14 17:33:39 -07:00
Nuno Campos 74c4a731d3 Lint 2024-05-14 17:17:29 -07:00
Nuno Campos 2d29b371e9 Merge pull request #138 from langchain-ai/nc/14may/checkpoint-inputs
Add checkpoint for input values
2024-05-14 17:13:08 -07:00
Nuno Campos 5bbfe96657 Add checkpoint for input values 2024-05-14 17:08:23 -07:00
Nuno Campos 6f3081e080 Merge pull request #135 from langchain-ai/nc/14may/errors-module
Move all errors to a single module, fix assertion of immutable checkp…
2024-05-14 17:05:52 -07:00
William FH 8b4b72daa0 Add Docs (Part 1) (#134) 2024-05-14 16:07:50 -07:00
Nuno Campos fa3da2fd4a Merge pull request #136 from langchain-ai/nc/14may/checkpoint-metadata
Implement checkpoint metadata
2024-05-14 15:32:54 -07:00
Nuno Campos fd1b21cfe1 Implement checkpoint metadata
- save checkpoints in background
- error checking in pregel class
- fix checkpoint lineage
- fix sqlite checkpointer setup
- fix sqlite checkpointer constructor
2024-05-14 15:23:08 -07:00
Nuno Campos 47ca628973 Move all errors to a single module, fix assertion of immutable checkpoints in tests 2024-05-14 15:17:40 -07:00
Nuno Campos 22c8faf86f Merge pull request #133 from langchain-ai/nc/13may/tool-node
Implement prebuilt ToolNode, toolCondition, MessagesState
2024-05-14 13:38:12 -07:00
Nuno Campos 54d62d7c0a Implement prebuilt ToolNode, toolCondition, MessagesState 2024-05-13 18:26:43 -07:00
Nuno Campos 38d2ad4275 Merge pull request #131 from langchain-ai/nc/13may/compiled-graph
Rewrite Graph.compile() to delegate to new CompiledGraph methods
2024-05-13 17:39:12 -07:00
Nuno Campos 5592c17e43 Rewrite StateGraph.compile and and MessageGraph.compile to delegate to new CompiledStateGraph methods (#132)
- enables more dynamic graphs in future
- implement stream_mode=updates
- fix extra options keys being passed to nodes
- fix stream_mode for invoke
- fix issue where writes array for each task wasn't used
2024-05-13 17:38:17 -07:00
Nuno Campos db1f5e024b Rewrite Graph.compile() to delegate to new CompiledGraph methods
- enables more dynamic graphs in the future
- enables conditional edges returning multiple destinations
2024-05-13 15:37:26 -07:00
Nuno Campos 27b30d29d7 Fix Checkpointer interface (#130)
* Fix Checkpointer interface

- Remove 2nd generic from Serializer
- Make Serializer interface more JS-y
- Remove CheckpointAt

* Fix

* Fix

* Update graph.ts
2024-05-13 15:36:11 -07:00
Nuno Campos fc3f52417d Fix setup to work in deno 2024-05-13 09:27:04 -07:00
Nuno Campos 6866c22db6 Pregel/Graph: Make channel creation explicit, make Pregel constructor type safe (#127)
* Pregel/Graph: Make channel creation explicit, make Pregel constructor type safe

- still need to migrate StateGraph

* Make type args const

* Add stricter typings for graph/stategraph/messagegraph constructors (#128)

* Add stricter typings for graph/stategraph/messagegraph constructors

Inspired by #112

* Fix tests

* Fix remaining types
2024-05-10 16:16:57 -07:00
Brace Sproul 5bf2797a7c minor: Bump TS to 5.4 (#129)
* minor: Bump TS to 5.4

* one more install
2024-05-10 13:18:40 -07:00
Andrew Nguonly b61c6aa79f Implement Pregel._default(). (#126) 2024-05-07 10:19:01 -07:00
Andrew Nguonly a37e19d8a2 Update static functions in pregel/index.ts to match corresponding Python implementation (#125)
* Implement _shouldInterrupt().

* Update _applyWrites(). Update checkpoint channel versions to max version + 1.

* Remove _applyWritesFromView().

* Update _prepareNextTasks() to support returning Array<PregelTaskDescription>.

* Update implementation of _prepareNextTasks() to match Python implementation.

* Remove side effect from _prepareNextTasks() and migrate clients. Add unit test for _prepareNextTasks().

* Update implementation of _prepareTasks() and PregelNode.pipe() simultaneously. These changes need to be made together.

* Implement _localRead().

* Migrate ChannelRead and ChannelWrite to extend from RunnableCallable.

* Update @langchain/core in order to use mergeConfigs().

* Implement streamChannelsList getter.

* Remove TODO comment.
2024-05-02 08:11:57 -07:00
Andrew Nguonly ff0af20416 Various updates to PregelNode and Pregel classes. Update validate.ts to match Python implementation. (#124)
* Implement Pregel types and update debug print methods.

* Rename ChannelInvoke to PregelNode. Remove  field. Update constructor arguments.

* Change type of PregelNodes.channels back to support string instead of string[].

* Update ChannelRead class.

* Update ChannelWrite.

* Update PregelNode pipe() function.

* Update mapInput() and readChannels() in io.ts.

* Add mapOutputValues() and mapOutputUpdates() to io.ts.

* Fix lint error.

* Remove when parameter from Channel.subscribeTo() function.

* Fix bug in readChannels(). Add unit tests for readChannel() and readChannels().

* Add unit tests for mapInput(), mapOutputValues(), mapOutputUpdates().

* Update _write() to match implementation in https://github.com/langchain-ai/langgraph/pull/345.

* Fix lint errors.

* Add (failing) unit test for invoking nested graph.

* Fix minor typing issues.

* Fix skipped unit test. Implement RunnableCallable to skip invocation of Runnable if it is defined in graph state.

* Update validateGraph(). Add unit tests.

* Update Channel.writeTo(). Remove reserved channels implementation.

* Update interface for Pregel class - remove 'hidden' and 'interrupt' APIs. Remove reserved channels functionality.

* Update Pregel constructor. Implement validate() method.

* Implement PregelNode.getWriters() and PregelNode.getNode().

* Change PregelNode.channels from Record<string, string | string to Record<string, string> | string[], i.e. support array of strings.

* Rename channelMappingOrString to channelMappingOrArray.
2024-04-30 13:20:13 -07:00
Andrew Nguonly 099fafa32a Update Pregel files to match Python implementation: debug.ts, io.ts, read.ts, types.ts, write.ts (#120) 2024-04-30 05:37:30 -07:00
Andrew Nguonly c27db2717e Implement serde, getTuple(), and list() in BaseCheckpointSaver (#119)
* Update BaseCheckpointSaver class  with getTuple() and list() functions.

* Fix bug when selecting max ts (string).

* Remove console.log().

* Fix bug in put(). Add unit tests.

* Fix format errors.

* Fix lint errors.

* Fix prettier format issues.

* Create NoopSerializer for MemorySaver checkpointer.

* Implement SqliteSaver.

* Implement put() and list() for SqliteSaver and add unit tests.

* Change default checkpoint configuration to END_OF_STEP.

* Refactor type casting for Row type and remove isSetup field.

* Add unit test for verifying parentTs in sqlite db.

* Change Sqlite schema to snake_case to match Python implementation.

* Fix race condition bug with SqliteSaver constructor.

* Implement generics for checkpoint saver and serde protocol.

* Fix type error in Graph classes.

* Require input type of serializer for checkpointers to be Checkpoint type.
2024-04-23 09:11:18 -07:00
Andrew Nguonly 79345a0678 Rename empty() to fromCheckpoint() to match LangGraph Python (#118)
* Rename empty() to fromCheckpoint(). Update update() implementations to exactly match Python implementations.

* Format tests.

* Deep copy Checkpoint data when creating new Checkpoint.

* Remove initialValueFactory from BaseChannel.

* Update createCheckpoint() to exclude values carried over from previous checkpoint.
2024-04-18 08:32:46 -07:00
Brace Sproul d86ce20de4 examples[patch]: Fix typing (#117) 2024-04-16 15:47:32 -07:00
Janvi Kalra 06fc50ff01 [Python Parity] Adds Waiting Edges Along with Additional Changes Needed to Make that Work (#97)
* add basic

* update

* update

* update

* this kinda works

* format everything

* update

* update

* Update state.ts

* Rename var

---------

Co-authored-by: Nuno Campos <nuno@boringbits.io>
Co-authored-by: Nuno Campos <nuno@langchain.dev>
2024-04-16 10:37:47 -07:00
William Berglund 9443333c51 Ensure Channel.subscribeTo(["input"], { key: "key" }) which throws at runtime is a type-error (#109) 2024-04-16 10:27:26 -07:00
Dmitry Til 11f7464544 fix: state graph new node validation (#114) 2024-04-16 10:25:30 -07:00
William Berglund 8628790bed Include Pragel PDF link in CONTRIBUTING.md (#110) 2024-04-10 17:59:43 -07:00
William Berglund 90fa8680b8 add vscode devcontainer (#108) 2024-04-10 17:59:32 -07:00
Jacob Lee d55f457182 Update customer support notebook (#106) 2024-03-27 15:03:06 -07:00
Jacob Lee 3996c22b97 Adds tool calling chatbot notebook (#105)
* Adds tool calling chatbot notebook

* Add customer support chatbot example
2024-03-27 14:55:14 -07:00
Jacob Lee 4bf1b05314 Merge pull request #103 from langchain-ai/release
Release 0.0.12
2024-03-26 20:44:48 -07:00
jacoblee93 162ce035f4 Release 0.0.12 0.0.12 2024-03-26 20:44:21 -07:00
Richard Moss 70b7c92296 Add diagram for agent executor example (#101) 2024-03-26 20:41:11 -07:00