Genkit Go 1.0 has been announced and AI assist development has been strengthened

Applications of AI


We look forward to announcing the release of Genkit Go to 1.0the first stable production-ready release of Google's open source AI development framework for the GO ecosystem. In addition to this release, we also introduce the Genkit Init:AI-Tools command to supercharge AI-Assisted Development Workflow.

Genkit is an open source framework for building applications with full stack AI. It provides a unified interface for multiple model providers, providing streamlined APIs for multimodal content, structured output, tool invocations, searched generation (RAG), and agent workflows. Genkit Go now allows you to build and deploy production-enabled AI applications with the speed, safety and reliability of GO.

tl; dr

Genkit Go It is now stable and can be used for production purposes!

Main features:

  • Type-safe AI flow GO structure and JSON schema validation
  • Unified model interface Supports Google AI, Vertex AI, Openai, Ollama, and more
  • Tool Call, RAG, and Multimodal Support
  • A wealth of local development tools Uses standalone CLI binaries and developer UI
  • AI Coding Assistant Integration Genkit init: ai-tools command for tools like gemini cli

Ready to start coding? Please see the Get Start Guide.

New in Genkit go 1.0

Production preparation

Genkit Go 1.0 represents our commitment to providing GO with a stable and reliable foundation for building AI-powered applications. This release allows you to deploy AI-powered applications into production using Genkit. This is what I know that the API is stable and well tested.

Like Go itself, programs written in Genkit 1 continue to compile and run correctly without modification, even when future “point” releases of Genkit occur.

Type-safe AI flow

One of the most powerful features of Genkit is flow – Ability for AI use cases that provide observability, simple testing, and simplified deployment. Here's how to define the flow of GO to generate a structured recipe:

package main

import (
    "context"
    "encoding/json"
    "fmt"
    "log"

    "github.com/firebase/genkit/go/ai"
    "github.com/firebase/genkit/go/genkit"
    "github.com/firebase/genkit/go/plugins/googlegenai"
)

// Define your data structures
type RecipeInput struct {
    Ingredient          string `json:"ingredient" jsonschema:"description=Main ingredient or cuisine type"`
    DietaryRestrictions string `json:"dietaryRestrictions,omitempty" jsonschema:"description=Any dietary restrictions"`
}

type Recipe struct {
    Title        string   `json:"title"`
    Description  string   `json:"description"`
    PrepTime     string   `json:"prepTime"`
    CookTime     string   `json:"cookTime"`
    Servings     int      `json:"servings"`
    Ingredients  []string `json:"ingredients"`
    Instructions []string `json:"instructions"`
    Tips         []string `json:"tips,omitempty"`
}

func main() {
    ctx := context.Background()

    // Initialize Genkit with plugins
    g := genkit.Init(ctx,
        genkit.WithPlugins(&googlegenai.GoogleAI{}),
        genkit.WithDefaultModel("googleai/gemini-2.5-flash"),
    )

    // Define a type-safe flow
    recipeFlow := genkit.DefineFlow(g, "recipeGeneratorFlow", 
        func(ctx context.Context, input *RecipeInput) (*Recipe, error) {
            dietaryRestrictions := input.DietaryRestrictions
            if dietaryRestrictions == "" {
                dietaryRestrictions = "none"
            }

            prompt := fmt.Sprintf(`Create a recipe with the following requirements:
                Main ingredient: %s
                Dietary restrictions: %s`, input.Ingredient, dietaryRestrictions)

            // Generate structured data with type safety
            recipe, _, err := genkit.GenerateData[Recipe](ctx, g,
                ai.WithPrompt(prompt),
            )
            if err != nil {
                return nil, fmt.Errorf("failed to generate recipe: %w", err)
            }

            return recipe, nil
        })

    // Run the flow
    recipe, err := recipeFlow.Run(ctx, &RecipeInput{
        Ingredient:          "avocado",
        DietaryRestrictions: "vegetarian",
    })
    if err != nil {
        log.Fatalf("could not generate recipe: %v", err)
    }

    // Print the structured recipe
    recipeJSON, _ := json.MarshalIndent(recipe, "", "  ")
    fmt.Println("Sample recipe generated:")
    fmt.Println(string(recipeJSON))

    <-ctx.Done() // Used for local testing only
}

go

Unified model interface

Genkit Go offers a single, consistent interface to work with multiple AI model providers, including Google AI, Vertex AI, Openai, Anthropic, and Ollama. Learn more about generating content with AI models.

// Use Google AI models
resp, err := genkit.Generate(ctx, g,
    ai.WithModelName("googleai/gemini-2.5-flash"),
    ai.WithPrompt("What is the weather like today?"),
)

// Use OpenAI models
resp, err := genkit.Generate(ctx, g,
    ai.WithModelName("openai/gpt-4o"),
    ai.WithPrompt("How are you today?"),
)

// Switch to Ollama for local models
resp, err := genkit.Generate(ctx, g,
    ai.WithModelName("ollama/llama3"),
    ai.WithPrompt("What is the meaning of life?"),
)

go

Tool Call

Genkit Go allows AI models to easily provide access to external functions and APIs. See the complete tool call guide:

// Define a tool
type WeatherInput struct {
    Location string `json:"location" jsonschema_description:"Location to get weather for"`
}

getWeatherTool := genkit.DefineTool(g, "getWeather", 
    "Gets the current weather in a given location",
    func(ctx *ai.ToolContext, input WeatherInput) (string, error) {
        // Your weather API logic here
        return fmt.Sprintf("The current weather in %s is 72°F and sunny.", input.Location), nil
    })

// Use the tool in generation
resp, err := genkit.Generate(ctx, g,
    ai.WithPrompt("What's the weather in San Francisco?"),
    ai.WithTools(getWeatherTool),
)

go

Easy development

Deploy the flow as an HTTP endpoint with minimal setup. See the deployment guide for more options.

// Create HTTP handlers for your flows
mux := http.NewServeMux()
mux.HandleFunc("POST /recipeGeneratorFlow", genkit.Handler(recipeFlow))

// Start the server
log.Fatal(server.Start(ctx, "127.0.0.1:3400", mux))

go

Genkit Go comes with comprehensive development tools designed to make building AI applications quick and intuitive. The entire local toolchain is available through a single CLI that works seamlessly in the GO development workflow.

Standalone CLI installation

Let's start right away with the standalone CLI binaries – no other runtime installation required.

For macos and Linux:

curl -sL cli.genkit.dev | bash

shell

On Windows: Direct download: cli.genkit.dev

The CLI works with Genkit applications in supported languages ​​(JavaScript, Go, Python) and provides several handy commands for quick testing and iteration, such as running and evaluating flows.

Interactive Developer UI

The Developer UI provides a visual interface for testing and debugging AI applications.

  • The test flow flows interactively: Run the flow with different inputs and see the results that are beautifully rendered
  • Debug with detailed traces: Visualize exactly what your AI flow is doing in stages
  • Monitor performance: Track latency, token usage, and costs
  • Try the prompt: Test different prompts and model configurations

Launch the developer UI along with the GO application via the CLI.

genkit start -- go run .

shell

This is what you can see when you run and inspect recipeGenerator Previous flow:

Sorry, the browser does not support playing this video

I'm also excited to introduce you genkit init:ai-tools The order will revolutionize how we work with AI assistants during development. This feature is now available in both JavaScript and JavaScript. Go to the developerAutomatically configure popular AI coding assistants to work seamlessly with Genkit frameworks and tools. Learn more about Genkit's AI-assist development.

To use it, install and run the Genkit CLI.

genkit init:ai-tools

shell

When you run the command, the following happens:

  1. Discover existing AI assistant configurations Save the current settings
  2. Install the Genkit MCP server Use powerful development tools:
    • lookup_genkit_docs: Search for Genkit documents from genkit.dev
    • List_Flows: List all flows in the current Genkit app
    • run_flow: Run the flow with test input
    • get_trace: Gets the run trace for debugging and analysis
  1. Create the genkit.md file There are comprehensive language-specific instructions for AI assistants

Supported AI Tools

The command includes the following support:

  • Gemini CLI -Google's CLI-based AI coding assistant
  • Firebase Studio – Firebase agent, cloud-based development environment
  • Claude Code – Human coding assistant
  • cursor -AI-equipped code editor

For other tools, select the “General” option to get the genkit.md file that can be integrated manually.

Enhance your development experience

With AI Assistant Integration you can:

  • Ask a question about the Genkit Go API Get accurate and up-to-date answers
  • Generate GO-specific Genkit code It follows best practices
  • Debug flow By having the AI ​​assistant analyze the traces
  • Test your application Using AI-generated inputs
  • Get help with GO-specific patterns and customary codes

Quick Start

1. Create a new project.

mkdir my-genkit-app && cd my-genkit-app
go mod init example/my-genkit-app

shell

2. Install Genkit and the CLI:

go get github.com/firebase/genkit/go
curl -sL cli.genkit.dev | bash

shell

3. Configuring AI Assistant Integration:

genkit init:ai-tools

shell

4. Create the first flow Use the example above

5. Start the developer UI:

genkit start -- go run .

shell

For a more detailed walkthrough, see the Get Start Guide.

learn more

Genkit Go 1.0 combines Go performance and reliability with Genkit's production-enabled AI framework and tools. Can't wait to see what you make!

Happy coding! 🚀



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *