Following the launch of Firebase Genkit for Node.js at Google I/O, the Firebase and Go teams collaborated to bring Genkit to the Go community. We’re excited to announce Genkit for Go, an open source framework for building AI-powered applications and cloud services natively in Go, leveraging the language's renowned simplicity, scalability, and security.
By combining Go's performance and concurrency advantages with Genkit's libraries and tools, developers can create generative AI applications that leverage the full potential of both technologies. Some potential use cases include:
Genkit for Go is currently in alpha, making it ideal for experimentation and exploration. We encourage you to prototype your AI-powered projects and share your feedback with us. Your input will directly shape the roadmap of Genkit for Go, helping us empower Go developers to build the next generation of production-ready, scalable AI applications.
Genkit is a developer-first framework for building AI-powered applications. Our Go libraries, written in pure Go, embrace the language's idioms and conventions, making them instantly familiar and productive for Go developers. Genkit provides lightweight, composable abstractions that simplify the development of sophisticated AI workflows without sacrificing customizability and control.
Here are a few ways Genkit boosts your productivity when building generative AI applications:
func main() {
ctx := context.Background()
// Initialize the Google AI plugin.
if err := googleai.Init(ctx, nil); err != nil {
log.Fatal(err)
}
// Define a simple flow that prompts an LLM to generate menu suggestions.
// Flows are functions that integrate with Genkit tooling and provide
// observability over multi-step workflows.
genkit.DefineFlow("menuSuggestionFlow", func(ctx context.Context, input string) (string, error) {
// Initialize gemini-1.5-flash model from Google AI.
m := googleai.Model("gemini-1.5-flash")
if m == nil {
return "", errors.New("menuSuggestionFlow: failed to find model")
}
// Construct a request and send it to the model API (Google AI).
resp, err := m.Generate(ctx,
ai.NewGenerateRequest(
&ai.GenerationCommonConfig{Temperature: 1},
ai.NewUserTextMessage(fmt.Sprintf(`Suggest an item for the menu of a %s themed restaurant`, input))),
nil)
if err != nil {
return "", err
}
// Handle the response from the model API.
text, err := resp.Text()
if err != nil {
return "", fmt.Errorf("menuSuggestionFlow: %v", err)
}
return text, nil
})
// Initialize Genkit flows server.
if err := genkit.Init(ctx, nil); err != nil {
log.Fatal(err)
}
}
Achieving the best AI generation outcomes involves careful consideration of your model, configuration, prompt, and output shape. Genkit provides Dotprompt, a simple file format that streamlines your prompt engineering process.
With Dotprompt, you can define rich prompt templates, input and output schemas, model selection, and model configuration options all within a single .prompt
file. This keeps everything organized, making it effortless to test, version, and deploy your prompts alongside your Go code.
---
model: vertexai/gemini-1.5-pro
config:
temperature: 0.9
input:
schema:
location: string
style?: string
name?: string
default:
location: a restaurant
---
You are the world's most welcoming AI assistant and are currently working at {{location}}.
Greet a guest{{#if name}} named {{name}}{{/if}}{{#if style}} in the style of {{style}}{{/if}}.
At its core, Genkit for Go is a lightweight, provider-agnostic framework. We offer a growing collection of plugins to seamlessly integrate with specific models, vector databases, and cloud services from Google and third-party providers.
In this release, Genkit for Go provides the following plugins:
Genkit's plugin system is designed to be open and extensible to any and all models, vector databases, evaluators, tools, and more. We actively encourage the community to contribute to Genkit’s ecosystem by publishing their own plugins.
Stay tuned for the Genkit for Go plugin development guide, coming soon to our documentation!
Building AI-powered apps comes with unique challenges such as crafting effective prompts, debugging unpredictable output, optimizing retrieval processes, and more. We believe these complexities benefit from dedicated tooling that goes beyond typical IDE utilities.
Genkit's CLI and intuitive browser-based developer UI provide a powerful toolkit to streamline your generative AI development.
With these tools you can:
If you like working within VS Code or Project IDX, you can open the Genkit developer UI in the IDE’s integrated browser and use it side-by-side with your code.
When you’re ready to deploy, Genkit helps you monitor your AI-powered application in production to make sure it’s serving your users as expected. Genkit’s Google Cloud telemetry plugin helps you easily export logs, metrics, and traces from your AI-powered app to Google Cloud’s operations suite.
While we provide Google Cloud integration out-of-the-box, we implemented Genkit’s instrumentation through the widely used OpenTelemetry standard, which can be integrated with many popular observability platforms.
Now that Genkit for Go is available in alpha, you can start using it to integrate AI workflows into your applications, and join the growing community of Go AI Developers.
To get started, check out the Get Started with Genkit for Go guide.
You can also open the Genkit template in IDX’s pre-configured workspace.
We're eager to collaborate with you!
Together, let's build a thriving ecosystem for AI development in Go. We can’t wait to see what you build with Genkit!