The agent engineering platform https://docs.langchain.com/langchain/
  • TypeScript 97.6%
  • HTML 1.6%
  • JavaScript 0.5%
  • Shell 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Simon 8103487c55
fix(openai): set model_name on Responses API chat model stream events (#11755)
Fixes #11754

`convertOpenAIResponsesStream` built the `message-finish`
`responseMetadata` with `model` but not `model_name`. Every other OpenAI
path sets `response_metadata.model_name` to the served model: the core
Chat Completions event stream, the legacy Responses chunk stream
(`response.created`) and the non-streaming Responses path. So a
`ChatOpenAI` call on the Responses API that `BaseChatModel` builds from
`_streamChatModelEvents` (any call made while a chat-model stream event
handler is attached, e.g. inside `streamEvents(..., { version: "v3" })`)
ended with `model_name: undefined`.

Tracing integrations read the served model from that field. Langfuse's
LangChain handler, for instance, keeps the requested alias (`gpt-5.4`)
for these calls while every other call of the same model reports the
snapshot (`gpt-5.4-2026-03-05`).

This sets `model_name: event.response.model` next to `model`.

### Tests
- Added a regression test in `responses_stream_events.test.ts` asserting
that `message-finish` carries `model_name`. It fails without the fix and
passes with it.
- `pnpm vitest run src/utils/tests/responses_stream_events.test.ts`: 8
passed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_011Aykfgmy8uDSRwinTCuGUW

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-05 17:26:51 -08:00
.changeset fix(openai): set model_name on Responses API chat model stream events (#11755) 2026-11-05 17:26:51 -08:00
.devcontainer fix: update Node.js to October 2026 security release (#12007) 2026-10-21 14:25:56 -07:00
.github chore(deps): bump the gh-actions-minor-and-patch group with 4 updates (#12082) 2026-11-01 16:05:33 -08:00
.vscode feat(core): new event streaming (#10772) 2026-05-01 16:45:21 -07:00
dependency_range_tests fix: update Node.js to October 2026 security release (#12007) 2026-10-21 14:25:56 -07:00
docs/core_docs chore!!!: replace main with v1 (#9204) 2025-10-15 15:10:20 -07:00
environment_tests chore(deps): bump the npm_and_yarn group across 2 directories with 1 update (#12038) 2026-10-26 03:08:38 -07:00
examples chore(deps): bump the minor-and-patch group across 1 directory with 57 updates (#12106) 2026-11-03 13:15:13 -08:00
internal chore(deps): bump the minor-and-patch group across 1 directory with 57 updates (#12106) 2026-11-03 13:15:13 -08:00
libs fix(openai): set model_name on Responses API chat model stream events (#11755) 2026-11-05 17:26:51 -08:00
.editorconfig Add CI job (and make it green) (#42) 2023-02-18 16:03:29 -08:00
.gitattributes Add CI job (and make it green) (#42) 2023-02-18 16:03:29 -08:00
.gitignore fix(google-common): release endpoint routing fix as patch (#11413) 2026-08-19 18:03:19 -07:00
.nvmrc fix: update Node.js to October 2026 security release (#12007) 2026-10-21 14:25:56 -07:00
.oxfmtrc.jsonc refactor(google): Step 1 - Typegen Namespace Setup (#11932) 2026-10-16 14:09:28 -07:00
.oxlintrc.jsonc feat(mcp-adapters): answer MCP elicitation with graph interrupts (#11643) 2026-09-23 11:02:23 -07:00
.pnpmrc chore!!!: replace main with v1 (#9204) 2025-10-15 15:10:20 -07:00
AGENTS.md docs: add Corridor agent instructions (#11442) 2026-08-24 14:42:39 -07:00
CONTRIBUTING.md docs: fix typos, add Ollama setup, update outdated references (#10922) 2026-05-19 03:02:47 -07:00
deno.json chore(langchain): update langgraph deps (#11412) 2026-08-19 17:46:15 -07:00
LICENSE chore!!!: replace main with v1 (#9204) 2025-10-15 15:10:20 -07:00
package.json chore(deps): bump undici and zod to fix security advisories (#12119) 2026-11-05 18:14:56 +00:00
pnpm-lock.yaml feat(langchain): add tracePolicy to middleware (#11596) 2026-11-05 12:09:48 -08:00
pnpm-workspace.yaml chore: remove community package (#10600) 2026-04-01 19:40:01 -07:00
README.md docs: fix typo in README (#11443) 2026-10-07 23:11:46 -07:00
turbo.json feat(typesafe): add TypeSafe System One classifier package (#11666) 2026-09-17 18:54:26 -07:00

The agent engineering platform.

npm License: MIT Twitter

LangChain is a framework for building LLM-powered applications. It helps you chain together interoperable components and third-party integrations to simplify AI application development — all while future-proofing decisions as the underlying technology evolves.

Tip

Just getting started? Check out Deep Agents — a higher-level package built on LangChain for agents that have built-in capabilities for common usage patterns such as planning, subagents, file system usage, and more.

Documentation: To learn more about LangChain, check out the docs.

If you're looking for more advanced customization or agent orchestration, check out LangGraph.js, our framework for building agents and controllable workflows.

For an equivalent Python library, check out LangChain.

To help you ship LangChain apps to production faster, check out LangSmith, a unified developer platform for building, testing, and monitoring LLM applications.

⚡️ Quick Install

You can use npm, pnpm, or yarn to install LangChain.js

npm install -S langchain or pnpm install langchain or yarn add langchain

🚀 Why use LangChain?

LangChain helps developers build applications powered by LLMs through a standard interface for agents, models, embeddings, vector stores, and more.

Use LangChain for:

  • Real-time data augmentation. Easily connect LLMs to diverse data sources and external/internal systems, drawing from LangChain’s vast library of integrations with model providers, tools, vector stores, retrievers, and more.
  • Model interoperability. Swap models in and out as your engineering team experiments to find the best choice for your application’s needs. As the industry frontier evolves, adapt quickly — LangChain’s abstractions keep you moving without losing momentum.
  • Rapid prototyping. Quickly build and iterate on LLM applications with LangChain's modular, component-based architecture. Test different approaches and workflows without rebuilding from scratch, accelerating your development cycle.
  • Production-ready features. Deploy reliable applications with built-in support for monitoring, evaluation, and debugging through integrations like LangSmith. Scale with confidence using battle-tested patterns and best practices.
  • Vibrant community and ecosystem. Leverage a rich ecosystem of integrations, templates, and community-contributed components. Benefit from continuous improvements and stay up-to-date with the latest AI developments through an active open-source community.
  • Flexible abstraction layers. Work at the level of abstraction that suits your needs - from high-level chains for quick starts to low-level components for fine-grained control. LangChain grows with your application's complexity.

📦 LangChain's ecosystem

  • Deep Agents (JS) - Build agents that can plan, use subagents, and leverage file systems for complex tasks. A higher-level package built on top of LangChain.
  • LangSmith - Unified developer platform for building, testing, and monitoring LLM applications. With LangSmith, you can debug poor-performing LLM app runs, evaluate agent trajectories, gain visibility in production, and deploy agents with confidence.
  • LangSmith Deployment — Deploy and scale agents with a purpose-built platform for long-running, stateful workflows
  • LangGraph - Build agents that can reliably handle complex tasks with LangGraph, our low-level agent orchestration framework. LangGraph offers customizable architecture, long-term memory, and human-in-the-loop workflows — and is trusted in production by companies like LinkedIn, Uber, Klarna, and GitLab.
  • Integrations — Chat & embedding models, tools & toolkits, and more

🌐 Supported Environments

LangChain.js is written in TypeScript and can be used in:

  • Node.js (ESM and CommonJS) - 20.x, 22.x, 24.x
  • Cloudflare Workers
  • Vercel / Next.js (Browser, Serverless and Edge functions)
  • Supabase Edge Functions
  • Browser
  • Deno
  • Bun

📖 Additional Resources

  • Getting started: Installation, setting up the environment, simple examples
  • Learn: Learn about the core concepts of LangChain.
  • LangChain Forum: Connect with the community and share all of your technical questions, ideas, and feedback.
  • Chat LangChain: Ask questions & chat with our documentation.

💁 Contributing

As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

For detailed information on how to contribute, see CONTRIBUTING.md.

Please report any security issues or concerns following our security guidelines.