github langchain-ai/langchainjs @langchain/typesafe@0.1.0

latest releases: @langchain/neo4j@0.1.33, @langchain/xai@1.5.6
one hour ago

Minor Changes

  • #12184 5a21380 Thanks @thushanth-bengre-langchain! - feat(typesafe)!: implement TypeSafeClassifier as a decision model

    TypeSafeClassifier now extends BaseDecisionModel from @langchain/core/decisions and requires @langchain/core >= 1.4.0. This is a breaking change:

    • Questions are passed with each request instead of to the constructor: new TypeSafeClassifier().invoke({ state, questions }) replaces new TypeSafeClassifier({ questions }).invoke(state)
    • Responses are core's ClassifierResponse. Token usage is usage_metadata (input_tokens, output_tokens, total_tokens) instead of usage (inputTokens, outputTokens)
    • Question and answer types are re-exported from core, and every question requires instructions. ClassificationResponse, QuestionContent (now Content), Usage, ValidatedQuestions, JsonValue, and TypeSafeClassifierCallOptions are removed
    • Add Box questions, and send image content blocks in state or question content as TypeSafe image assets
    • An invalid question now throws a plain Error from invoke instead of a TypeSafeError from the constructor
    • State is core's type, which no longer lists Date; dates are still sent as ISO strings

Patch Changes

  • #12192 9920d4b Thanks @jkennedyvz! - Require Zod 4.6.6 or newer for installed dependencies to exclude versions affected by GHSA-mrhx-c7xc-m3w5. Zod v3 schemas remain supported through the bundled zod/v3 entry point.

  • #12186 035b74b Thanks @thushanth-bengre-langchain! - refactor(typesafe): deprecate experimental middleware

    • Deprecate autoModeMiddleware and modelRouterMiddleware from @langchain/typesafe/middleware. They warn once when called and will be removed in 0.2.0
    • Use autoModeMiddleware and modelRouterMiddleware from langchain with classifier: new TypeSafeClassifier() instead

Don't miss a new langchainjs release

NewReleases is sending notifications on new releases.