包阅导读总结
1.
“`
Genkit for Go、AI 应用、Go 语言、开源框架、开发工具
“`
2.
Genkit for Go 是一个用于在 Go 语言中构建 AI 应用的开源框架,结合了 Go 的优势和 Genkit 的库与工具。目前处于 alpha 阶段,具有直观的库、增强的提示工程、集成服务及开发者工具,鼓励开发者参与并分享反馈。
3.
– Genkit for Go 发布
– 由 Firebase 和 Go 团队合作推出
– 为 Go 社区带来构建 AI 应用的框架
– 优势和特点
– 结合 Go 性能和并发优势
– 潜在用例广泛
– 包含直观的库
– 增强提示工程和管理
– 集成 Google 和第三方 AI 服务
– 提供集成的开发者工具
– 具备生产可观测性
– 开发相关
– 示例代码展示
– 插件系统开放可扩展
– 鼓励开发者参与和反馈
– 提供入门指南和交流渠道
思维导图:
文章地址:https://developers.googleblog.com/en/introducing-genkit-for-go-build-scalable-ai-powered-apps-in-go/
文章来源:developers.googleblog.com
作者:Chris Gill,Cameron Balahan
发布时间:2024/7/17 0:00
语言:英文
总字数:1244字
预计阅读时间:5分钟
评分:87分
标签:AI 开发,Go 编程,Genkit 框架,Google 开发者,AI 驱动的应用程序
以下为原文内容
本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

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:
- Intelligent assistants that understand complex requests and autonomously execute tasks like booking travel or creating itineraries, all tailored to your user’s preferences.
- Customer support agents that use retrieval-augmented generation (RAG) to provide fast, accurate, personalized responses grounded in your company’s knowledge base and policies.
- Powerful data transformation tools that convert unstructured data like natural language into structured formats (SQL queries, tables) for deeper analysis and insights.
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.
Intuitive libraries for AI generation, retrieval, and workflows
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:
- Unified generation API: Generate content from various models (Gemini, Gemma, or third-party) using a single, consistent interface. Easily configure models and leverage powerful features like function calling and structured output.
- Native vector database support: Make your AI models context-aware by integrating retrieval augmented generation (RAG) into your applications with simple indexing and retrieval APIs that work across vector database providers.
- “Flows” for AI workflows: Organize multi-step AI workflows with Genkit “flows.” Flows are functions that offer built-in observability for debugging and monitoring, integration with Genkit tooling, plus easy deployment as HTTP endpoints with minimal boilerplate.
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) }}
Enhanced prompt engineering and management
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-proconfig: temperature: 0.9input: 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}}.
Integrate Google and third-party AI services
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:
- Google Cloud Vertex AI plugin: Access Gemini and embeddings models from Vertex AI, Google Cloud’s production-ready AI platform. Support for Google’s image generation models, evaluators, third-party models from Model Garden are coming soon.
- Ollama plugin: Access and run open source models like Gemma, Llama, and Mistral locally through Ollama.
- Pinecone plugin: Integrate with Pinecone’s vector database for efficient indexing and retrieval operations.
- Google Cloud telemetry plugin: Export logs, metrics, and traces from your AI-powered apps to Cloud Logging, Cloud Tracing, and Firestore for comprehensive monitoring.
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!
Integrated developer tooling
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:
- Quickly initialize a new Genkit project or integrate Genkit into an existing project.
- Interactively run and iterate on your AI workflows, prompts, retrieval queries, and more in dedicated playgrounds for Genkit components.
- View detailed traces and metadata for the workflows and components you run, providing full observability and efficient debugging.
- Evaluate your AI workflows against test sets and view scored metrics and links to relevant traces.
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.
Production observability
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.
Get started
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!
- Connect with us on the Genkit Discord server to get direct access to the Genkit team, see announcements, ask questions, and discuss your experience.
- Share what you built with Genkit on the Show and Tell section of the discussion forums.
Together, let’s build a thriving ecosystem for AI development in Go. We can’t wait to see what you build with Genkit!