samples/

directory
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0

Directories

Path Synopsis
This sample demonstrates the Anthropic plugin, which speaks Anthropic's native Messages API: a streaming flow that generates a joke with a model pinned through anthropic.ModelRef and the Anthropic SDK's own request type as its config.
This sample demonstrates the Anthropic plugin, which speaks Anthropic's native Messages API: a streaming flow that generates a joke with a model pinned through anthropic.ModelRef and the Anthropic SDK's own request type as its config.
This sample demonstrates the two kinds of flow:
This sample demonstrates the two kinds of flow:
This sample demonstrates the agent APIs by defining six agents in different styles, one per file, behind a single CLI:
This sample demonstrates the agent APIs by defining six agents in different styles, one per file, behind a single CLI:
This sample demonstrates serving agents as plain HTTP endpoints.
This sample demonstrates serving agents as plain HTTP endpoints.
This sample demonstrates durable streaming: a stream a caller can rejoin, whether it is still running or already finished.
This sample demonstrates durable streaming: a stream a caller can rejoin, whether it is still running or already finished.
This sample demonstrates error handling with the core/status package.
This sample demonstrates error handling with the core/status package.
This sample demonstrates output formats: the setting that decides how a model's text is parsed back into Go values, and what a streamed chunk means along the way.
This sample demonstrates output formats: the setting that decides how a model's text is parsed back into Go values, and what a streamed chunk means along the way.
This sample demonstrates media: reading a picture, making one, and making a video from one.
This sample demonstrates media: reading a picture, making one, and making a video from one.
basic-middleware
filesystem command
This sample demonstrates the Filesystem middleware, which grants the model scoped file access through list_files, read_file, write_file, and search_and_replace tools.
This sample demonstrates the Filesystem middleware, which grants the model scoped file access through list_files, read_file, write_file, and search_and_replace tools.
retry-fallback command
This sample demonstrates composing the Retry and Fallback middlewares into a resilient model pipeline.
This sample demonstrates composing the Retry and Fallback middlewares into a resilient model pipeline.
skills command
This sample demonstrates the Skills middleware, which offers the model a local library of specialised instructions stored as SKILL.md files.
This sample demonstrates the Skills middleware, which offers the model a local library of specialised instructions stored as SKILL.md files.
This sample demonstrates how a prompt turns your own data into a request.
This sample demonstrates how a prompt turns your own data into a request.
This sample demonstrates prompts, each defined twice: once inline in code with DefinePrompt, and once in a .prompt file (Dotprompt) looked up by name.
This sample demonstrates prompts, each defined twice: once inline in code with DefinePrompt, and once in a .prompt file (Dotprompt) looked up by name.
This sample demonstrates typed output: the Go type you ask for is the schema the model is held to, so the answer comes back as a struct, not a string.
This sample demonstrates typed output: the Go type you ask for is the schema the model is held to, so the answer comes back as a struct, not a string.
This sample demonstrates tool interrupts, which are how Genkit does human in the loop (HITL): a tool pauses generation to ask a person, and resumes with their answer.
This sample demonstrates tool interrupts, which are how Genkit does human in the loop (HITL): a tool pauses generation to ask a person, and resumes with their answer.
This sample is basic-tool-interrupts, written against the in-preview tools API in genkit/exp.
This sample is basic-tool-interrupts, written against the in-preview tools API in genkit/exp.
This sample demonstrates tools: Go functions the model may call mid-answer, and what a tool hands back when its answer is more than one value.
This sample demonstrates tools: Go functions the model may call mid-answer, and what a tool hands back when its answer is more than one value.
This sample is basic-tools, written against the in-preview tools API in genkit/exp.
This sample is basic-tools, written against the in-preview tools API in genkit/exp.
compat_oai
anthropic command
This sample demonstrates the Anthropic plugin for the OpenAI-compatible endpoint: a streaming flow that generates a joke with a model pinned through anthropic.ModelRef and its typed config.
This sample demonstrates the Anthropic plugin for the OpenAI-compatible endpoint: a streaming flow that generates a joke with a model pinned through anthropic.ModelRef and its typed config.
custom command
This sample demonstrates the base compat_oai plugin pointed at a custom OpenAI-compatible provider, here OpenRouter: a streaming flow that generates a joke with a model that resolves dynamically by name and takes the OpenAI SDK's own request type as its config.
This sample demonstrates the base compat_oai plugin pointed at a custom OpenAI-compatible provider, here OpenRouter: a streaming flow that generates a joke with a model that resolves dynamically by name and takes the OpenAI SDK's own request type as its config.
dashscope command
This sample demonstrates the DashScope plugin for Alibaba Cloud's Qwen models: a streaming flow that generates a joke with a model pinned through dashscope.ModelRef and its typed config.
This sample demonstrates the DashScope plugin for Alibaba Cloud's Qwen models: a streaming flow that generates a joke with a model pinned through dashscope.ModelRef and its typed config.
deepseek command
This sample demonstrates the DeepSeek plugin: a streaming flow that generates a joke with a model pinned through deepseek.ModelRef and its typed config.
This sample demonstrates the DeepSeek plugin: a streaming flow that generates a joke with a model pinned through deepseek.ModelRef and its typed config.
kimi command
This sample demonstrates the Kimi plugin for Moonshot AI's models: a streaming flow that generates a joke with a model pinned through kimi.ModelRef and its typed config.
This sample demonstrates the Kimi plugin for Moonshot AI's models: a streaming flow that generates a joke with a model pinned through kimi.ModelRef and its typed config.
openai command
This sample demonstrates the OpenAI plugin: a streaming flow that generates a joke with a model pinned through oai.ModelRef and the OpenAI SDK's own request type as its config.
This sample demonstrates the OpenAI plugin: a streaming flow that generates a joke with a model pinned through oai.ModelRef and the OpenAI SDK's own request type as its config.
openrouter command
This sample demonstrates the OpenRouter plugin: a streaming flow that generates a joke through a model named with its upstream vendor's prefix, routed to the cheapest provider serving it, with a second model to fall back to.
This sample demonstrates the OpenRouter plugin: a streaming flow that generates a joke through a model named with its upstream vendor's prefix, routed to the cheapest provider serving it, with a second model to fall back to.
xai command
This sample demonstrates the xAI plugin for the Grok models: a streaming flow that generates a joke with a model pinned through xai.ModelRef and its typed config.
This sample demonstrates the xAI plugin for the Grok models: a streaming flow that generates a joke with a model pinned through xai.ModelRef and its typed config.
zai command
This sample demonstrates the Z.ai plugin for the GLM models: a streaming flow that generates a joke with a model pinned through zai.ModelRef and its typed config.
This sample demonstrates the Z.ai plugin for the GLM models: a streaming flow that generates a joke with a model pinned through zai.ModelRef and its typed config.
This sample demonstrates durable streaming with Firestore backend.
This sample demonstrates durable streaming with Firestore backend.
This program can be manually tested like so:
This program can be manually tested like so:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL