resp, err := ai.Generate(ctx, vertexai.Model("gemini-1.5-pro"),
ai.WithSystemPrompt("You are a helpful assistant"),
ai.WithTextPrompt("Tell a story "),
ai.WithStreaming(
func(ctx context.Context, grc *ai.GenerateResponseChunk) error {
if cb != nil {
if err := cb(ctx, grc.Text()); err != nil {
return err
}
}
return nil
}),
)
resp, err := ai.Generate(ctx, vertexai.Model("gemini-1.5-pro"),
ai.WithSystemPrompt("You are a helpful assistant"),
ai.WithTextPrompt("Tell a story "),
ai.WithStreaming(
func(ctx context.Context, grc *ai.GenerateResponseChunk) error {
if cb != nil {
if err := cb(ctx, grc.Text()); err != nil {
return err
}
}
return nil
}),
)