LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsutilsisAnthropicModel
Function●Since v1.10

isAnthropicModel

Detect whether a model is an Anthropic model.

Used to gate Anthropic-specific prompt caching optimizations (cache_control breakpoints).

Accepts the wider RunnableInterface shape (the type of request.model inside wrapModelCall, aliased as AgentLanguageModelLike in langchain) because the function only depends on .getName(), which is part of the Runnable contract. BaseLanguageModel extends Runnable, so existing call sites still type-check.

Copy
isAnthropicModel(
  model: string | BaseLanguageModel<any, BaseLanguageModelCallOptions> | RunnableInterface<unknown, unknown, RunnableConfig<Record<string, any>>>
): boolean

Parameters

NameTypeDescription
model*string | BaseLanguageModel<any, BaseLanguageModelCallOptions> | RunnableInterface<unknown, unknown, RunnableConfig<Record<string, any>>>
View source on GitHub