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
  • Llms
  • Profile
  • 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
  • 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 ModelsLlmsProfileStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coreutilstesting
Module●Since v0.3

utils/testing

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

Classes

Interfaces

View source on GitHub
class
FakeChatMessageHistory
class
FakeChatModel
class
FakeEmbeddings
class
FakeListChatMessageHistory
class
FakeListChatModel
class
FakeLLM
class
FakeRetriever
class
FakeRunnable
class
FakeSplitIntoListParser
class
FakeStreamingChatModel
class
FakeStreamingLLM
class
FakeTool
class
FakeTracer
class
FakeVectorStore
class
SingleRunExtractor
class
SyntheticEmbeddings
interface
FakeChatInput
interface
FakeListChatModelCallOptions
interface
FakeStreamingChatModelCallOptions
interface
FakeStreamingChatModelFields
interface
FakeToolParams
interface
FakeVectorStoreArgs
interface
ToolSpec

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

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

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

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

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

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

Requires only implementing a simpler _call method instead of _generate.

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.

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

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

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

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

Requires only implementing a simpler _call method instead of _generate.

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

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 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.

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.

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.

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

Represents the call options for a base chat model.

Interface specific to the Fake Streaming Chat model.

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

Parameters for the Tool classes.

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

Minimal shape actually needed by bindTools