LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • 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
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coreexample_selectors
Moduleā—Since v1.0

example_selectors

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

Functions

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

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

function
isLLM→ llm is BaseLLM<BaseLLMCallOptions>

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

Classes

class
BaseExampleSelector

Base class for example selectors.

class
BasePromptSelector

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

class
ConditionalPromptSelector

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.

class
LengthBasedExampleSelector

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
SemanticSimilarityExampleSelector

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

Interfaces

interface
LengthBasedExampleSelectorInput

Interface for the input parameters of the LengthBasedExampleSelector class.

Type Aliases

typeAlias
BaseGetPromptAsyncOptions
typeAlias
SemanticSimilarityExampleSelectorInput: __type | __type

Interface for the input data of the SemanticSimilarityExampleSelector class.

View source on GitHub