Change8

langchain-core==1.4.0a1

📦 langchainView on GitHub →
16 features🐛 34 fixes1 deprecations🔧 18 symbols

Summary

This release introduces significant feature updates, including content-block-centric streaming (v2) and support for the v3 event protocol. Numerous bug fixes address issues related to tracing, serialization, SSRF hardening, and model wrapper compatibility.

Migration Steps

  1. If you rely on path validation in `prompt.save` or `load_prompt`, note that these methods are now deprecated and behavior might change.
  2. If you were using the old streaming metadata format, note that streaming metadata has been reduced for performance.

✨ New Features

  • Implemented content-block-centric streaming (v2) in core.
  • Added support for `stream_events(version='v3')` protocol.
  • Allowed `_format_output` to pass through a list of `ToolOutputMixin` instances.
  • Updated inheritance behavior for tracer metadata for special keys.
  • Added Chat model and LLM invocation parameters to traceable metadata.
  • Added `ChatBaseten` to the serializable mapping.
  • Imputed placeholder filenames for OpenAI file inputs.
  • Added LangSmith integration metadata to `create_agent` and `init_chat_model`.
  • Hardened anti-SSRF measures.
  • Added support for tool search in OpenAI.
  • Added `ChatAnthropicBedrock` wrapper.
  • Added `langchain-openrouter` provider package.
  • Added `ContextOverflowError`, raised in Anthropic and OpenAI.
  • Added `text_inputs` and `text_outputs` to model profiles.
  • Enabled counting tokens from tool schemas in `count_tokens_approximately`.
  • Allowed scaling by reported usage when counting tokens approximately.

🐛 Bug Fixes

  • Preserved structured `inputs` on tool runs in tracers.
  • Made `removal` optional in `warn_deprecated`.
  • Validated `batch_size` in `_batch` and `_abatch` to prevent infinite loop.
  • Restored cloud metadata IPs and link-local range in SSRF policy.
  • Handled content blocks without a type key in responses API conversion.
  • Used reference counting for storing inherited run trees to support garbage collection.
  • Added more sanitization to templates.
  • Handled symlinks in deprecated prompt save path.
  • Added init validator and serialization mappings for Bedrock models.
  • Corrected parameter names in `filter_messages` docstring example.
  • Hardened check for txt files in deprecated prompt loading functions.
  • Fixed typos in the documentation.
  • Added "computer" to `_WellKnownOpenAITools`.
  • Validated paths in `prompt.save` and `load_prompt` (leading to deprecation).
  • Added missing `ModelProfile` fields and warned on schema drift.
  • Traced invocation params in metadata (reverted and then re-applied/fixed).
  • Fixed double backticks in deprecation docstring for `alternative_import`.
  • Preserved `default_factory` when generating tool call schema.
  • Extracted usage metadata from serialized tracer message outputs.
  • Treated empty tool chunk ids as missing in merge.
  • Improved error message for non-JSON-serializable tool schemas.
  • Improved typing/docs for `on_chat_model_start` to clarify required positional args.
  • Fixed merge_lists incorrectly merging parallel tool calls.
  • Accepted int temperature in `_get_ls_params` for LangSmith tracing (reverted and then fixed).
  • Accepted integer temperature values in `_get_ls_params`.
  • Prevented recursion error when `args_schema` is a dict.
  • Preserved index and timestamp fields when merging.
  • Corrected misleading jinja2 sandboxing comment.
  • Fixed setting `ChatGeneration.text`.
  • Sanitized urls when counting tokens in images.
  • Replaced bare except with `Exception` in tracer.
  • Adjusted cap when scaling approximate token counts.
  • Applied cap when scaling approximate token counts.
  • Fixed docstring format.

Affected Symbols

⚡ Deprecations

  • Validation of paths in `prompt.save` and `load_prompt` functions has been added, and these methods are now deprecated.