Update dependency ai to v5#244675
Conversation
|
Thanks for the PR! I've updated labels to make sure we backport this particular upgrade to 8.19/9.1/9.2/9.3 branches where we still use the old version. |
|
@elasticmachine merge upstream |
|
@Samiul-TheSoccerFan Could you complete the new dependency checklist? I noticed that there is only a single reference to one function from the new dependency. I am interested in if any alternatives were considered, but also the overall justification. Thanks! |
x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/server/lib/conversational_chain.ts
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/server/lib/conversational_chain.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/server/lib/conversational_chain.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/search/plugins/search_playground/server/lib/conversational_chain.ts
Outdated
Show resolved
Hide resolved
|
@jeramysoucy : I have updated the PR description with the security checklist and tried to provide an explanation with Alternative exploration. |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
|
|
Starting backport for target branches: 8.19, 9.1, 9.2 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
## Summary - Update dependency ai to v5 - Addressed the breaking changes <img width="2552" height="1267" alt="Screenshot 2025-11-28 at 2 38 46 PM" src="https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e" /> ### Security Checklist: **Purpose** – `@ai-sdk/langchain` provides the official adapter that converts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI message stream` format. We use it in the search playground's conversational chain so the existing LangChain pipeline can feed the new createUIMessageStream/SSE infrastructure without rewriting the entire chain logic. **Justification** – AI SDK v5 moved the LangChain adapter out of the core `ai` package; the only supported way to keep LangChain models streaming into UI chunks is this package. Using the upstream adapter keeps us aligned with Vercel's protocol changes (LC stream events, chunk metadata, etc.) and avoids maintaining fragile, duplicate conversion code in Kibana. **Alternatives explored** –We looked at copying the old adapter logic, but the new UI chunk format (text, tools, reasoning, data events) changes quickly and is easy to get wrong. Reimplementing it ourselves would be brittle and hard to maintain, so we rely on the upstream package instead. **Existing dependencies** – Kibana already depends on LangChain itself and on the base `ai` SDK, but neither now exposes a LangChain to UI stream bridge. `@ai-sdk/langchain` is the upstream successor to what used to be bundled in `ai`, so it’s effectively continuing the same capability with ongoing support, making it the preferred and only viable option. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 81c6347) # Conflicts: # .buildkite/scripts/steps/security/third_party_packages.txt # package.json # yarn.lock
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary - Update dependency ai to v5 - Addressed the breaking changes <img width="2552" height="1267" alt="Screenshot 2025-11-28 at 2 38 46 PM" src="https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e" /> ### Security Checklist: **Purpose** – `@ai-sdk/langchain` provides the official adapter that converts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI message stream` format. We use it in the search playground's conversational chain so the existing LangChain pipeline can feed the new createUIMessageStream/SSE infrastructure without rewriting the entire chain logic. **Justification** – AI SDK v5 moved the LangChain adapter out of the core `ai` package; the only supported way to keep LangChain models streaming into UI chunks is this package. Using the upstream adapter keeps us aligned with Vercel's protocol changes (LC stream events, chunk metadata, etc.) and avoids maintaining fragile, duplicate conversion code in Kibana. **Alternatives explored** –We looked at copying the old adapter logic, but the new UI chunk format (text, tools, reasoning, data events) changes quickly and is easy to get wrong. Reimplementing it ourselves would be brittle and hard to maintain, so we rely on the upstream package instead. **Existing dependencies** – Kibana already depends on LangChain itself and on the base `ai` SDK, but neither now exposes a LangChain to UI stream bridge. `@ai-sdk/langchain` is the upstream successor to what used to be bundled in `ai`, so it’s effectively continuing the same capability with ongoing support, making it the preferred and only viable option. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 81c6347) # Conflicts: # .buildkite/scripts/steps/security/third_party_packages.txt # package.json # x-pack/solutions/search/plugins/search_playground/public/utils/stream.ts # x-pack/solutions/search/plugins/search_playground/server/lib/conversational_chain.ts # yarn.lock
* commit '6647f813c9fa03ac0378e3d4756246e8dc4b4c76': (33 commits) [Detection Engine] Extracts Rules/Alerts/Exceptions permission to new Rules feature privileges (elastic#239634) [Agent Builder] Add Intro Tour (elastic#245551) Add datastream lifecycle support to indices metadata (elastic#245548) [Serverless] Update preconfigured connectors (elastic#245445) [Metrics][Discover] Discover to prefer line chars for time series data (elastic#244595) Update dependency @elastic/ebt to ^1.4.1 (main) (elastic#241629) [One Workflow] fix: request bodies with oneof schemas (`kibana.SetAlertsStatus`, etc) (elastic#245344) Update dependency ai to v5 (elastic#244675) Fix Discover trace waterfall behavior with duplicate spans (elastic#244984) [FSH] Migrated fs usage to kbn/fs for sample ingest (elastic#244163) Streamlang: Unskip type coercion test (elastic#245519) [Response Ops][Reporting] Fixing error in calculating delay value between retries (elastic#245431) Add TopNavMenuBeta to navigation plugin (elastic#243578) [scout] support custom servers configuration (elastic#244306) [Fleet] Run agentless background sync without dry run (elastic#245286) Fix Change Password Flaky Test (elastic#245443) Add new gap fill status for rules (elastic#242595) [Kibana Search] Move SLOs higher up in search results (elastic#245518) feat(slo): introduce find SLO instances internal route (elastic#245333) [FSH] Dropped unnecessary `fs` persistence for synthetics project code (elastic#244338) ...
# Backport This will backport the following commits from `main` to `8.19`: - [Update dependency ai to v5 (#244675)](#244675) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Samiul Monir","email":"150824886+Samiul-TheSoccerFan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-08T17:26:35Z","message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Search","backport:all-open","ci:project-deploy-elasticsearch","v9.3.0"],"title":"Update dependency ai to v5","number":244675,"url":"https://github.com/elastic/kibana/pull/244675","mergeCommit":{"message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/244675","number":244675,"mergeCommit":{"message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
# Backport This will backport the following commits from `main` to `9.1`: - [Update dependency ai to v5 (#244675)](#244675) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Samiul Monir","email":"150824886+Samiul-TheSoccerFan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-08T17:26:35Z","message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Search","backport:all-open","ci:project-deploy-elasticsearch","v9.3.0"],"title":"Update dependency ai to v5","number":244675,"url":"https://github.com/elastic/kibana/pull/244675","mergeCommit":{"message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/244675","number":244675,"mergeCommit":{"message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
# Backport This will backport the following commits from `main` to `9.2`: - [Update dependency ai to v5 (#244675)](#244675) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Samiul Monir","email":"150824886+Samiul-TheSoccerFan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-08T17:26:35Z","message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Search","backport:all-open","ci:project-deploy-elasticsearch","v9.3.0"],"title":"Update dependency ai to v5","number":244675,"url":"https://github.com/elastic/kibana/pull/244675","mergeCommit":{"message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/244675","number":244675,"mergeCommit":{"message":"Update dependency ai to v5 (#244675)\n\n## Summary\n\n- Update dependency ai to v5\n- Addressed the breaking changes\n\n<img width=\"2552\" height=\"1267\" alt=\"Screenshot 2025-11-28 at 2 38\n46 PM\"\nsrc=\"https://github.com/user-attachments/assets/44f9c824-79c5-4e7e-a0ad-216e79673f9e\"\n/>\n\n### Security Checklist:\n**Purpose** – `@ai-sdk/langchain` provides the official adapter that\nconverts LangChain's `Runnable.stream()` output into the AI SDK v5 `UI\nmessage stream` format. We use it in the search playground's\nconversational chain so the existing LangChain pipeline can feed the new\ncreateUIMessageStream/SSE infrastructure without rewriting the entire\nchain logic.\n\n**Justification** – AI SDK v5 moved the LangChain adapter out of the\ncore `ai` package; the only supported way to keep LangChain models\nstreaming into UI chunks is this package. Using the upstream adapter\nkeeps us aligned with Vercel's protocol changes (LC stream events, chunk\nmetadata, etc.) and avoids maintaining fragile, duplicate conversion\ncode in Kibana.\n\n**Alternatives explored** –We looked at copying the old adapter logic,\nbut the new UI chunk format (text, tools, reasoning, data events)\nchanges quickly and is easy to get wrong. Reimplementing it ourselves\nwould be brittle and hard to maintain, so we rely on the upstream\npackage instead.\n\n**Existing dependencies** – Kibana already depends on LangChain itself\nand on the base `ai` SDK, but neither now exposes a LangChain to UI\nstream bridge. `@ai-sdk/langchain` is the upstream successor to what\nused to be bundled in `ai`, so it’s effectively continuing the same\ncapability with ongoing support, making it the preferred and only viable\noption.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [X] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"81c634708ab1405b64a5ca524b0f62d84d351467"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
Security Checklist:
Purpose –
@ai-sdk/langchainprovides the official adapter that converts LangChain'sRunnable.stream()output into the AI SDK v5UI message streamformat. We use it in the search playground's conversational chain so the existing LangChain pipeline can feed the new createUIMessageStream/SSE infrastructure without rewriting the entire chain logic.Justification – AI SDK v5 moved the LangChain adapter out of the core
aipackage; the only supported way to keep LangChain models streaming into UI chunks is this package. Using the upstream adapter keeps us aligned with Vercel's protocol changes (LC stream events, chunk metadata, etc.) and avoids maintaining fragile, duplicate conversion code in Kibana.Alternatives explored –We looked at copying the old adapter logic, but the new UI chunk format (text, tools, reasoning, data events) changes quickly and is easy to get wrong. Reimplementing it ourselves would be brittle and hard to maintain, so we rely on the upstream package instead.
Existing dependencies – Kibana already depends on LangChain itself and on the base
aiSDK, but neither now exposes a LangChain to UI stream bridge.@ai-sdk/langchainis the upstream successor to what used to be bundled inai, so it’s effectively continuing the same capability with ongoing support, making it the preferred and only viable option.Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.