SimpleChatModel<Options extends ChatModelOptions> class
abstract
SimpleChatModel provides a simplified interface for working with chat models, rather than expecting the user to implement the full SimpleChatModel.invoke method.
- Inheritance
-
- Object
- Runnable<
PromptValue, Options, ChatResult> - BaseLangChain<
PromptValue, Options, ChatResult> - BaseLanguageModel<
List< ChatMessage> , Options, ChatResult> - BaseChatModel<
Options> - SimpleChatModel
Constructors
- SimpleChatModel({required Options defaultOptions})
-
SimpleChatModel provides a simplified interface for working with chat
models, rather than expecting the user to implement the full
SimpleChatModel.invoke method.
const
Properties
- defaultOptions → Options
-
The default options to use when invoking the Runnable.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- modelType → String
-
Return type of language model.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
batch(
List< PromptValue> inputs, {List<Options> ? options}) → Future<List< ChatResult> > -
Batches the invocation of the Runnable on the given
inputs
.inherited -
bind(
Options options) → RunnableBinding< PromptValue, Options, ChatResult> -
Binds the Runnable to the given
options
.inherited -
call(
List< ChatMessage> messages, {Options? options}) → Future<AIChatMessage> -
Runs the chat model on the given messages and returns a chat message.
inherited
-
callInternal(
List< ChatMessage> messages, {Options? options}) → Future<String> - Method which should be implemented by subclasses to run the model.
-
close(
) → void -
Cleans up any resources associated with it the Runnable.
inherited
-
countTokens(
PromptValue promptValue, {Options? options}) → Future< int> -
Returns the number of tokens resulting from tokenize the given prompt.
inherited
-
getCompatibleOptions(
RunnableOptions? options) → Options? -
Returns the given
options
if they are compatible with the Runnable, otherwise returnsnull
.inherited -
invoke(
PromptValue input, {Options? options}) → Future< ChatResult> -
Invokes the Runnable on the given
input
.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pipe<
NewRunOutput extends Object?, NewCallOptions extends RunnableOptions> (Runnable< ChatResult, NewCallOptions, NewRunOutput> next) → RunnableSequence<PromptValue, NewRunOutput> -
Pipes the output of this Runnable into another Runnable using a
RunnableSequence.
inherited
-
stream(
PromptValue input, {Options? options}) → Stream< ChatResult> -
Streams the output of invoking the Runnable on the given
input
.inherited -
streamFromInputStream(
Stream< PromptValue> inputStream, {Options? options}) → Stream<ChatResult> -
Streams the output of invoking the Runnable on the given
inputStream
.inherited -
tokenize(
PromptValue promptValue, {Options? options}) → Future< List< int> > -
Tokenizes the given prompt using the encoding used by the language
model.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withFallbacks(
List< Runnable< fallbacks) → RunnableWithFallback<PromptValue, RunnableOptions, ChatResult> >PromptValue, ChatResult> -
Adds fallback runnables to be invoked if the primary runnable fails.
inherited
-
withRetry(
{int maxRetries = 3, FutureOr< bool> retryIf(Object e)?, List<Duration?> ? delayDurations, bool addJitter = false}) → RunnableRetry<PromptValue, ChatResult> -
Adds retry logic to an existing runnable.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited