As mentioned in the subject, I'm not sure if this is a bug.
package main
import (
"context"
"log"
"os"
"github.com/go-kratos/blades"
"github.com/go-kratos/blades/contrib/openai"
)
func main() {
model := openai.NewModel(os.Getenv("OPENAI_MODEL"), openai.Config{
APIKey: os.Getenv("OPENAI_API_KEY"),
})
agent, err := blades.NewAgent(
"Stream Agent",
blades.WithModel(model),
blades.WithInstruction("You are a helpful assistant that provides detailed answers."),
)
if err != nil {
log.Fatal(err)
}
input := blades.UserMessage("What is the capital of France?")
runner := blades.NewRunner(agent)
stream := runner.RunStream(context.Background(), input)
for m, err := range stream {
if err != nil {
log.Fatal(err)
}
log.Println(m.Status, m.Text())
}
}
example/streaming
As mentioned in the subject, I'm not sure if this is a bug.
example/streaming