LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Browser
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
  • Tools
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Compat
  • Event
  • Llms
  • Openai Completions Stream
  • Profile
  • Stream
  • Structured Output
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Testing
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Standard Schema
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Uuid
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
BrowserUniversalHubNodeLoadSerializableEncoder BackedFile SystemIn MemoryTools
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsCompatEventLlmsOpenai Completions StreamProfileStreamStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesUuidVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coreexample_selectors
Moduleā—Since v0.3

example_selectors

Copy
import { ... } from "@langchain/core/example_selectors";

Functions

function
isChatModel→ llm is BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>
function
isLLM→ llm is BaseLLM<BaseLLMCallOptions>

Classes

class
BaseExampleSelector
class
BasePromptSelector
class
ConditionalPromptSelector
class
LengthBasedExampleSelector
class
SemanticSimilarityExampleSelector

Interfaces

Type Aliases

View source on GitHub
interface
LengthBasedExampleSelectorInput

Interface for the input parameters of the LengthBasedExampleSelector class.

typeAlias
BaseGetPromptAsyncOptions
typeAlias
SemanticSimilarityExampleSelectorInput: __type | __type

Interface for the input data of the SemanticSimilarityExampleSelector class.

Type guard function that checks if a given language model is of type BaseChatModel.

Type guard function that checks if a given language model is of type BaseLLM.

Base class for example selectors.

Abstract class that defines the interface for selecting a prompt for a given language model.

Concrete implementation of BasePromptSelector that selects a prompt based on a set of conditions. It has a default prompt that it returns if none of the conditions are met.

A specialized example selector that selects examples based on their length, ensuring that the total length of the selected examples does not exceed a specified maximum length.

Class that selects examples based on semantic similarity. It extends the BaseExampleSelector class.