GenkitAI class base
Encapsulates Genkit's AI APIs.
GenkitAI exposes the model-orchestration veneer (generate,
generateStream, embed, embedMany, run) on top of a
Registry. It only requires a registry to operate, making it cheap to
create ephemeral, throwaway instances (the registry holds all the state).
The full framework entry point Genkit extends this class to add plugin
loading, the reflection server, and the various define* methods.
- Implementers
- Available extensions
Properties
Methods
-
embed<
CustomOptions> ({required EmbedderRef< CustomOptions> embedder, DocumentData? document, List<DocumentData> ? documents, CustomOptions? options}) → Future<List< Embedding> > - Embeds a single document or a list of documents.
-
embedMany<
CustomOptions> ({required EmbedderRef< CustomOptions> embedder, required List<DocumentData> documents, CustomOptions? options}) → Future<List< Embedding> > - Embeds multiple documents using the specified embedder.
-
generate<
CustomOptions, Output> ({String? system, String? prompt, List< Part> ? promptParts, List<Message> ? messages, ModelRef<CustomOptions> ? model, CustomOptions? config, List<Tool> ? tools, List<String> ? toolNames, String? toolChoice, bool? returnToolRequests, int? maxTurns, SchemanticType<Output> ? outputSchema, String? outputFormat, bool? outputConstrained, String? outputInstructions, bool? outputNoInstructions, String? outputContentType, Map<String, dynamic> ? context, StreamingCallback<GenerateResponseChunk< ? onChunk, List<Output> >GenerateMiddlewareRef> ? use, CancellationToken? cancel, List<InterruptResponse> ? interruptRespond, List<ToolRequestPart> ? interruptRestart}) → Future<GenerateResponseHelper< Output> > - Generates a response using the specified model and context.
-
generateBidi(
{required String model, dynamic config, List< Tool> ? tools, List<String> ? toolNames, String? system, CancellationToken? cancel}) → Future<GenerateBidiSession> -
Available on GenkitAI, provided by the GenkitBidi extension
Starts a bi-directional (live) generator session. -
generateStream<
CustomOptions, Output> ({String? system, String? prompt, List< Part> ? promptParts, List<Message> ? messages, ModelRef<CustomOptions> ? model, CustomOptions? config, List<Tool> ? tools, List<String> ? toolNames, String? toolChoice, bool? returnToolRequests, int? maxTurns, SchemanticType<Output> ? outputSchema, String? outputFormat, bool? outputConstrained, String? outputInstructions, bool? outputNoInstructions, String? outputContentType, Map<String, dynamic> ? context, List<GenerateMiddlewareRef> ? use, CancellationToken? cancel, List<InterruptResponse> ? interruptRespond, List<ToolRequestPart> ? interruptRestart}) → ActionStream<GenerateResponseChunk< Output> , GenerateResponseHelper<Output> > - Streams a response from the specified model.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run<
Output> (String name, Future< Output> fn()) → Future<Output> - Runs an AI operation within a new trace span.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited