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:
@ -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())
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
@ -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{}
|
||||||
|
@ -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())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user