class FakeListChatModelInternal method that handles batching and configuration for a runnable
Filter out large/inappropriate fields from invocation params for tracing metadata.
Create a unique cache key for a specific call to a specific language model.
Get the identifying parameters of the LLM.
Stream chat model events using the new content-block-centric protocol.
Default streaming implementation.
Helper method to transform an Iterator of Input values into an Iterator of
Assigns new fields to the dict output of this runnable. Returns a new runnable.
Convert a runnable to a tool. Return a new instance of RunnableToolLike
Default implementation of batch, which calls invoke N times.
Bind tool-like objects to this chat model.
Generates chat based on the input messages.
Generates a prompt based on the input prompt values.
Wraps getLsParams() and always appends ls_integration.
Get the number of tokens in the content.
Get the parameters used to invoke the model
Invokes the chat model with a single input.
Pick keys from the dict output of this runnable. Returns a new runnable.
Create a new runnable sequence that runs each individual runnable in series,
Stream output in chunks.
Stream all output from a runnable, as reported to the callback system.
Default implementation of transform, which buffers input and then calls stream.
Bind config to a Runnable, returning a new Runnable.
Create a new runnable from the current one that will try invoking
Bind lifecycle listeners to a Runnable, returning a new Runnable.
Add retry logic to an existing runnable.
The name of the serializable. Override to provide an alias or
The async caller should be used by subclasses to make any async calls,
A path to the module that contains the class, eg. ["langchain", "llms"]
Whether to print out response text.
Internal method that handles batching and configuration for a runnable
Filter out large/inappropriate fields from invocation params for tracing metadata.
A path to the module that contains the class, eg. ["langchain", "llms"]
Whether to print out response text.
A path to the module that contains the class, eg. ["langchain", "llms"]
Internal method that handles batching and configuration for a runnable
A path to the module that contains the class, eg. ["langchain", "llms"]
const chat = new FakeListChatModel({
responses: ["I'll callback later.", "You 'console' them!"]
});
const firstMessage = new HumanMessage("You want to hear a JavaScript joke?");
const secondMessage = new HumanMessage("How do you cheer up a JavaScript developer?");
// Call the chat model with a message and log the response
const firstResponse = await chat.call([firstMessage]);
console.log({ firstResponse });
const secondResponse = await chat.call([secondMessage]);
console.log({ secondResponse });The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.
Whether to print out response text.
A fake Chat Model that returns a predefined list of responses. It can be used for testing purposes.
Add retry logic to an existing runnable.
Default streaming implementation.