1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

add string function

This commit is contained in:
asim
2025-07-15 20:43:42 +01:00
parent 3cf5540b0f
commit f99a205b2b
5 changed files with 14 additions and 1 deletions

View File

@ -156,6 +156,10 @@ func (g *gemini) Stream(prompt string, opts ...genai.Option) (*genai.Stream, err
return &genai.Stream{Results: results}, nil return &genai.Stream{Results: results}, nil
} }
func (g *gemini) String() string {
return "gemini"
}
func init() { func init() {
genai.Register("gemini", New()) genai.Register("gemini", New())
} }

View File

@ -20,6 +20,7 @@ type Stream struct {
type GenAI interface { type GenAI interface {
Generate(prompt string, opts ...Option) (*Result, error) Generate(prompt string, opts ...Option) (*Result, error)
Stream(prompt string, opts ...Option) (*Stream, error) Stream(prompt string, opts ...Option) (*Stream, error)
String() string
} }
// Option is a functional option for configuring providers. // Option is a functional option for configuring providers.

View File

@ -13,4 +13,8 @@ func (n *noopGenAI) Stream(prompt string, opts ...Option) (*Stream, error) {
return &Stream{Results: results}, nil return &Stream{Results: results}, nil
} }
func (n *noopGenAI) String() string {
return "noop"
}
var Default = &noopGenAI{} var Default = &noopGenAI{}

View File

@ -146,6 +146,10 @@ func (o *openAI) Stream(prompt string, opts ...genai.Option) (*genai.Stream, err
return &genai.Stream{Results: results}, nil return &genai.Stream{Results: results}, nil
} }
func (o *openAI) String() string {
return "openai"
}
func init() { func init() {
genai.Register("openai", New()) genai.Register("openai", New())
} }