一键导入
go-framework
Go framework design patterns for Beluga AI v2. Use when designing package structure, registries, lifecycle, or creating new packages.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Go framework design patterns for Beluga AI v2. Use when designing package structure, registries, lifecycle, or creating new packages.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Documentation writing patterns for Beluga AI v2. Use when creating package docs, tutorials, API guides, or teaching-oriented content.
Go interface design with registry, middleware, and hooks for Beluga AI v2. Use when creating interfaces, extension contracts, or adding hooks/middleware.
Go testing patterns for Beluga AI v2. Use when writing tests, mocks, or benchmarks.
Implementing providers for Beluga AI v2 registries. Use when creating LLM, embedding, vectorstore, voice, or any other provider.
Go 1.23 iter.Seq2 streaming patterns for Beluga AI v2. Use when implementing streaming, transforms, or backpressure.
| name | go-framework |
| description | Go framework design patterns for Beluga AI v2. Use when designing package structure, registries, lifecycle, or creating new packages. |
<package>/
├── <interface>.go # Extension contract
├── registry.go # Register(), New(), List()
├── hooks.go # Lifecycle hooks
├── middleware.go # Middleware type + Apply()
└── providers/ # Built-in implementations
var (
mu sync.RWMutex
registry = make(map[string]Factory)
)
func Register(name string, f Factory) {
mu.Lock()
defer mu.Unlock()
registry[name] = f
}
func New(name string, cfg ProviderConfig) (Interface, error) {
mu.RLock()
f, ok := registry[name]
mu.RUnlock()
if !ok {
return nil, fmt.Errorf("unknown provider %q (registered: %v)", name, List())
}
return f(cfg)
}
func List() []string { /* sorted keys */ }
type Option func(*options)
func WithTimeout(d time.Duration) Option { return func(o *options) { o.timeout = d } }
func New(opts ...Option) *Thing { o := defaults(); for _, opt := range opts { opt(&o) }; return &Thing{opts: o} }
func init() {
llm.Register("openai", func(cfg llm.ProviderConfig) (llm.ChatModel, error) { return New(cfg) })
}
// Users import: import _ "github.com/lookatitude/beluga-ai/v2/llm/providers/openai"
var _ Interface = (*Impl)(nil)(T, error), wrap with core.Error, check IsRetryable().