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/coreutilstesting
Moduleā—Since v1.0

utils/testing

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

Classes

class
FakeChatMessageHistory

Base class for all chat message histories. All chat message histories should extend this class.

class
FakeChatModel

Base class for chat models. It extends the BaseLanguageModel class and provides methods for generating chat based on input messages.

class
FakeEmbeddings

A class that provides fake embeddings by overriding the embedDocuments and embedQuery methods to return fixed values.

class
FakeListChatMessageHistory

Base class for all list chat message histories. All list chat message histories should extend this class.

class
FakeListChatModel

A fake Chat Model that returns a predefined list of responses. It can be used for testing purposes.

class
FakeLLM

LLM class that provides a simpler interface to subclass than BaseLLM.

Requires only implementing a simpler _call method instead of _generate.

class
FakeRetriever

Abstract base class for a document retrieval system, designed to process string queries and return the most relevant documents from a source.

BaseRetriever provides common properties and methods for derived retrievers, such as callbacks, tagging, and verbose logging. Custom retrieval systems should extend this class and implement _getRelevantDocuments to define the specific retrieval logic.

class
FakeRunnable

A Runnable is a generic unit of work that can be invoked, batched, streamed, and/or transformed.

class
FakeSplitIntoListParser

Parser for comma-separated values. It splits the input text by commas and trims the resulting values.

class
FakeStreamingChatModel

Base class for chat models. It extends the BaseLanguageModel class and provides methods for generating chat based on input messages.

class
FakeStreamingLLM

LLM class that provides a simpler interface to subclass than BaseLLM.

Requires only implementing a simpler _call method instead of _generate.

class
FakeTool

Base class for Tools that accept input of any shape defined by a Zod schema.

class
FakeTracer

Abstract base class for creating callback handlers in the LangChain framework. It provides a set of optional methods that can be overridden in derived classes to handle various events during the execution of a LangChain application.

class
FakeVectorStore

Class that extends VectorStore to store vectors in memory. Provides methods for adding documents, performing similarity searches, and creating instances from texts, documents, or an existing index.

class
SingleRunExtractor

Abstract base class for creating callback handlers in the LangChain framework. It provides a set of optional methods that can be overridden in derived classes to handle various events during the execution of a LangChain application.

class
SyntheticEmbeddings

A class that provides synthetic embeddings by overriding the embedDocuments and embedQuery methods to generate embeddings based on the input documents. The embeddings are generated by converting each document into chunks, calculating a numerical value for each chunk, and returning an array of these values as the embedding.

Interfaces

interface
FakeChatInput

Interface for the input parameters specific to the Fake List Chat model.

interface
FakeListChatModelCallOptions

Represents the call options for a base chat model.

interface
FakeStreamingChatModelCallOptions

Interface specific to the Fake Streaming Chat model.

interface
FakeStreamingChatModelFields

Interface for the Constructor-field specific to the Fake Streaming Chat model (all optional because we fill in defaults).

interface
FakeToolParams

Parameters for the Tool classes.

interface
FakeVectorStoreArgs

Interface for the arguments that can be passed to the FakeVectorStore constructor. It includes an optional similarity function.

interface
ToolSpec

Minimal shape actually needed by bindTools

View source on GitHub