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

Chat LangChain

What can I help with?

Enter to send·Shift+Enter new line

Menu

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

createContentPreview

Create a preview of content showing head and tail with truncation marker.

Copy
createContentPreview(
  contentStr: string,
  headLines: number = 5,
  tailLines: number = 5
): string

Parameters

NameTypeDescription
contentStr*string

The full content string to preview.

headLinesnumber
Default:5

Number of lines to show from the start (default: 5).

tailLinesnumber
Default:5

Number of lines to show from the end (default: 5).

View source on GitHub