mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Update langchain (main) (#205553)
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [@langchain/aws](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-aws/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`^0.1.2` -> `^0.1.3`](https://renovatebot.com/diffs/npm/@langchain%2faws/0.1.2/0.1.3) | | | [@langchain/community](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-community/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`0.3.14` -> `0.3.29`](https://renovatebot.com/diffs/npm/@langchain%2fcommunity/0.3.14/0.3.29) | `0.3.30` | | [@langchain/core](https://redirect.github.com/langchain-ai/langchainjs/tree/main/langchain-core/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | resolutions | patch | [`^0.3.16` -> `^0.3.39`](https://renovatebot.com/diffs/npm/@langchain%2fcore/0.3.16/0.3.39) | `0.3.40` | | [@langchain/core](https://redirect.github.com/langchain-ai/langchainjs/tree/main/langchain-core/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`^0.3.16` -> `^0.3.39`](https://renovatebot.com/diffs/npm/@langchain%2fcore/0.3.16/0.3.39) | `0.3.40` | | [@langchain/google-common](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-common/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | resolutions | patch | [`^0.1.1` -> `^0.1.8`](https://renovatebot.com/diffs/npm/@langchain%2fgoogle-common/0.1.1/0.1.8) | | | [@langchain/google-common](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-common/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`^0.1.1` -> `^0.1.8`](https://renovatebot.com/diffs/npm/@langchain%2fgoogle-common/0.1.1/0.1.8) | | | [@langchain/google-genai](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-genai/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`^0.1.2` -> `^0.1.8`](https://renovatebot.com/diffs/npm/@langchain%2fgoogle-genai/0.1.2/0.1.8) | | | [@langchain/google-vertexai](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-vertexai/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`^0.1.0` -> `^0.1.8`](https://renovatebot.com/diffs/npm/@langchain%2fgoogle-vertexai/0.1.0/0.1.8) | | | [@langchain/langgraph](https://redirect.github.com/langchain-ai/langgraphjs) | dependencies | patch | [`0.2.19` -> `0.2.45`](https://renovatebot.com/diffs/npm/@langchain%2flanggraph/0.2.19/0.2.45) | `0.2.46` | | [@langchain/openai](https://redirect.github.com/langchain-ai/langchainjs/tree/main/libs/langchain-openai/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | minor | [`^0.3.11` -> `^0.4.3`](https://renovatebot.com/diffs/npm/@langchain%2fopenai/0.3.11/0.4.3) | `0.4.4` | | [langchain](https://redirect.github.com/langchain-ai/langchainjs/tree/main/langchain/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | resolutions | patch | [`^0.3.5` -> `^0.3.15`](https://renovatebot.com/diffs/npm/langchain/0.3.5/0.3.15) | | | [langchain](https://redirect.github.com/langchain-ai/langchainjs/tree/main/langchain/) ([source](https://redirect.github.com/langchain-ai/langchainjs)) | dependencies | patch | [`^0.3.5` -> `^0.3.15`](https://renovatebot.com/diffs/npm/langchain/0.3.5/0.3.15) | | --- ### Release Notes <details> <summary>langchain-ai/langchainjs (@​langchain/aws)</summary> ### [`v0.1.3`](https://redirect.github.com/langchain-ai/langchainjs/releases/tag/0.1.3) [Compare Source](https://redirect.github.com/langchain-ai/langchainjs/compare/0.1.2...0.1.3) #### What's Changed - langchain\[patch]: Release 0.1.2 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3973](https://redirect.github.com/langchain-ai/langchainjs/pull/3973) - docs\[patch]: Refactor memory docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3974](https://redirect.github.com/langchain-ai/langchainjs/pull/3974) - docs\[patch]: Fix bad import in docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3980](https://redirect.github.com/langchain-ai/langchainjs/pull/3980) - core\[patch]: Adjust iterable readable stream typing by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3979](https://redirect.github.com/langchain-ai/langchainjs/pull/3979) - Update openai to ^4.24.2 and include logprobs in `generationInfo` by [@​functorism](https://redirect.github.com/functorism) in [https://github.com/langchain-ai/langchainjs/pull/3981](https://redirect.github.com/langchain-ai/langchainjs/pull/3981) - openai\[patch]: Release 0.0.11 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3986](https://redirect.github.com/langchain-ai/langchainjs/pull/3986) - cloudflare\[major]: Add integration package, fix Vectorize for latest workers by [@​kristianfreeman](https://redirect.github.com/kristianfreeman) in [https://github.com/langchain-ai/langchainjs/pull/3982](https://redirect.github.com/langchain-ai/langchainjs/pull/3982) - docs\[patch]: Add DLAI to tutorials in docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3994](https://redirect.github.com/langchain-ai/langchainjs/pull/3994) - allow empty arrays for Weaviate metadata by [@​the-powerpointer](https://redirect.github.com/the-powerpointer) in [https://github.com/langchain-ai/langchainjs/pull/3991](https://redirect.github.com/langchain-ai/langchainjs/pull/3991) - ci\[patch]: Fix CI by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4001](https://redirect.github.com/langchain-ai/langchainjs/pull/4001) - community\[minor]: Upgrade Astra client and add support for namespaces by [@​mfortman11](https://redirect.github.com/mfortman11) in [https://github.com/langchain-ai/langchainjs/pull/3997](https://redirect.github.com/langchain-ai/langchainjs/pull/3997) - community\[patch]: Add upsert by id to MongoDB by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/3999](https://redirect.github.com/langchain-ai/langchainjs/pull/3999) - community\[patch]: Release 0.0.17 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4002](https://redirect.github.com/langchain-ai/langchainjs/pull/4002) - docs\[minor]: togetherai embeddings docs by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langchainjs/pull/3995](https://redirect.github.com/langchain-ai/langchainjs/pull/3995) - Fix typo in createHistoryAwareRetriever documentation by [@​intergalacticmammoth](https://redirect.github.com/intergalacticmammoth) in [https://github.com/langchain-ai/langchainjs/pull/4016](https://redirect.github.com/langchain-ai/langchainjs/pull/4016) - Add stacktrace to tracer errors by [@​hinthornw](https://redirect.github.com/hinthornw) in [https://github.com/langchain-ai/langchainjs/pull/4010](https://redirect.github.com/langchain-ai/langchainjs/pull/4010) - update sql_utils: add oracle integration by [@​matheus-santos-souza](https://redirect.github.com/matheus-santos-souza) in [https://github.com/langchain-ai/langchainjs/pull/3966](https://redirect.github.com/langchain-ai/langchainjs/pull/3966) - core\[minor]: Move function calling definitions and utils to core by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4023](https://redirect.github.com/langchain-ai/langchainjs/pull/4023) - core\[patch]: Add docstring, small tweak by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4024](https://redirect.github.com/langchain-ai/langchainjs/pull/4024) - core\[patch]: Release 0.1.13 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4026](https://redirect.github.com/langchain-ai/langchainjs/pull/4026) - langchain\[patch], openai\[patch]: Use new function calling utils in all docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4025](https://redirect.github.com/langchain-ai/langchainjs/pull/4025) - openai\[patch]: Release 0.0.12 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4028](https://redirect.github.com/langchain-ai/langchainjs/pull/4028) - langchain\[patch]: Bump dep by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4029](https://redirect.github.com/langchain-ai/langchainjs/pull/4029) - langchain\[patch]: Update yarn.lock by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langchainjs/pull/4030](https://redirect.github.com/langchain-ai/langchainjs/pull/4030) #### New Contributors - [@​functorism](https://redirect.github.com/functorism) made their first contribution in [https://github.com/langchain-ai/langchainjs/pull/3981](https://redirect.github.com/langchain-ai/langchainjs/pull/3981) - [@​intergalacticmammoth](https://redirect.github.com/intergalacticmammoth) made their first contribution in [https://github.com/langchain-ai/langchainjs/pull/4016](https://redirect.github.com/langchain-ai/langchainjs/pull/4016) - [@​matheus-santos-souza](https://redirect.github.com/matheus-santos-souza) made their first contribution in [https://github.com/langchain-ai/langchainjs/pull/3966](https://redirect.github.com/langchain-ai/langchainjs/pull/3966) **Full Changelog**: https://github.com/langchain-ai/langchainjs/compare/0.1.2...0.1.3 </details> <details> <summary>langchain-ai/langgraphjs (@​langchain/langgraph)</summary> ### [`v0.2.45`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.45) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.44...0.2.45) #### What's Changed - release(langgraph): 0.2.44 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/829](https://redirect.github.com/langchain-ai/langgraphjs/pull/829) - Update README.md by [@​eyurtsev](https://redirect.github.com/eyurtsev) in [https://github.com/langchain-ai/langgraphjs/pull/831](https://redirect.github.com/langchain-ai/langgraphjs/pull/831) - ci: update upload-arfifact by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/832](https://redirect.github.com/langchain-ai/langgraphjs/pull/832) - docs: third party packages.yml by [@​eyurtsev](https://redirect.github.com/eyurtsev) in [https://github.com/langchain-ai/langgraphjs/pull/840](https://redirect.github.com/langchain-ai/langgraphjs/pull/840) - Update functional_api.md by [@​eyurtsev](https://redirect.github.com/eyurtsev) in [https://github.com/langchain-ai/langgraphjs/pull/833](https://redirect.github.com/langchain-ai/langgraphjs/pull/833) - fix(docs/etc): Fix miscellaneous typos by [@​nick-w-nick](https://redirect.github.com/nick-w-nick) in [https://github.com/langchain-ai/langgraphjs/pull/837](https://redirect.github.com/langchain-ai/langgraphjs/pull/837) - fix(docs): adjust list appearance in README by [@​ryukez](https://redirect.github.com/ryukez) in [https://github.com/langchain-ai/langgraphjs/pull/834](https://redirect.github.com/langchain-ai/langgraphjs/pull/834) - fix(docs): adjust list appearance in tutorials/quickstart by [@​ryukez](https://redirect.github.com/ryukez) in [https://github.com/langchain-ai/langgraphjs/pull/835](https://redirect.github.com/langchain-ai/langgraphjs/pull/835) - fix(docs): crag wrong tool invocation by [@​SeonMyungLim](https://redirect.github.com/SeonMyungLim) in [https://github.com/langchain-ai/langgraphjs/pull/836](https://redirect.github.com/langchain-ai/langgraphjs/pull/836) - Interrupt banner by [@​tanushree-sharma](https://redirect.github.com/tanushree-sharma) in [https://github.com/langchain-ai/langgraphjs/pull/842](https://redirect.github.com/langchain-ai/langgraphjs/pull/842) - Update plans.md by [@​eyurtsev](https://redirect.github.com/eyurtsev) in [https://github.com/langchain-ai/langgraphjs/pull/843](https://redirect.github.com/langchain-ai/langgraphjs/pull/843) - generate llms-text by [@​eyurtsev](https://redirect.github.com/eyurtsev) in [https://github.com/langchain-ai/langgraphjs/pull/844](https://redirect.github.com/langchain-ai/langgraphjs/pull/844) - ci: add llms-text by [@​eyurtsev](https://redirect.github.com/eyurtsev) in [https://github.com/langchain-ai/langgraphjs/pull/845](https://redirect.github.com/langchain-ai/langgraphjs/pull/845) - fix(langgraph): Dedupe input (right-side) messages in messageStateReducer by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/846](https://redirect.github.com/langchain-ai/langgraphjs/pull/846) - fix(langgraph): Update messagesStateReducer behavior to apply rightMessages in order by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/847](https://redirect.github.com/langchain-ai/langgraphjs/pull/847) #### New Contributors - [@​eyurtsev](https://redirect.github.com/eyurtsev) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/831](https://redirect.github.com/langchain-ai/langgraphjs/pull/831) - [@​nick-w-nick](https://redirect.github.com/nick-w-nick) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/837](https://redirect.github.com/langchain-ai/langgraphjs/pull/837) - [@​ryukez](https://redirect.github.com/ryukez) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/834](https://redirect.github.com/langchain-ai/langgraphjs/pull/834) - [@​SeonMyungLim](https://redirect.github.com/SeonMyungLim) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/836](https://redirect.github.com/langchain-ai/langgraphjs/pull/836) - [@​tanushree-sharma](https://redirect.github.com/tanushree-sharma) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/842](https://redirect.github.com/langchain-ai/langgraphjs/pull/842) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.44...0.2.45 ### [`v0.2.44`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.44) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.43...0.2.44) #### What's Changed - Release 0.2.43 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/821](https://redirect.github.com/langchain-ai/langgraphjs/pull/821) - docs: Optimize notebook by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/820](https://redirect.github.com/langchain-ai/langgraphjs/pull/820) - docs: update README by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/822](https://redirect.github.com/langchain-ai/langgraphjs/pull/822) - docs: small README update by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/823](https://redirect.github.com/langchain-ai/langgraphjs/pull/823) - chore: bump rollup from 4.32.0 to 4.32.1 in the npm_and_yarn group across 1 directory by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/langchain-ai/langgraphjs/pull/824](https://redirect.github.com/langchain-ai/langgraphjs/pull/824) - release(checkpoint): 0.0.15 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/825](https://redirect.github.com/langchain-ai/langgraphjs/pull/825) - chore(checkpoint-mongodb): release 0.0.5 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/826](https://redirect.github.com/langchain-ai/langgraphjs/pull/826) - release(langgraph-checkpoint-sqlite): 0.1.4 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/827](https://redirect.github.com/langchain-ai/langgraphjs/pull/827) - docs: update to AIMessage.tool_calls by [@​regchiu](https://redirect.github.com/regchiu) in [https://github.com/langchain-ai/langgraphjs/pull/784](https://redirect.github.com/langchain-ai/langgraphjs/pull/784) - release(langgraph-checkpoint-postgres): 0.0.3 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/828](https://redirect.github.com/langchain-ai/langgraphjs/pull/828) #### New Contributors - [@​regchiu](https://redirect.github.com/regchiu) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/784](https://redirect.github.com/langchain-ai/langgraphjs/pull/784) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.43...0.2.44 ### [`v0.2.43`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.43) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.42...0.2.43) #### What's Changed - Release 0.2.42 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/816](https://redirect.github.com/langchain-ai/langgraphjs/pull/816) - fix(func): expose input / output types in pregel to support studio by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/811](https://redirect.github.com/langchain-ai/langgraphjs/pull/811) - fix(langgraph): Export types for portability by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/819](https://redirect.github.com/langchain-ai/langgraphjs/pull/819) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.42...0.2.43 ### [`v0.2.42`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.42) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.41...0.2.42) #### What's Changed - Release 0.2.41 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/789](https://redirect.github.com/langchain-ai/langgraphjs/pull/789) - patch(langgraph): Refactor pregel loop to use new `PregelRunner` class, ported from python LangGraph. by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/791](https://redirect.github.com/langchain-ai/langgraphjs/pull/791) - add how-to guide on structured output prebuilt react agent by [@​isahers1](https://redirect.github.com/isahers1) in [https://github.com/langchain-ai/langgraphjs/pull/794](https://redirect.github.com/langchain-ai/langgraphjs/pull/794) - fix(langgraph): abort graph execution when config.signal is aborted by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/795](https://redirect.github.com/langchain-ai/langgraphjs/pull/795) - fix(langgraph): make sure the pregel loop aborts on cancellation by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/797](https://redirect.github.com/langchain-ai/langgraphjs/pull/797) - docs: update readme and landing page by [@​ccurme](https://redirect.github.com/ccurme) in [https://github.com/langchain-ai/langgraphjs/pull/802](https://redirect.github.com/langchain-ai/langgraphjs/pull/802) - docs: Update LangGraph.js READMEs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/804](https://redirect.github.com/langchain-ai/langgraphjs/pull/804) - docs: fix a broken link by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/808](https://redirect.github.com/langchain-ai/langgraphjs/pull/808) - docs: Update docs for functional API by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/809](https://redirect.github.com/langchain-ai/langgraphjs/pull/809) - feat(langgraph): functional API by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/793](https://redirect.github.com/langchain-ai/langgraphjs/pull/793) - docs: Pull LangGraph Cloud docs on build, update cloud and local server guides by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/813](https://redirect.github.com/langchain-ai/langgraphjs/pull/813) - feat: Allow checkpointer as an alias to createReactAgent by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/805](https://redirect.github.com/langchain-ai/langgraphjs/pull/805) - build(deps): bump the npm_and_yarn group across 1 directory with 2 updates by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/langchain-ai/langgraphjs/pull/806](https://redirect.github.com/langchain-ai/langgraphjs/pull/806) - docs: update concepts/howto for Command by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/800](https://redirect.github.com/langchain-ai/langgraphjs/pull/800) - fix task/entrypoint func type by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/814](https://redirect.github.com/langchain-ai/langgraphjs/pull/814) - release(checkpoint): 0.0.14 by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/815](https://redirect.github.com/langchain-ai/langgraphjs/pull/815) #### New Contributors - [@​ccurme](https://redirect.github.com/ccurme) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/802](https://redirect.github.com/langchain-ai/langgraphjs/pull/802) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.41...0.2.42 ### [`v0.2.41`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.41) [Compare Source](d650ea77e8
...0.2.41) #### What's Changed - Release 0.2.39 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/774](https://redirect.github.com/langchain-ai/langgraphjs/pull/774) - build(deps): bump the npm_and_yarn group across 2 directories with 2 updates by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/langchain-ai/langgraphjs/pull/771](https://redirect.github.com/langchain-ai/langgraphjs/pull/771) - feat(langgraph): Add interrupt schema to library by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/775](https://redirect.github.com/langchain-ai/langgraphjs/pull/775) - docs: update MULTIPLE_SUBGRAPHS troubleshooting by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/781](https://redirect.github.com/langchain-ai/langgraphjs/pull/781) - fix(io): update tuples are ignored by pregel io by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/776](https://redirect.github.com/langchain-ai/langgraphjs/pull/776) - release(langgraph): 0.2.40 by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/782](https://redirect.github.com/langchain-ai/langgraphjs/pull/782) - chore(langgraph): test errors thrown from conditional edges by [@​benjamincburns](https://redirect.github.com/benjamincburns) in [https://github.com/langchain-ai/langgraphjs/pull/783](https://redirect.github.com/langchain-ai/langgraphjs/pull/783) - feat(docs): add updated CLI command by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/785](https://redirect.github.com/langchain-ai/langgraphjs/pull/785) - docs: add up command for the JS CLI by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/786](https://redirect.github.com/langchain-ai/langgraphjs/pull/786) - fix(langgraph): add structured response format to prebuilt react agent by [@​isahers1](https://redirect.github.com/isahers1) in [https://github.com/langchain-ai/langgraphjs/pull/788](https://redirect.github.com/langchain-ai/langgraphjs/pull/788) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.39...0.2.41 ### [`v0.2.40`](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.39...d650ea77e8f8ca486d3dd753b2849d039d55a23e) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.39...d650ea77e8f8ca486d3dd753b2849d039d55a23e) ### [`v0.2.39`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.39) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.38...0.2.39) #### What's Changed - Release 0.2.38 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/770](https://redirect.github.com/langchain-ai/langgraphjs/pull/770) - fix(langgraph): Make streamMode updates yield a final interrupt event, values yield final values by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/773](https://redirect.github.com/langchain-ai/langgraphjs/pull/773) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.38...0.2.39 ### [`v0.2.38`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.38) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.37...0.2.38) #### What's Changed - release(langgraph): 0.2.37 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/767](https://redirect.github.com/langchain-ai/langgraphjs/pull/767) - fix(langgraph): Fix nostream tags behavior in stream mode messages by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/768](https://redirect.github.com/langchain-ai/langgraphjs/pull/768) - docs: Document the nostream tag for stream mode messages by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/769](https://redirect.github.com/langchain-ai/langgraphjs/pull/769) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.37...0.2.38 ### [`v0.2.37`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.37) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.36...0.2.37) #### What's Changed - Release 0.2.36 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/762](https://redirect.github.com/langchain-ai/langgraphjs/pull/762) - fix(langgraph): Serialize command objects passed as input into remote graph by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/766](https://redirect.github.com/langchain-ai/langgraphjs/pull/766) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.36...0.2.37 ### [`v0.2.36`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.36) [Compare Source](1a7d4cda69
...0.2.36) #### What's Changed - Release 0.2.34 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/746](https://redirect.github.com/langchain-ai/langgraphjs/pull/746) - docs: Add missing doc to index page by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/747](https://redirect.github.com/langchain-ai/langgraphjs/pull/747) - build(deps): bump the npm_and_yarn group across 2 directories with 2 updates by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/langchain-ai/langgraphjs/pull/751](https://redirect.github.com/langchain-ai/langgraphjs/pull/751) - fix(docs): Update how to index HITL by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/752](https://redirect.github.com/langchain-ai/langgraphjs/pull/752) - fix(pregel): interruptBefore and interruptAfter is ignored from `streamEvents` by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/756](https://redirect.github.com/langchain-ai/langgraphjs/pull/756) - release(langgraph): Bump to 0.2.35 by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/757](https://redirect.github.com/langchain-ai/langgraphjs/pull/757) - fix(langgraph): Fix behavior around array return values from nodes by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/760](https://redirect.github.com/langchain-ai/langgraphjs/pull/760) - fix(ci): Revert version bump by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/761](https://redirect.github.com/langchain-ai/langgraphjs/pull/761) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.34...0.2.36 ### [`v0.2.35`](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.34...1a7d4cda6967a57bb41762220c802119e52a89c6) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.34...1a7d4cda6967a57bb41762220c802119e52a89c6) ### [`v0.2.34`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.34) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.33...0.2.34) #### What's Changed - Release 0.2.33 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/742](https://redirect.github.com/langchain-ai/langgraphjs/pull/742) - fix(docs): Update HITL and add interrupt docs by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/738](https://redirect.github.com/langchain-ai/langgraphjs/pull/738) - fix(langgraph): Fix chat model streaming for streamMode messages by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/745](https://redirect.github.com/langchain-ai/langgraphjs/pull/745) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.31...0.2.34 ### [`v0.2.33`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.33) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.32...0.2.33) #### What's Changed - Release 0.2.32 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/736](https://redirect.github.com/langchain-ai/langgraphjs/pull/736) - feat(langgraph): Allow tools to return Commands and update graph state by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/740](https://redirect.github.com/langchain-ai/langgraphjs/pull/740) - feat(langgraph): Adds error page for unreachable nodes by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/741](https://redirect.github.com/langchain-ai/langgraphjs/pull/741) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.32...0.2.33 ### [`v0.2.32`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.32) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.31...0.2.32) #### What's Changed - Release 0.2.31 by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/733](https://redirect.github.com/langchain-ai/langgraphjs/pull/733) - fix(langgraph): Fix Command update behavior for static breakpoints by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/734](https://redirect.github.com/langchain-ai/langgraphjs/pull/734) - fix(langgraph): Fix state graph invoke typing by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/735](https://redirect.github.com/langchain-ai/langgraphjs/pull/735) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.31...0.2.32 ### [`v0.2.31`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.31) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.30...0.2.31) #### What's Changed - Release(langgraph): 0.2.30 by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/730](https://redirect.github.com/langchain-ai/langgraphjs/pull/730) - fix(langgraph): Put writes for special channels by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/732](https://redirect.github.com/langchain-ai/langgraphjs/pull/732) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.30...0.2.31 ### [`v0.2.30`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.30) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.29...0.2.30) #### What's Changed - docs: Add command docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/725](https://redirect.github.com/langchain-ai/langgraphjs/pull/725) - docs: update concept docs by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/726](https://redirect.github.com/langchain-ai/langgraphjs/pull/726) - docs: add handoffs by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/727](https://redirect.github.com/langchain-ai/langgraphjs/pull/727) - docs: Adds multi agent network docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/728](https://redirect.github.com/langchain-ai/langgraphjs/pull/728) - docs: add an FAQ note for command vs cond edge by [@​vbarda](https://redirect.github.com/vbarda) in [https://github.com/langchain-ai/langgraphjs/pull/729](https://redirect.github.com/langchain-ai/langgraphjs/pull/729) - fix(langgraph): Allow multiple interrupts per node by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/713](https://redirect.github.com/langchain-ai/langgraphjs/pull/713) - fix(docs): Update agent supervisor notebook by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/722](https://redirect.github.com/langchain-ai/langgraphjs/pull/722) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.26...0.2.30 ### [`v0.2.29`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.29) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.28...0.2.29) #### What's Changed - Release 0.2.28 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/721](https://redirect.github.com/langchain-ai/langgraphjs/pull/721) - docs: Fix typo by [@​rxyshww](https://redirect.github.com/rxyshww) in [https://github.com/langchain-ai/langgraphjs/pull/719](https://redirect.github.com/langchain-ai/langgraphjs/pull/719) - fix(langgraph): Fix validation and drawing for edgeless graphs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/723](https://redirect.github.com/langchain-ai/langgraphjs/pull/723) #### New Contributors - [@​rxyshww](https://redirect.github.com/rxyshww) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/719](https://redirect.github.com/langchain-ai/langgraphjs/pull/719) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.28...0.2.29 ### [`v0.2.28`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.28) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.27...0.2.28) #### What's Changed - release(langgraph): 0.2.27 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/716](https://redirect.github.com/langchain-ai/langgraphjs/pull/716) - fix(langgraph): Re-throw NodeInterrupt errors from ToolNode for HITL. by [@​jaredhanson](https://redirect.github.com/jaredhanson) in [https://github.com/langchain-ai/langgraphjs/pull/718](https://redirect.github.com/langchain-ai/langgraphjs/pull/718) - feat(langgraph): Edgeless graph support by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/717](https://redirect.github.com/langchain-ai/langgraphjs/pull/717) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.27...0.2.28 ### [`v0.2.27`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.27) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.26...0.2.27) #### What's Changed - Release 0.2.26 by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/709](https://redirect.github.com/langchain-ai/langgraphjs/pull/709) - Allow value of NodeInterrupt to be any (JSON-serializable) type. by [@​jaredhanson](https://redirect.github.com/jaredhanson) in [https://github.com/langchain-ai/langgraphjs/pull/710](https://redirect.github.com/langchain-ai/langgraphjs/pull/710) - fix: Allow updating state as node end by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/712](https://redirect.github.com/langchain-ai/langgraphjs/pull/712) - feat(prebuilt): Adds stateModifier param to createReactAgent by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/714](https://redirect.github.com/langchain-ai/langgraphjs/pull/714) - docs: Adds semantic search docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/715](https://redirect.github.com/langchain-ai/langgraphjs/pull/715) #### New Contributors - [@​jaredhanson](https://redirect.github.com/jaredhanson) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/710](https://redirect.github.com/langchain-ai/langgraphjs/pull/710) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.26...0.2.27 ### [`v0.2.26`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.26) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.25...0.2.26) #### What's Changed - fix(langgraph): Prevent non RunnableConfig keys from being passed by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/707](https://redirect.github.com/langchain-ai/langgraphjs/pull/707) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.25...0.2.26 ### [`v0.2.25`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.25) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.24...0.2.25) #### What's Changed - release(langgraph): 0.2.24 by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/699](https://redirect.github.com/langchain-ai/langgraphjs/pull/699) - InMem Search by [@​hinthornw](https://redirect.github.com/hinthornw) in [https://github.com/langchain-ai/langgraphjs/pull/700](https://redirect.github.com/langchain-ai/langgraphjs/pull/700) - fix(langgraph): Add test for invoking a single node by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/701](https://redirect.github.com/langchain-ai/langgraphjs/pull/701) - fix(debug): interrupts task result double tuple format by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/702](https://redirect.github.com/langchain-ai/langgraphjs/pull/702) - fix(interrupt): match signature of GraphInterrupt created in interrupt() by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/703](https://redirect.github.com/langchain-ai/langgraphjs/pull/703) - \[Checkpoint] Release 0.0.13 by [@​hinthornw](https://redirect.github.com/hinthornw) in [https://github.com/langchain-ai/langgraphjs/pull/704](https://redirect.github.com/langchain-ai/langgraphjs/pull/704) - feat(graph): passthrough input types to invoke/stream by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/650](https://redirect.github.com/langchain-ai/langgraphjs/pull/650) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.24...0.2.25 ### [`v0.2.24`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.24) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.23...0.2.24) #### What's Changed - Release 0.2.23 by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/693](https://redirect.github.com/langchain-ai/langgraphjs/pull/693) - fix(docs): use `messagesStateReducer` instead of `concat` to match Python by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/696](https://redirect.github.com/langchain-ai/langgraphjs/pull/696) - fix(langgraph): Add test for subgraph interrupts & resume with Command by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/698](https://redirect.github.com/langchain-ai/langgraphjs/pull/698) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.23...0.2.24 ### [`v0.2.23`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.23) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.22...0.2.23) #### What's Changed - Release 0.2.22 by [@​nfcampos](https://redirect.github.com/nfcampos) in [https://github.com/langchain-ai/langgraphjs/pull/682](https://redirect.github.com/langchain-ai/langgraphjs/pull/682) - build(deps): bump the npm_and_yarn group across 1 directory with 2 updates by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/langchain-ai/langgraphjs/pull/679](https://redirect.github.com/langchain-ai/langgraphjs/pull/679) - docs: Fix typo by [@​kostasx](https://redirect.github.com/kostasx) in [https://github.com/langchain-ai/langgraphjs/pull/683](https://redirect.github.com/langchain-ai/langgraphjs/pull/683) - fix(ci): Fix release script by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/685](https://redirect.github.com/langchain-ai/langgraphjs/pull/685) - fix(docs): added missing dependency in tutorial by adding [@​langchain/langgraph](https://redirect.github.com/langchain/langgraph) by [@​greysonthao](https://redirect.github.com/greysonthao) in [https://github.com/langchain-ai/langgraphjs/pull/688](https://redirect.github.com/langchain-ai/langgraphjs/pull/688) - Implement interrupt(...) and Command({resume: ...}) by [@​nfcampos](https://redirect.github.com/nfcampos) in [https://github.com/langchain-ai/langgraphjs/pull/690](https://redirect.github.com/langchain-ai/langgraphjs/pull/690) #### New Contributors - [@​kostasx](https://redirect.github.com/kostasx) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/683](https://redirect.github.com/langchain-ai/langgraphjs/pull/683) - [@​greysonthao](https://redirect.github.com/greysonthao) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/688](https://redirect.github.com/langchain-ai/langgraphjs/pull/688) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.22...0.2.23 ### [`v0.2.22`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.22) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.21...0.2.22) #### What's Changed - docs: Add breadcrumbs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/670](https://redirect.github.com/langchain-ai/langgraphjs/pull/670) - Add update state branch for copy by [@​nfcampos](https://redirect.github.com/nfcampos) in [https://github.com/langchain-ai/langgraphjs/pull/680](https://redirect.github.com/langchain-ai/langgraphjs/pull/680) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.21...0.2.22 ### [`v0.2.21`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.21) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.20...0.2.21) #### What's Changed - chore(langgraph): Release 0.2.20 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/654](https://redirect.github.com/langchain-ai/langgraphjs/pull/654) - feat(remote): upstream type casts from remote to SDK by [@​dqbd](https://redirect.github.com/dqbd) in [https://github.com/langchain-ai/langgraphjs/pull/656](https://redirect.github.com/langchain-ai/langgraphjs/pull/656) - docs: Fix headers and sidebar in custom streaming page by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/661](https://redirect.github.com/langchain-ai/langgraphjs/pull/661) - docs: Fix header and sidebar on stream tokens page by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/662](https://redirect.github.com/langchain-ai/langgraphjs/pull/662) - docs: Adds compatibility section to streaming docs by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/669](https://redirect.github.com/langchain-ai/langgraphjs/pull/669) - fix(docs): hierarchical agent teams ntbk by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/664](https://redirect.github.com/langchain-ai/langgraphjs/pull/664) - fix(docs): Update broken dynamic tool link by [@​rtuin](https://redirect.github.com/rtuin) in [https://github.com/langchain-ai/langgraphjs/pull/671](https://redirect.github.com/langchain-ai/langgraphjs/pull/671) - fix(langgraph): Fix recursionLimit passing via .withConfig by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/677](https://redirect.github.com/langchain-ai/langgraphjs/pull/677) - chore(langgraph): Release 0.2.21 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/678](https://redirect.github.com/langchain-ai/langgraphjs/pull/678) #### New Contributors - [@​rtuin](https://redirect.github.com/rtuin) made their first contribution in [https://github.com/langchain-ai/langgraphjs/pull/671](https://redirect.github.com/langchain-ai/langgraphjs/pull/671) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.20...0.2.21 ### [`v0.2.20`](https://redirect.github.com/langchain-ai/langgraphjs/releases/tag/0.2.20) [Compare Source](https://redirect.github.com/langchain-ai/langgraphjs/compare/0.2.19...0.2.20) #### What's Changed - chore(langgraph): Release 0.2.19 by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/644](https://redirect.github.com/langchain-ai/langgraphjs/pull/644) - docs: New cloud docs by [@​bracesproul](https://redirect.github.com/bracesproul) in [https://github.com/langchain-ai/langgraphjs/pull/642](https://redirect.github.com/langchain-ai/langgraphjs/pull/642) - docs: Update copy by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/645](https://redirect.github.com/langchain-ai/langgraphjs/pull/645) - Update link by [@​hinthornw](https://redirect.github.com/hinthornw) in [https://github.com/langchain-ai/langgraphjs/pull/646](https://redirect.github.com/langchain-ai/langgraphjs/pull/646) - fix(langgraph): Fix memory saver immutable assertion by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/649](https://redirect.github.com/langchain-ai/langgraphjs/pull/649) - fix(langgraph): Make graph nodes stream chunks immediately rather than aggregating by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/648](https://redirect.github.com/langchain-ai/langgraphjs/pull/648) - feat(langgraph): Add stream mode messages by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/651](https://redirect.github.com/langchain-ai/langgraphjs/pull/651) - fix(langgraph): Fix array stream_mode defaults by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/652](https://redirect.github.com/langchain-ai/langgraphjs/pull/652) - feat(langgraph): Adds custom streaming mode by [@​jacoblee93](https://redirect.github.com/jacoblee93) in [https://github.com/langchain-ai/langgraphjs/pull/653](https://redirect.github.com/langchain-ai/langgraphjs/pull/653) **Full Changelog**: https://github.com/langchain-ai/langgraphjs/compare/0.2.19...0.2.20 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJUZWFtOlNlY3VyaXR5IEdlbmVyYXRpdmUgQUkiLCJiYWNrcG9ydDphbGwtb3BlbiIsInJlbGVhc2Vfbm90ZTpza2lwIl19--> --------- Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kenneth Kreindler <kenneth.kreindler@elastic.co> Co-authored-by: Patryk Kopycinski <patryk.kopycinski@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Kenneth Kreindler <42113355+KDKHD@users.noreply.github.com>
This commit is contained in:
parent
2435a17cfe
commit
77cb914582
23 changed files with 1010 additions and 1102 deletions
47
package.json
47
package.json
|
@ -79,8 +79,8 @@
|
|||
"resolutions": {
|
||||
"**/@bazel/typescript/protobufjs": "6.11.4",
|
||||
"**/@hello-pangea/dnd": "16.6.0",
|
||||
"**/@langchain/core": "^0.3.16",
|
||||
"**/@langchain/google-common": "^0.1.1",
|
||||
"**/@langchain/core": "^0.3.40",
|
||||
"**/@langchain/google-common": "^0.1.8",
|
||||
"**/@types/node": "20.10.5",
|
||||
"**/@typescript-eslint/utils": "5.62.0",
|
||||
"**/chokidar": "^3.5.3",
|
||||
|
@ -88,10 +88,14 @@
|
|||
"**/globule/minimatch": "^3.1.2",
|
||||
"**/hoist-non-react-statics": "^3.3.2",
|
||||
"**/isomorphic-fetch/node-fetch": "^2.6.7",
|
||||
"**/langchain": "^0.3.5",
|
||||
"**/langchain": "^0.3.15",
|
||||
"**/remark-parse/trim": "1.0.1",
|
||||
"**/sharp": "0.32.6",
|
||||
"**/typescript": "5.1.6",
|
||||
"@aws-sdk/client-bedrock-agent-runtime": "^3.744.0",
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.744.0",
|
||||
"@aws-sdk/client-kendra": "3.744.0",
|
||||
"@aws-sdk/credential-provider-node": "3.744.0",
|
||||
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0",
|
||||
"@types/react": "~18.2.0",
|
||||
"@types/react-dom": "~18.2.0",
|
||||
|
@ -102,7 +106,7 @@
|
|||
"@appland/sql-parser": "^1.5.1",
|
||||
"@aws-crypto/sha256-js": "^5.2.0",
|
||||
"@aws-crypto/util": "^5.2.0",
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.687.0",
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.744.0",
|
||||
"@babel/runtime": "^7.24.7",
|
||||
"@dagrejs/dagre": "^1.1.4",
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
|
@ -142,7 +146,7 @@
|
|||
"@formatjs/intl-relativetimeformat": "^11.2.12",
|
||||
"@formatjs/intl-utils": "^3.8.4",
|
||||
"@formatjs/ts-transformer": "^3.13.14",
|
||||
"@google/generative-ai": "^0.7.0",
|
||||
"@google/generative-ai": "^0.21.0",
|
||||
"@grpc/grpc-js": "^1.8.22",
|
||||
"@hapi/accept": "^6.0.3",
|
||||
"@hapi/boom": "^10.0.1",
|
||||
|
@ -1021,14 +1025,14 @@
|
|||
"@kbn/xstate-utils": "link:src/platform/packages/shared/kbn-xstate-utils",
|
||||
"@kbn/zod": "link:src/platform/packages/shared/kbn-zod",
|
||||
"@kbn/zod-helpers": "link:src/platform/packages/shared/kbn-zod-helpers",
|
||||
"@langchain/aws": "^0.1.2",
|
||||
"@langchain/community": "0.3.14",
|
||||
"@langchain/core": "^0.3.16",
|
||||
"@langchain/google-common": "^0.1.1",
|
||||
"@langchain/google-genai": "^0.1.2",
|
||||
"@langchain/google-vertexai": "^0.1.0",
|
||||
"@langchain/langgraph": "0.2.19",
|
||||
"@langchain/openai": "^0.3.11",
|
||||
"@langchain/aws": "^0.1.3",
|
||||
"@langchain/community": "^0.3.29",
|
||||
"@langchain/core": "^0.3.40",
|
||||
"@langchain/google-common": "^0.1.8",
|
||||
"@langchain/google-genai": "^0.1.8",
|
||||
"@langchain/google-vertexai": "^0.1.8",
|
||||
"@langchain/langgraph": "^0.2.45",
|
||||
"@langchain/openai": "^0.4.4",
|
||||
"@langtrase/trace-attributes": "^7.5.0",
|
||||
"@launchdarkly/node-server-sdk": "^9.7.3",
|
||||
"@launchdarkly/openfeature-node-server": "^1.0.0",
|
||||
|
@ -1055,14 +1059,11 @@
|
|||
"@paralleldrive/cuid2": "^2.2.2",
|
||||
"@reduxjs/toolkit": "1.9.7",
|
||||
"@slack/webhook": "^7.0.1",
|
||||
"@smithy/eventstream-codec": "^3.1.10",
|
||||
"@smithy/eventstream-serde-node": "^3.0.12",
|
||||
"@smithy/middleware-stack": "^3.0.11",
|
||||
"@smithy/node-http-handler": "^3.3.3",
|
||||
"@smithy/protocol-http": "^4.1.7",
|
||||
"@smithy/signature-v4": "^4.2.3",
|
||||
"@smithy/types": "^3.7.1",
|
||||
"@smithy/util-utf8": "^3.0.0",
|
||||
"@smithy/eventstream-codec": "^4.0.1",
|
||||
"@smithy/eventstream-serde-node": "^4.0.1",
|
||||
"@smithy/middleware-stack": "^4.0.1",
|
||||
"@smithy/types": "^4.1.0",
|
||||
"@smithy/util-utf8": "^4.0.0",
|
||||
"@tanstack/react-query": "^4.29.12",
|
||||
"@tanstack/react-query-devtools": "^4.29.12",
|
||||
"@turf/along": "6.0.1",
|
||||
|
@ -1174,8 +1175,8 @@
|
|||
"jsonwebtoken": "^9.0.2",
|
||||
"jsts": "^1.6.2",
|
||||
"kea": "^2.6.0",
|
||||
"langchain": "^0.3.5",
|
||||
"langsmith": "^0.2.5",
|
||||
"langchain": "^0.3.15",
|
||||
"langsmith": "^0.3.7",
|
||||
"launchdarkly-js-client-sdk": "^3.5.0",
|
||||
"load-json-file": "^6.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
|
|
|
@ -123,8 +123,6 @@
|
|||
"@langtrase/trace-attributes",
|
||||
"@opentelemetry/sdk-trace-base",
|
||||
"@smithy/eventstream-serde-node",
|
||||
"@smithy/protocol-http",
|
||||
"@smithy/signature-v4",
|
||||
"@smithy/types",
|
||||
"@types/aws4",
|
||||
"ajv",
|
||||
|
@ -3737,67 +3735,15 @@
|
|||
"@langchain/google-genai",
|
||||
"@langchain/google-vertexai",
|
||||
"@langchain/langgraph",
|
||||
"@langchain/openai"
|
||||
],
|
||||
"reviewers": [
|
||||
"team:security-generative-ai"
|
||||
],
|
||||
"matchBaseBranches": [
|
||||
"main"
|
||||
],
|
||||
"labels": [
|
||||
"Team:Security Generative AI",
|
||||
"release_note:skip",
|
||||
"backport:all-open"
|
||||
],
|
||||
"minimumReleaseAge": "7 days",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"groupName": "@google/generative-ai",
|
||||
"matchDepNames": [
|
||||
"@google/generative-ai"
|
||||
],
|
||||
"reviewers": [
|
||||
"team:security-generative-ai"
|
||||
],
|
||||
"matchBaseBranches": [
|
||||
"main"
|
||||
],
|
||||
"labels": [
|
||||
"Team:Security Generative AI",
|
||||
"release_note:skip",
|
||||
"backport:all-open"
|
||||
],
|
||||
"minimumReleaseAge": "7 days",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"groupName": "@smithy",
|
||||
"matchDepNames": [
|
||||
"@langchain/openai",
|
||||
"@google/generative-ai",
|
||||
"@smithy/eventstream-codec",
|
||||
"@smithy/middleware-stack",
|
||||
"@smithy/node-http-handler",
|
||||
"@smithy/util-utf8"
|
||||
],
|
||||
"reviewers": [
|
||||
"team:security-generative-ai"
|
||||
],
|
||||
"matchBaseBranches": [
|
||||
"main"
|
||||
],
|
||||
"labels": [
|
||||
"Team:Security Generative AI",
|
||||
"release_note:skip",
|
||||
"backport:all-open"
|
||||
],
|
||||
"minimumReleaseAge": "7 days",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"groupName": "@aws-sdk/client-bedrock-runtime",
|
||||
"matchDepNames": [
|
||||
"@aws-sdk/client-bedrock-runtime"
|
||||
"@smithy/util-utf8",
|
||||
"@aws-sdk/client-bedrock-agent-runtime",
|
||||
"@aws-sdk/client-bedrock-runtime",
|
||||
"@aws-sdk/client-kendra",
|
||||
"@aws-sdk/credential-provider-node"
|
||||
],
|
||||
"reviewers": [
|
||||
"team:security-generative-ai"
|
||||
|
|
|
@ -90,12 +90,6 @@ export class ActionsClientChatOpenAI extends ChatOpenAI {
|
|||
streaming,
|
||||
// matters only for the LangSmith logs (Metadata > Invocation Params), which are misleading if this is not set
|
||||
modelName: model ?? DEFAULT_OPEN_AI_MODEL,
|
||||
// these have to be initialized, but are not actually used since we override the openai client with the actions client
|
||||
azureOpenAIApiKey: 'nothing',
|
||||
azureOpenAIApiDeploymentName: 'nothing',
|
||||
azureOpenAIApiInstanceName: 'nothing',
|
||||
azureOpenAIBasePath: 'nothing',
|
||||
azureOpenAIApiVersion: 'nothing',
|
||||
openAIApiKey: '',
|
||||
});
|
||||
this.#actionsClient = actionsClient;
|
||||
|
|
|
@ -140,6 +140,7 @@ const callOptions = {
|
|||
const handleLLMNewToken = jest.fn();
|
||||
const callRunManager = {
|
||||
handleLLMNewToken,
|
||||
handleCustomEvent: jest.fn().mockResolvedValue({}),
|
||||
} as unknown as CallbackManagerForLLMRun;
|
||||
const onFailedAttempt = jest.fn();
|
||||
const defaultArgs = {
|
||||
|
@ -149,6 +150,7 @@ const defaultArgs = {
|
|||
streaming: false,
|
||||
maxRetries: 0,
|
||||
onFailedAttempt,
|
||||
convertSystemMessageToHumanContent: false,
|
||||
};
|
||||
|
||||
const testMessage = 'Yes, your name is Andrew. How can I assist you further, Andrew?';
|
||||
|
@ -188,7 +190,6 @@ describe('ActionsClientChatVertexAI', () => {
|
|||
describe('_generate streaming: false', () => {
|
||||
it('returns the expected content when _generate is invoked', async () => {
|
||||
const actionsClientChatVertexAI = new ActionsClientChatVertexAI(defaultArgs);
|
||||
|
||||
const result = await actionsClientChatVertexAI._generate(
|
||||
callMessages,
|
||||
callOptions,
|
||||
|
@ -220,7 +221,7 @@ describe('ActionsClientChatVertexAI', () => {
|
|||
expect(onFailedAttempt).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('rejects with the expected error the message has invalid content', async () => {
|
||||
it('resolves to expected result when message has invalid content', async () => {
|
||||
actionsClient.execute.mockImplementation(
|
||||
jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
|
@ -235,7 +236,7 @@ describe('ActionsClientChatVertexAI', () => {
|
|||
|
||||
await expect(
|
||||
actionsClientChatVertexAI._generate(callMessages, callOptions, callRunManager)
|
||||
).rejects.toThrowError("Cannot read properties of undefined (reading 'text')");
|
||||
).resolves.toEqual({ generations: [], llmOutput: {} });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import { Readable } from 'stream';
|
|||
import { Logger } from '@kbn/logging';
|
||||
import { BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
||||
import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
||||
import { GeminiPartText } from '@langchain/google-common/dist/types';
|
||||
import { GeminiPartText, GeminiRequest } from '@langchain/google-common/dist/types';
|
||||
import type { TelemetryMetadata } from '@kbn/actions-plugin/server/lib';
|
||||
import {
|
||||
convertResponseBadFinishReasonToErrorMsg,
|
||||
|
@ -36,6 +36,7 @@ export interface CustomChatModelInput extends BaseChatModelParams {
|
|||
model?: string;
|
||||
maxTokens?: number;
|
||||
telemetryMetadata?: TelemetryMetadata;
|
||||
convertSystemMessageToHumanContent?: boolean;
|
||||
}
|
||||
|
||||
export class ActionsClientChatVertexAI extends ChatVertexAI {
|
||||
|
@ -56,7 +57,9 @@ export class ActionsClientChatVertexAI extends ChatVertexAI {
|
|||
this.#model = props.model;
|
||||
this.#actionsClient = actionsClient;
|
||||
this.#connectorId = connectorId;
|
||||
const client = this.buildClient(props);
|
||||
// apiKey is required to build the client but is overridden by the actionsClient
|
||||
const client = this.buildClient({ apiKey: 'nothing', ...props });
|
||||
|
||||
this.connection = new ActionsClientChatConnection(
|
||||
{
|
||||
...this,
|
||||
|
@ -80,7 +83,7 @@ export class ActionsClientChatVertexAI extends ChatVertexAI {
|
|||
runManager?: CallbackManagerForLLMRun
|
||||
): AsyncGenerator<ChatGenerationChunk> {
|
||||
const parameters = this.invocationParams(options);
|
||||
const data = await this.connection.formatData(messages, parameters);
|
||||
const data = (await this.connection.formatData(messages, parameters)) as GeminiRequest;
|
||||
const stream = await this.caller.callWithOptions({ signal: options?.signal }, async () => {
|
||||
const systemPart: GeminiPartText | undefined = data?.systemInstruction
|
||||
?.parts?.[0] as unknown as GeminiPartText;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import {
|
||||
ChatConnection,
|
||||
GeminiContent,
|
||||
GeminiRequest,
|
||||
GoogleAbstractedClient,
|
||||
GoogleAIBaseLLMInput,
|
||||
GoogleLLMResponse,
|
||||
|
@ -46,7 +47,7 @@ export class ActionsClientChatConnection<Auth> extends ChatConnection<Auth> {
|
|||
this.temperature = fields.temperature ?? 0;
|
||||
const nativeFormatData = this.formatData.bind(this);
|
||||
this.formatData = async (data, options) => {
|
||||
const result = await nativeFormatData(data, options);
|
||||
const result = (await nativeFormatData(data, options)) as GeminiRequest;
|
||||
if (result?.contents != null && result?.contents.length) {
|
||||
// ensure there are not 2 messages in a row from the same role,
|
||||
// if there are combine them
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
*/
|
||||
|
||||
import { BaseCallbackHandlerInput } from '@langchain/core/callbacks/base';
|
||||
import type { Run } from 'langsmith/schemas';
|
||||
import { BaseTracer } from '@langchain/core/tracers/base';
|
||||
import { BaseTracer, Run } from '@langchain/core/tracers/base';
|
||||
import agent from 'elastic-apm-node';
|
||||
import type { Logger } from '@kbn/core/server';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { BaseCallbackHandlerInput } from '@langchain/core/callbacks/base';
|
||||
import type { Run } from 'langsmith/schemas';
|
||||
import { Run } from 'langsmith/schemas';
|
||||
import { BaseTracer } from '@langchain/core/tracers/base';
|
||||
import { AnalyticsServiceSetup, Logger } from '@kbn/core/server';
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ describe('geminiAdapter', () => {
|
|||
name: 'myFunction',
|
||||
parameters: {
|
||||
properties: {},
|
||||
type: 'OBJECT',
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -128,11 +128,11 @@ describe('geminiAdapter', () => {
|
|||
foo: {
|
||||
description: 'foo',
|
||||
enum: undefined,
|
||||
type: 'STRING',
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
required: ['foo'],
|
||||
type: 'OBJECT',
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -110,7 +110,7 @@ function toolsToGemini(tools: ToolOptions['tools']): Gemini.Tool[] {
|
|||
parameters: schema
|
||||
? toolSchemaToGemini({ schema })
|
||||
: {
|
||||
type: Gemini.FunctionDeclarationSchemaType.OBJECT,
|
||||
type: Gemini.SchemaType.OBJECT,
|
||||
properties: {},
|
||||
},
|
||||
};
|
||||
|
@ -130,13 +130,13 @@ function toolSchemaToGemini({ schema }: { schema: ToolSchema }): Gemini.Function
|
|||
switch (def.type) {
|
||||
case 'array':
|
||||
return {
|
||||
type: Gemini.FunctionDeclarationSchemaType.ARRAY,
|
||||
type: Gemini.SchemaType.ARRAY,
|
||||
description: def.description,
|
||||
items: convertSchemaType({ def: def.items }) as Gemini.FunctionDeclarationSchema,
|
||||
};
|
||||
case 'object':
|
||||
return {
|
||||
type: Gemini.FunctionDeclarationSchemaType.OBJECT,
|
||||
type: Gemini.SchemaType.OBJECT,
|
||||
description: def.description,
|
||||
required: def.required as string[],
|
||||
properties: def.properties
|
||||
|
@ -152,19 +152,19 @@ function toolSchemaToGemini({ schema }: { schema: ToolSchema }): Gemini.Function
|
|||
};
|
||||
case 'string':
|
||||
return {
|
||||
type: Gemini.FunctionDeclarationSchemaType.STRING,
|
||||
type: Gemini.SchemaType.STRING,
|
||||
description: def.description,
|
||||
enum: def.enum ? (def.enum as string[]) : def.const ? [def.const] : undefined,
|
||||
};
|
||||
case 'boolean':
|
||||
return {
|
||||
type: Gemini.FunctionDeclarationSchemaType.BOOLEAN,
|
||||
type: Gemini.SchemaType.BOOLEAN,
|
||||
description: def.description,
|
||||
enum: def.enum ? (def.enum as string[]) : def.const ? [def.const] : undefined,
|
||||
};
|
||||
case 'number':
|
||||
return {
|
||||
type: Gemini.FunctionDeclarationSchemaType.NUMBER,
|
||||
type: Gemini.SchemaType.NUMBER,
|
||||
description: def.description,
|
||||
enum: def.enum ? (def.enum as string[]) : def.const ? [def.const] : undefined,
|
||||
};
|
||||
|
@ -172,7 +172,7 @@ function toolSchemaToGemini({ schema }: { schema: ToolSchema }): Gemini.Function
|
|||
};
|
||||
|
||||
return {
|
||||
type: Gemini.FunctionDeclarationSchemaType.OBJECT,
|
||||
type: Gemini.SchemaType.OBJECT,
|
||||
required: schema.required as string[],
|
||||
properties: Object.entries(schema.properties ?? {}).reduce<
|
||||
Record<string, Gemini.FunctionDeclarationSchemaProperty>
|
||||
|
|
|
@ -9,7 +9,6 @@ import { ElasticsearchClient, Logger } from '@kbn/core/server';
|
|||
import { Replacements } from '@kbn/elastic-assistant-common';
|
||||
import { AnonymizationFieldResponse } from '@kbn/elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.gen';
|
||||
import type { ActionsClientLlm } from '@kbn/langchain/server';
|
||||
import type { CompiledStateGraph } from '@langchain/langgraph';
|
||||
import { END, START, StateGraph } from '@langchain/langgraph';
|
||||
|
||||
import { CombinedPrompts } from './nodes/helpers/prompts';
|
||||
|
@ -18,11 +17,10 @@ import { getGenerateOrEndEdge } from './edges/generate_or_end';
|
|||
import { getGenerateOrRefineOrEndEdge } from './edges/generate_or_refine_or_end';
|
||||
import { getRefineOrEndEdge } from './edges/refine_or_end';
|
||||
import { getRetrieveAnonymizedAlertsOrGenerateEdge } from './edges/retrieve_anonymized_alerts_or_generate';
|
||||
import { getDefaultGraphState } from './state';
|
||||
import { getDefaultGraphAnnotation } from './state';
|
||||
import { getGenerateNode } from './nodes/generate';
|
||||
import { getRefineNode } from './nodes/refine';
|
||||
import { getRetrieveAnonymizedAlertsNode } from './nodes/retriever';
|
||||
import type { GraphState } from './types';
|
||||
|
||||
export interface GetDefaultAttackDiscoveryGraphParams {
|
||||
alertsIndexPattern?: string;
|
||||
|
@ -61,13 +59,9 @@ export const getDefaultAttackDiscoveryGraph = ({
|
|||
replacements,
|
||||
size,
|
||||
start,
|
||||
}: GetDefaultAttackDiscoveryGraphParams): CompiledStateGraph<
|
||||
GraphState,
|
||||
Partial<GraphState>,
|
||||
'generate' | 'refine' | 'retrieve_anonymized_alerts' | '__start__'
|
||||
> => {
|
||||
}: GetDefaultAttackDiscoveryGraphParams) => {
|
||||
try {
|
||||
const graphState = getDefaultGraphState({ end, filter, prompts, start });
|
||||
const graphState = getDefaultGraphAnnotation({ end, filter, prompts, start });
|
||||
|
||||
// get nodes:
|
||||
const retrieveAnonymizedAlertsNode = getRetrieveAnonymizedAlertsNode({
|
||||
|
@ -103,7 +97,7 @@ export const getDefaultAttackDiscoveryGraph = ({
|
|||
getRetrieveAnonymizedAlertsOrGenerateEdge(logger);
|
||||
|
||||
// create the graph:
|
||||
const graph = new StateGraph<GraphState>({ channels: graphState })
|
||||
const graph = new StateGraph(graphState)
|
||||
.addNode(NodeType.RETRIEVE_ANONYMIZED_ALERTS_NODE, retrieveAnonymizedAlertsNode)
|
||||
.addNode(NodeType.GENERATE_NODE, generateNode)
|
||||
.addNode(NodeType.REFINE_NODE, refineNode)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { getDefaultGraphState } from '.';
|
||||
import { getDefaultGraphAnnotation } from '.';
|
||||
import {
|
||||
DEFAULT_MAX_GENERATION_ATTEMPTS,
|
||||
DEFAULT_MAX_HALLUCINATION_FAILURES,
|
||||
|
@ -26,118 +26,122 @@ const prompts = {
|
|||
};
|
||||
describe('getDefaultGraphState', () => {
|
||||
it('returns the expected default attackDiscoveries', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.attackDiscoveries?.default?.()).toBeNull();
|
||||
expect(graphAnnotation.spec.attackDiscoveries.value).toBeNull();
|
||||
});
|
||||
|
||||
it('returns the expected default attackDiscoveryPrompt', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.attackDiscoveryPrompt?.default?.()).toEqual(defaultAttackDiscoveryPrompt);
|
||||
expect(graphAnnotation.spec.attackDiscoveryPrompt.value).toEqual(defaultAttackDiscoveryPrompt);
|
||||
});
|
||||
|
||||
it('returns the expected default empty collection of anonymizedAlerts', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.anonymizedAlerts?.default?.()).toHaveLength(0);
|
||||
expect(graphAnnotation.spec.anonymizedAlerts.value).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('returns the expected default combinedGenerations state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.combinedGenerations?.default?.()).toBe('');
|
||||
expect(graphAnnotation.spec.combinedGenerations.value).toBe('');
|
||||
});
|
||||
|
||||
it('returns the expected default combinedRefinements state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.combinedRefinements?.default?.()).toBe('');
|
||||
expect(graphAnnotation.spec.combinedRefinements.value).toBe('');
|
||||
});
|
||||
|
||||
it('returns the expected default errors state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.errors?.default?.()).toHaveLength(0);
|
||||
expect(graphAnnotation.spec.errors.value).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('return the expected default generationAttempts state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.generationAttempts?.default?.()).toBe(0);
|
||||
expect(graphAnnotation.spec.generationAttempts.value).toBe(0);
|
||||
});
|
||||
|
||||
it('returns the expected default generations state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.generations?.default?.()).toHaveLength(0);
|
||||
expect(graphAnnotation.spec.generations.value).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('returns the expected default hallucinationFailures state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.hallucinationFailures?.default?.()).toBe(0);
|
||||
expect(graphAnnotation.spec.hallucinationFailures.value).toBe(0);
|
||||
});
|
||||
|
||||
it('returns the expected default refinePrompt state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.refinePrompt?.default?.()).toEqual(defaultRefinePrompt);
|
||||
expect(graphAnnotation.spec.refinePrompt.value).toEqual(defaultRefinePrompt);
|
||||
});
|
||||
|
||||
it('returns the expected default maxGenerationAttempts state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.maxGenerationAttempts?.default?.()).toBe(DEFAULT_MAX_GENERATION_ATTEMPTS);
|
||||
expect(graphAnnotation.spec.maxGenerationAttempts.value).toBe(DEFAULT_MAX_GENERATION_ATTEMPTS);
|
||||
});
|
||||
|
||||
it('returns the expected default maxHallucinationFailures state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
expect(state.maxHallucinationFailures?.default?.()).toBe(DEFAULT_MAX_HALLUCINATION_FAILURES);
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
expect(graphAnnotation.spec.maxHallucinationFailures.value).toBe(
|
||||
DEFAULT_MAX_HALLUCINATION_FAILURES
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the expected default maxRepeatedGenerations state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.maxRepeatedGenerations?.default?.()).toBe(DEFAULT_MAX_REPEATED_GENERATIONS);
|
||||
expect(graphAnnotation.spec.maxRepeatedGenerations.value).toBe(
|
||||
DEFAULT_MAX_REPEATED_GENERATIONS
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the expected default refinements state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.refinements?.default?.()).toHaveLength(0);
|
||||
expect(graphAnnotation.spec.refinements.value).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('returns the expected default replacements state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.replacements?.default?.()).toEqual({});
|
||||
expect(graphAnnotation.spec.replacements.value).toEqual({});
|
||||
});
|
||||
|
||||
it('returns the expected default unrefinedResults state', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.unrefinedResults?.default?.()).toBeNull();
|
||||
expect(graphAnnotation.spec.unrefinedResults.value).toBeNull();
|
||||
});
|
||||
|
||||
it('returns the expected default end', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.end?.default?.()).toBeUndefined();
|
||||
expect(graphAnnotation.spec.end.value).toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns the expected end when it is provided', () => {
|
||||
const end = '2025-01-02T00:00:00.000Z';
|
||||
|
||||
const state = getDefaultGraphState({ prompts, end });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts, end });
|
||||
|
||||
expect(state.end?.default?.()).toEqual(end);
|
||||
expect(graphAnnotation.spec.end.value).toEqual(end);
|
||||
});
|
||||
|
||||
it('returns the expected default filter to be undefined', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.filter?.default?.()).toBeUndefined();
|
||||
expect(graphAnnotation.spec.filter.value).toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns the expected filter when it is provided', () => {
|
||||
|
@ -162,22 +166,22 @@ describe('getDefaultGraphState', () => {
|
|||
},
|
||||
};
|
||||
|
||||
const state = getDefaultGraphState({ prompts, filter });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts, filter });
|
||||
|
||||
expect(state.filter?.default?.()).toEqual(filter);
|
||||
expect(graphAnnotation.spec.filter.value).toEqual(filter);
|
||||
});
|
||||
|
||||
it('returns the expected default start to be undefined', () => {
|
||||
const state = getDefaultGraphState({ prompts });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts });
|
||||
|
||||
expect(state.start?.default?.()).toBeUndefined();
|
||||
expect(graphAnnotation.spec.start.value).toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns the expected start when it is provided', () => {
|
||||
const start = '2025-01-01T00:00:00.000Z';
|
||||
|
||||
const state = getDefaultGraphState({ prompts, start });
|
||||
const graphAnnotation = getDefaultGraphAnnotation({ prompts, start });
|
||||
|
||||
expect(state.start?.default?.()).toEqual(start);
|
||||
expect(graphAnnotation.spec.start.value).toEqual(start);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { AttackDiscovery, Replacements } from '@kbn/elastic-assistant-common';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import type { StateGraphArgs } from '@langchain/langgraph';
|
||||
import { Annotation } from '@langchain/langgraph';
|
||||
|
||||
import { AttackDiscoveryPrompts } from '../nodes/helpers/prompts';
|
||||
import {
|
||||
|
@ -15,7 +15,6 @@ import {
|
|||
DEFAULT_MAX_HALLUCINATION_FAILURES,
|
||||
DEFAULT_MAX_REPEATED_GENERATIONS,
|
||||
} from '../constants';
|
||||
import type { GraphState } from '../types';
|
||||
|
||||
export interface Options {
|
||||
end?: string;
|
||||
|
@ -24,90 +23,86 @@ export interface Options {
|
|||
start?: string;
|
||||
}
|
||||
|
||||
export const getDefaultGraphState = ({
|
||||
end,
|
||||
filter,
|
||||
prompts,
|
||||
start,
|
||||
}: Options): StateGraphArgs<GraphState>['channels'] => ({
|
||||
attackDiscoveries: {
|
||||
value: (x: AttackDiscovery[] | null, y?: AttackDiscovery[] | null) => y ?? x,
|
||||
default: () => null,
|
||||
},
|
||||
attackDiscoveryPrompt: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
default: () => prompts.default,
|
||||
},
|
||||
anonymizedAlerts: {
|
||||
value: (x: Document[], y?: Document[]) => y ?? x,
|
||||
default: () => [],
|
||||
},
|
||||
combinedGenerations: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
combinedRefinements: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
continuePrompt: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
default: () => prompts.continue,
|
||||
},
|
||||
end: {
|
||||
value: (x?: string | null, y?: string | null) => y ?? x,
|
||||
default: () => end,
|
||||
},
|
||||
errors: {
|
||||
value: (x: string[], y?: string[]) => y ?? x,
|
||||
default: () => [],
|
||||
},
|
||||
filter: {
|
||||
value: (x?: Record<string, unknown> | null, y?: Record<string, unknown> | null) => y ?? x,
|
||||
default: () => filter,
|
||||
},
|
||||
generationAttempts: {
|
||||
value: (x: number, y?: number) => y ?? x,
|
||||
default: () => 0,
|
||||
},
|
||||
generations: {
|
||||
value: (x: string[], y?: string[]) => y ?? x,
|
||||
default: () => [],
|
||||
},
|
||||
hallucinationFailures: {
|
||||
value: (x: number, y?: number) => y ?? x,
|
||||
default: () => 0,
|
||||
},
|
||||
refinePrompt: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
default: () => prompts.refine,
|
||||
},
|
||||
maxGenerationAttempts: {
|
||||
value: (x: number, y?: number) => y ?? x,
|
||||
default: () => DEFAULT_MAX_GENERATION_ATTEMPTS,
|
||||
},
|
||||
maxHallucinationFailures: {
|
||||
value: (x: number, y?: number) => y ?? x,
|
||||
default: () => DEFAULT_MAX_HALLUCINATION_FAILURES,
|
||||
},
|
||||
maxRepeatedGenerations: {
|
||||
value: (x: number, y?: number) => y ?? x,
|
||||
default: () => DEFAULT_MAX_REPEATED_GENERATIONS,
|
||||
},
|
||||
refinements: {
|
||||
value: (x: string[], y?: string[]) => y ?? x,
|
||||
default: () => [],
|
||||
},
|
||||
replacements: {
|
||||
value: (x: Replacements, y?: Replacements) => y ?? x,
|
||||
default: () => ({}),
|
||||
},
|
||||
start: {
|
||||
value: (x?: string | null, y?: string | null) => y ?? x,
|
||||
default: () => start,
|
||||
},
|
||||
unrefinedResults: {
|
||||
value: (x: AttackDiscovery[] | null, y?: AttackDiscovery[] | null) => y ?? x,
|
||||
default: () => null,
|
||||
},
|
||||
});
|
||||
export const getDefaultGraphAnnotation = ({ end, filter, prompts, start }: Options) =>
|
||||
Annotation.Root({
|
||||
attackDiscoveries: Annotation<AttackDiscovery[] | null>({
|
||||
reducer: (x: AttackDiscovery[] | null, y?: AttackDiscovery[] | null) => y ?? x,
|
||||
default: () => null,
|
||||
}),
|
||||
attackDiscoveryPrompt: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => prompts.default,
|
||||
}),
|
||||
anonymizedAlerts: Annotation<Document[]>({
|
||||
reducer: (x: Document[], y?: Document[]) => y ?? x,
|
||||
default: () => [],
|
||||
}),
|
||||
combinedGenerations: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
}),
|
||||
combinedRefinements: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
}),
|
||||
continuePrompt: Annotation<string, string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
}),
|
||||
end: Annotation<string | null | undefined>({
|
||||
reducer: (x?: string | null, y?: string | null) => y ?? x,
|
||||
default: () => end,
|
||||
}),
|
||||
errors: Annotation<string[], string[]>({
|
||||
reducer: (x: string[], y?: string[]) => y ?? x,
|
||||
default: () => [],
|
||||
}),
|
||||
filter: Annotation<Record<string, unknown> | null | undefined>({
|
||||
reducer: (x?: Record<string, unknown> | null, y?: Record<string, unknown> | null) => y ?? x,
|
||||
default: () => filter,
|
||||
}),
|
||||
generationAttempts: Annotation<number>({
|
||||
reducer: (x: number, y?: number) => y ?? x,
|
||||
default: () => 0,
|
||||
}),
|
||||
generations: Annotation<string[]>({
|
||||
reducer: (x: string[], y?: string[]) => y ?? x,
|
||||
default: () => [],
|
||||
}),
|
||||
hallucinationFailures: Annotation<number>({
|
||||
reducer: (x: number, y?: number) => y ?? x,
|
||||
default: () => 0,
|
||||
}),
|
||||
refinePrompt: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => prompts.refine,
|
||||
}),
|
||||
maxGenerationAttempts: Annotation<number>({
|
||||
reducer: (x: number, y?: number) => y ?? x,
|
||||
default: () => DEFAULT_MAX_GENERATION_ATTEMPTS,
|
||||
}),
|
||||
maxHallucinationFailures: Annotation<number>({
|
||||
reducer: (x: number, y?: number) => y ?? x,
|
||||
default: () => DEFAULT_MAX_HALLUCINATION_FAILURES,
|
||||
}),
|
||||
maxRepeatedGenerations: Annotation<number>({
|
||||
reducer: (x: number, y?: number) => y ?? x,
|
||||
default: () => DEFAULT_MAX_REPEATED_GENERATIONS,
|
||||
}),
|
||||
refinements: Annotation<string[]>({
|
||||
reducer: (x: string[], y?: string[]) => y ?? x,
|
||||
default: () => [],
|
||||
}),
|
||||
replacements: Annotation<Replacements>({
|
||||
reducer: (x: Replacements, y?: Replacements) => y ?? x,
|
||||
default: () => ({}),
|
||||
}),
|
||||
start: Annotation<string | null | undefined, string | null | undefined>({
|
||||
reducer: (x?: string | null, y?: string | null) => y ?? x,
|
||||
default: () => start,
|
||||
}),
|
||||
unrefinedResults: Annotation<AttackDiscovery[] | null>({
|
||||
reducer: (x: AttackDiscovery[] | null, y?: AttackDiscovery[] | null) => y ?? x,
|
||||
default: () => null,
|
||||
}),
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { END, START, StateGraph, StateGraphArgs } from '@langchain/langgraph';
|
||||
import { Annotation, END, START, StateGraph } from '@langchain/langgraph';
|
||||
import { AgentAction, AgentFinish, AgentStep } from '@langchain/core/agents';
|
||||
import { AgentRunnableSequence } from 'langchain/dist/agents/agent';
|
||||
import { StructuredTool } from '@langchain/core/tools';
|
||||
|
@ -60,72 +60,72 @@ export const getDefaultAssistantGraph = ({
|
|||
}: GetDefaultAssistantGraphParams) => {
|
||||
try {
|
||||
// Default graph state
|
||||
const graphState: StateGraphArgs<AgentState>['channels'] = {
|
||||
input: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
const graphAnnotation = Annotation.Root({
|
||||
input: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
lastNode: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
lastNode: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => 'start',
|
||||
},
|
||||
steps: {
|
||||
value: (x: AgentStep[], y: AgentStep[]) => x.concat(y),
|
||||
}),
|
||||
steps: Annotation<AgentStep[]>({
|
||||
reducer: (x: AgentStep[], y: AgentStep[]) => x.concat(y),
|
||||
default: () => [],
|
||||
},
|
||||
hasRespondStep: {
|
||||
value: (x: boolean, y?: boolean) => y ?? x,
|
||||
}),
|
||||
hasRespondStep: Annotation<boolean>({
|
||||
reducer: (x: boolean, y?: boolean) => y ?? x,
|
||||
default: () => false,
|
||||
},
|
||||
agentOutcome: {
|
||||
value: (
|
||||
}),
|
||||
agentOutcome: Annotation<AgentAction | AgentFinish | undefined>({
|
||||
reducer: (
|
||||
x: AgentAction | AgentFinish | undefined,
|
||||
y?: AgentAction | AgentFinish | undefined
|
||||
) => y ?? x,
|
||||
default: () => undefined,
|
||||
},
|
||||
messages: {
|
||||
value: (x: BaseMessage[], y: BaseMessage[]) => y ?? x,
|
||||
}),
|
||||
messages: Annotation<BaseMessage[]>({
|
||||
reducer: (x: BaseMessage[], y: BaseMessage[]) => y ?? x,
|
||||
default: () => [],
|
||||
},
|
||||
chatTitle: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
chatTitle: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
llmType: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
llmType: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => 'unknown',
|
||||
},
|
||||
isStream: {
|
||||
value: (x: boolean, y?: boolean) => y ?? x,
|
||||
}),
|
||||
isStream: Annotation<boolean>({
|
||||
reducer: (x: boolean, y?: boolean) => y ?? x,
|
||||
default: () => false,
|
||||
},
|
||||
isOssModel: {
|
||||
value: (x: boolean, y?: boolean) => y ?? x,
|
||||
}),
|
||||
isOssModel: Annotation<boolean>({
|
||||
reducer: (x: boolean, y?: boolean) => y ?? x,
|
||||
default: () => false,
|
||||
},
|
||||
connectorId: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
connectorId: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
conversation: {
|
||||
value: (x: ConversationResponse | undefined, y?: ConversationResponse | undefined) =>
|
||||
}),
|
||||
conversation: Annotation<ConversationResponse | undefined>({
|
||||
reducer: (x: ConversationResponse | undefined, y?: ConversationResponse | undefined) =>
|
||||
y ?? x,
|
||||
default: () => undefined,
|
||||
},
|
||||
conversationId: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
conversationId: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
responseLanguage: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
responseLanguage: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => 'English',
|
||||
},
|
||||
provider: {
|
||||
value: (x: string, y?: string) => y ?? x,
|
||||
}),
|
||||
provider: Annotation<string>({
|
||||
reducer: (x: string, y?: string) => y ?? x,
|
||||
default: () => '',
|
||||
},
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
// Default node parameters
|
||||
const nodeParams: NodeParamsBase = {
|
||||
|
@ -135,9 +135,7 @@ export const getDefaultAssistantGraph = ({
|
|||
};
|
||||
|
||||
// Put together a new graph using default state from above
|
||||
const graph = new StateGraph({
|
||||
channels: graphState,
|
||||
})
|
||||
const graph = new StateGraph(graphAnnotation)
|
||||
.addNode(NodeType.GET_PERSISTED_CONVERSATION, (state: AgentState) =>
|
||||
getPersistedConversation({
|
||||
...nodeParams,
|
||||
|
|
|
@ -13,6 +13,7 @@ import type { KibanaRequest } from '@kbn/core-http-server';
|
|||
import type { ExecuteConnectorRequestBody, TraceData } from '@kbn/elastic-assistant-common';
|
||||
import { APMTracer } from '@kbn/langchain/server/tracers/apm';
|
||||
import { AIMessageChunk } from '@langchain/core/messages';
|
||||
import { AgentFinish } from 'langchain/agents';
|
||||
import { withAssistantSpan } from '../../tracers/apm/with_assistant_span';
|
||||
import { AGENT_NODE_TAG } from './nodes/run_agent';
|
||||
import { DEFAULT_ASSISTANT_GRAPH_ID, DefaultAssistantGraph } from './graph';
|
||||
|
@ -234,7 +235,7 @@ export const invokeGraph = async ({
|
|||
};
|
||||
span.addLabels({ evaluationId: traceOptions?.evaluationId });
|
||||
}
|
||||
const r = await assistantGraph.invoke(inputs, {
|
||||
const result = await assistantGraph.invoke(inputs, {
|
||||
callbacks: [
|
||||
apmTracer,
|
||||
...(traceOptions?.tracers ?? []),
|
||||
|
@ -243,8 +244,8 @@ export const invokeGraph = async ({
|
|||
runName: DEFAULT_ASSISTANT_GRAPH_ID,
|
||||
tags: traceOptions?.tags ?? [],
|
||||
});
|
||||
const output = r.agentOutcome.returnValues.output;
|
||||
const conversationId = r.conversation?.id;
|
||||
const output = (result.agentOutcome as AgentFinish).returnValues.output;
|
||||
const conversationId = result.conversation?.id;
|
||||
if (onLlmResponse) {
|
||||
await onLlmResponse(output, traceData);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ export const callAssistantGraph: AgentExecutor<true | false> = async ({
|
|||
// prevents the agent from retrying on failure
|
||||
// failure could be due to bad connector, we should deliver that result to the client asap
|
||||
maxRetries: 0,
|
||||
convertSystemMessageToHumanContent: false,
|
||||
});
|
||||
|
||||
const anonymizationFieldsRes =
|
||||
|
|
|
@ -126,6 +126,7 @@ export const invokeAttackDiscoveryGraph = async ({
|
|||
tags,
|
||||
}
|
||||
);
|
||||
|
||||
const {
|
||||
attackDiscoveries,
|
||||
anonymizedAlerts,
|
||||
|
|
|
@ -27,6 +27,7 @@ import { buildRouteValidationWithZod } from '@kbn/elastic-assistant-common/impl/
|
|||
import { getDefaultArguments } from '@kbn/langchain/server';
|
||||
import { StructuredTool } from '@langchain/core/tools';
|
||||
import {
|
||||
AgentFinish,
|
||||
createOpenAIToolsAgent,
|
||||
createStructuredChatAgent,
|
||||
createToolCallingAgent,
|
||||
|
@ -254,6 +255,7 @@ export const postEvaluateRoute = (
|
|||
signal: abortSignal,
|
||||
streaming: false,
|
||||
maxRetries: 0,
|
||||
convertSystemMessageToHumanContent: false,
|
||||
});
|
||||
const llm = createLlmInstance();
|
||||
const anonymizationFieldsRes =
|
||||
|
@ -400,14 +402,14 @@ export const postEvaluateRoute = (
|
|||
const predict = async (input: { input: string }) => {
|
||||
logger.debug(`input:\n ${JSON.stringify(input, null, 2)}`);
|
||||
|
||||
const r = await graph.invoke(
|
||||
const result = await graph.invoke(
|
||||
{
|
||||
input: input.input,
|
||||
connectorId,
|
||||
conversationId: undefined,
|
||||
responseLanguage: 'English',
|
||||
llmType,
|
||||
isStreaming: false,
|
||||
isStream: false,
|
||||
isOssModel,
|
||||
}, // TODO: Update to use the correct input format per dataset type
|
||||
{
|
||||
|
@ -415,7 +417,7 @@ export const postEvaluateRoute = (
|
|||
tags: ['evaluation'],
|
||||
}
|
||||
);
|
||||
const output = r.agentOutcome.returnValues.output;
|
||||
const output = (result.agentOutcome as AgentFinish).returnValues.output;
|
||||
return output;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Annotation, messagesStateReducer } from '@langchain/langgraph';
|
|||
import { uniq } from 'lodash/fp';
|
||||
import type { RuleTranslationResult } from '../../../../../../common/siem_migrations/constants';
|
||||
import type {
|
||||
ElasticRule,
|
||||
ElasticRulePartial,
|
||||
OriginalRule,
|
||||
RuleMigration,
|
||||
} from '../../../../../../common/siem_migrations/model/rule_migration.gen';
|
||||
|
@ -21,7 +21,7 @@ export const migrateRuleState = Annotation.Root({
|
|||
default: () => [],
|
||||
}),
|
||||
original_rule: Annotation<OriginalRule>(),
|
||||
elastic_rule: Annotation<ElasticRule>({
|
||||
elastic_rule: Annotation<ElasticRulePartial>({
|
||||
reducer: (state, action) => ({ ...state, ...action }),
|
||||
}),
|
||||
semantic_query: Annotation<string>({
|
||||
|
|
|
@ -40,7 +40,7 @@ export const translateRuleState = Annotation.Root({
|
|||
}),
|
||||
elastic_rule: Annotation<ElasticRulePartial>({
|
||||
reducer: (state, action) => ({ ...state, ...action }),
|
||||
default: () => ({}),
|
||||
default: () => ({} as ElasticRulePartial),
|
||||
}),
|
||||
validation_errors: Annotation<TranslateRuleValidationErrors>({
|
||||
reducer: (current, value) => value ?? current,
|
||||
|
|
|
@ -9,6 +9,7 @@ import assert from 'assert';
|
|||
import type { AuthenticatedUser, Logger } from '@kbn/core/server';
|
||||
import { abortSignalToPromise, AbortError } from '@kbn/kibana-utils-plugin/server';
|
||||
import type { RunnableConfig } from '@langchain/core/runnables';
|
||||
import type { ElasticRule } from '../../../../../common/siem_migrations/model/rule_migration.gen';
|
||||
import { SiemMigrationStatus } from '../../../../../common/siem_migrations/constants';
|
||||
import { initPromisePool } from '../../../../utils/promise_pool';
|
||||
import type { RuleMigrationsDataClient } from '../data/rule_migrations_data_client';
|
||||
|
@ -336,7 +337,7 @@ export class RuleMigrationTaskRunner {
|
|||
this.logger.debug(`Translation of rule "${ruleMigration.id}" succeeded`);
|
||||
const ruleMigrationTranslated = {
|
||||
...ruleMigration,
|
||||
elastic_rule: migrationResult.elastic_rule,
|
||||
elastic_rule: migrationResult.elastic_rule as ElasticRule,
|
||||
translation_result: migrationResult.translation_result,
|
||||
comments: migrationResult.comments,
|
||||
};
|
||||
|
|
|
@ -71,6 +71,7 @@ export class ActionsClientChat {
|
|||
llmType,
|
||||
model: connector.config?.defaultModel,
|
||||
streaming: false,
|
||||
convertSystemMessageToHumanContent: false,
|
||||
temperature: 0.05,
|
||||
maxRetries: 1, // Only retry once inside the model, we will handle backoff retries in the task runner
|
||||
telemetryMetadata: { pluginId: TELEMETRY_SIEM_MIGRATION_ID, aggregateBy: migrationId },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue