developing-genkit-go

Build AI applications in Go using the Genkit SDK with flows, prompts, tools, and streaming.

Updated Aug 5, 2024
One-click install
npx skills add https://github.com/nikhilkakarla/nikhilkakarla.github.io --skill developing-genkit-go-nikhilkakarla
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: developing-genkit-go
Source: https://github.com/nikhilkakarla/nikhilkakarla.github.io/tree/main/.agents/skills/developing-genkit-go
Command: npx skills add https://github.com/nikhilkakarla/nikhilkakarla.github.io --skill developing-genkit-go-nikhilkakarla

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building AI features in Go requires wiring together model providers, prompt management, structured output parsing, streaming, and tool calling, which is repetitive and error-prone without a unified SDK and clear patterns. ## Core Features & Use Cases - Unified Generation API: Generate text, structured typed output, and streaming responses across Google AI, Vertex AI, Anthropic, OpenAI-compatible, and Ollama providers with one interface. - Flows and HTTP Deployment: Wrap AI logic in observable flows with tracing, then expose them as HTTP endpoints via genkit.Handler and test them in the Developer UI. - Prompts and Tools: Define reusable prompts in code or .prompt files with Handlebars templating, and give models callable tools including human-in-the-loop interrupts. - Use Case: Build a Go microservice that accepts a topic over HTTP, calls Gemini to generate a structured joke with typed output, streams the result via SSE, and traces every step in the Genkit Developer UI. ## Quick Start Ask the AI to create a Genkit Go flow that generates a joke about a given topic and serves it over HTTP on port 8080.

Frequently Asked Questions about developing-genkit-go

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate structured output from an LLM in Go?▼

Use genkit.GenerateData with a Go struct type parameter to get typed output parsed from the model's JSON response. Add jsonschema description tags to struct fields so the model understands what each field should contain.

How do I add tool calling to a Go LLM application?▼

Define a tool with genkit.DefineTool, providing a name, description, and typed function, then pass it to Generate via ai.WithTools. The model calls the tool automatically, and you can limit round trips with ai.WithMaxTurns.

Which model providers does Genkit for Go support?▼

Genkit Go supports Google AI and Vertex AI via the googlegenai plugin, Anthropic Claude, any OpenAI-compatible API through compat_oai, and local models via Ollama. Multiple providers can be registered in a single Genkit instance.

How do I stream LLM responses in a Go HTTP server?▼

Use genkit.DefineStreamingFlow with a stream callback, or iterate over genkit.GenerateStream results. When served via genkit.Handler, streaming flows automatically deliver chunks to clients using Server-Sent Events.

Can I test and debug Genkit Go flows locally?▼

Yes, install the Genkit CLI and run genkit start -- go run . to launch the Developer UI at localhost:4000. It lets you run flows interactively, inspect traces, and view token usage and latency per generation call.