Go 생태계를 위한 Google의 오픈소스 AI 개발 프레임워크의 안정적이면서도 프로덕션 환경에 바로 사용 가능한 최초의 버전인 Genkit Go 1.0의 출시를 발표하게 되어 기쁩니다. 이번 버전과 함께 AI 지원 개발 워크플로를 강화해 줄 genkit init: ai-tools 명령어도 도입할 예정입니다.
Genkit은 풀 스택 AI 기반 애플리케이션 개발용 오픈소스 프레임워크입니다. 여러 모델 공급자를 위한 통합 인터페이스와 멀티모달 콘텐츠, 구조화된 출력, 도구 호출, RAG(검색 증강 생성), 에이전트 워크플로를 위한 간소화된 API를 제공합니다. 이제는 Genkit Go를 사용하여 Go의 속도와 안전성, 신뢰성을 바탕으로 프로덕션 환경에서 바로 사용할 수 있는 AI 애플리케이션을 개발하고 배포할 수 있습니다.
Genkit Go, 안정화 단계 진입 및 프로덕션 준비 완료!
주요 특징:
코딩을 시작할 준비가 되셨나요? 시작하기 가이드를 확인하세요.
Genkit Go 1.0은 Go에서 AI 기반 애플리케이션을 개발할 수 있도록 안정적이고 신뢰할 수 있는 기반을 제공하겠다는 저희의 약속을 나타냅니다. 이번 버전을 통해 API가 안정적이고 충분히 검증되었다는 확신을 기반으로 하여 Genkit을 사용해 AI 기반 애플리케이션을 프로덕션 환경에 배포할 수 있습니다.
Go 자체와 마찬가지로, Genkit 1.*로 작성된 프로그램은 향후 Genkit의 '포인트' 버전(Genkit 1.1, Genkit 1.2 등)이 출시되더라도 변경 없이 계속해서 올바르게 컴파일 및 실행되도록 설계되었습니다.
Genkit의 가장 강력한 특징 중 하나는 흐름으로, 관측 가능성과 간편한 테스트, 단순화된 배포 방법을 제시하는 AI 사용 사례를 위한 기능입니다. 구조화된 레시피를 생성하기 위해 Go에서 흐름을 정의하는 방법은 다음과 같습니다.
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
}
Genkit Go는 Google AI, Vertex AI, OpenAI, Anthropic, Ollama를 비롯한 여러 AI 모델 공급자와 협력할 수 있도록 일관된 단일 인터페이스를 제공합니다. AI 모델로 콘텐츠를 생성하는 방법에 대해 자세히 알아보세요.
// 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?"),
)
Genkit Go를 사용하면 AI 모델이 외부 함수와 API에 쉽게 액세스할 수 있습니다. 전체 도구 호출 가이드를 참조하세요.
// 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),
)
최소한의 설정으로 흐름을 HTTP 엔드포인트로 배포하세요. 더욱 다양한 옵션에 대해서는 배포 가이드를 참조하세요.
// 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))
Genkit Go는 AI 애플리케이션을 빠르고 직관적으로 개발할 수 있도록 설계된 포괄적인 개발 도구 세트와 함께 제공합니다. 전체 로컬 툴체인은 Go 개발 워크플로와 원활하게 작동하는 단일 CLI를 통해 사용할 수 있습니다.
독립 실행형 CLI 바이너리로 빠르게 시작하세요. 다른 런타임 설치가 필요하지 않습니다.
MacOS 및 Linux의 경우:
curl -sL cli.genkit.dev | bash
Windows의 경우: cli.genkit.dev에서 직접 다운로드하세요.
CLI는 지원되는 모든 언어(자바스크립트, Go, Python)의 Genkit 애플리케이션에서 작동하며, 흐름 실행 및 평가처럼 빠르게 테스트하고 반복할 수 있도록 몇 가지 편리한 명령어를 제공합니다.
개발자 UI는 AI 애플리케이션을 테스트하고 디버깅하기 위한 시각적 인터페이스를 제공합니다.
CLI를 통해 Go 애플리케이션과 함께 개발자 UI를 실행합니다.
genkit start -- go run .
앞서 언급한 recipeGenerator
흐름을 실행 및 검사할 때 실행 화면은 다음과 같습니다.
또한 개발 중에 AI 어시스턴트와 작업하는 방식을 혁신할 genkit init:ai-tools
명령어를 소개하게 되어 기쁩니다. 자바스크립트 및 Go 개발자가 모두 사용할 수 있는 이 기능은 인기 있는 AI 코딩 어시스턴트가 Genkit 프레임워크 및 도구 환경과 원활하게 작동하도록 자동으로 구성합니다. Genkit의 AI 지원 개발에 대해 자세히 알아보세요.
이 기능을 사용하려면 Genkit CLI를 설치하고 다음을 실행하세요.
genkit init:ai-tools
명령어를 실행하면 다음이 수행됩니다.
이 명령어에는 다음을 위한 지원이 기본 제공됩니다.
다른 도구의 경우, 'generic' 옵션을 선택하여 수동으로 통합할 수 있는 GENKIT.md 파일을 가져올 수 있습니다.
AI 어시스턴트 통합으로 다음을 수행할 수 있습니다.
1. 새 프로젝트 생성
mkdir my-genkit-app && cd my-genkit-app
go mod init example/my-genkit-app
2. Genkit 및 CLI 설치
go get github.com/firebase/genkit/go
curl -sL cli.genkit.dev | bash
3. AI 어시스턴트 통합 설정
genkit init:ai-tools
4. 위의 예시를 사용하여 첫 번째 흐름 생성
5. 개발자 UI 시작
genkit start -- go run .
더 자세한 내용을 둘러보려면 시작하기 가이드를 참조하세요.
Genkit Go 1.0은 Go의 성능과 신뢰성을 Genkit의 프로덕션 준비 완료된 AI 프레임워크 및 도구 환경과 결합합니다. 여러분이 개발할 결과물이 정말 기대됩니다!
즐겁게 코딩하세요! 🚀