Documentation
¶
Index ¶
- func DefineAgentFlow(g *genkit.Genkit, models []ai.Model, tools ...ai.ToolRef) *core.Flow[AgentInput, AgentOutput, struct{}]
- func DefineAssistFlow(g *genkit.Genkit, models []ai.Model) *core.Flow[AssistInput, AssistOutput, struct{}]
- func DefineClipboardReadTool(g *genkit.Genkit, readFn func() (string, error)) ai.ToolRef
- func DefineClipboardWriteTool(g *genkit.Genkit, writeFn func(string) error) ai.ToolRef
- func DefineSummarizeFlow(g *genkit.Genkit, models []ai.Model) *core.Flow[SummarizeInput, string, struct{}]
- func DefineSummarizeTool(g *genkit.Genkit, summarizeFlow *core.Flow[SummarizeInput, string, struct{}]) ai.ToolRef
- type AgentInput
- type AgentOutput
- type AssistInput
- type AssistOutput
- type ClipboardReadInput
- type ClipboardWriteInput
- type SummarizeInput
- type SummarizeToolInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineAgentFlow ¶
func DefineAgentFlow(g *genkit.Genkit, models []ai.Model, tools ...ai.ToolRef) *core.Flow[AgentInput, AgentOutput, struct{}]
DefineAgentFlow creates and registers the agent Genkit flow. The agent can use tools and reason over multiple steps.
func DefineAssistFlow ¶
func DefineAssistFlow(g *genkit.Genkit, models []ai.Model) *core.Flow[AssistInput, AssistOutput, struct{}]
DefineAssistFlow creates the assist Genkit flow for single-turn voice interactions. Optimized for speed: uses assist models, short responses, low temperature.
func DefineClipboardReadTool ¶
DefineClipboardReadTool creates a tool that reads the current clipboard content. The actual clipboard access is injected via the provided function to keep the tool testable.
func DefineClipboardWriteTool ¶
DefineClipboardWriteTool creates a tool that writes text to the clipboard. The actual clipboard access is injected via the provided function.
func DefineSummarizeFlow ¶
func DefineSummarizeFlow(g *genkit.Genkit, models []ai.Model) *core.Flow[SummarizeInput, string, struct{}]
DefineSummarizeFlow creates and registers the summarize Genkit flow. Models are tried in order; first successful response wins.
func DefineSummarizeTool ¶
func DefineSummarizeTool(g *genkit.Genkit, summarizeFlow *core.Flow[SummarizeInput, string, struct{}]) ai.ToolRef
DefineSummarizeTool creates a tool that the agent can use to summarize text. It delegates to the summarize flow, avoiding logic duplication.
Types ¶
type AgentInput ¶
type AgentInput struct {
Utterance string `json:"utterance"`
Locale string `json:"locale,omitempty"`
Selection string `json:"selection,omitempty"`
LastTranscription string `json:"lastTranscription,omitempty"`
SystemPrompt string `json:"systemPrompt,omitempty"`
}
AgentInput is the input for the agent flow.
type AgentOutput ¶
type AgentOutput struct {
Text string `json:"text"`
Action string `json:"action"` // "paste", "display", "silent"
}
AgentOutput is the output of the agent flow.
type AssistInput ¶
type AssistInput struct {
Utterance string `json:"utterance"` // The user's spoken text
Locale string `json:"locale,omitempty"` // "de", "en", etc.
Selection string `json:"selection,omitempty"` // Text currently selected in the active window
Context string `json:"context,omitempty"` // Additional context (last transcription, active app, etc.)
}
AssistInput is the input for the assist flow.
type AssistOutput ¶
type AssistOutput struct {
Text string `json:"text"` // Full LLM response text (always present)
SpeakText string `json:"speakText"` // TTS-optimized text (shorter, more natural than Text)
Action string `json:"action"` // "respond", "execute", "silent"
Locale string `json:"locale"` // Response language
}
AssistOutput is the Genkit flow output (before TTS synthesis).
type ClipboardReadInput ¶
type ClipboardReadInput struct {
}
ClipboardReadInput is the input schema for clipboard read tool.
type ClipboardWriteInput ¶
type ClipboardWriteInput struct {
Text string `json:"text" jsonschema_description:"Text to write to clipboard"`
}
ClipboardWriteInput is the input schema for clipboard write tool.
type SummarizeInput ¶
type SummarizeInput struct {
Text string `json:"text"`
Instruction string `json:"instruction,omitempty"`
Locale string `json:"locale,omitempty"`
}
SummarizeInput is the input for the summarize flow.
type SummarizeToolInput ¶
type SummarizeToolInput struct {
Text string `json:"text" jsonschema_description:"Text to summarize"`
Instruction string `json:"instruction,omitempty" jsonschema_description:"Optional instruction for how to summarize"`
}
SummarizeToolInput is the input schema for the summarize tool (used by the agent).