Skip to content

Commit

Permalink
Fix error in Go snippet (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthecheung authored Jul 9, 2024
1 parent 6250662 commit 4956ba4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/internal/doc-snippets/prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func pr02() {
}

func pr03() error {
model := ai.Model{}

//!+pr03.1
type HelloPromptInput struct {
UserName string
Expand All @@ -70,7 +72,7 @@ func pr03() error {
func(ctx context.Context, input any) (*ai.GenerateRequest, error) {
params, ok := input.(HelloPromptInput)
if !ok {
return nil, errors.New("Input doesn't satisfy schema.")
return nil, errors.New("input doesn't satisfy schema")
}
prompt := fmt.Sprintf(
"You are a helpful AI assistant named Walt. Say hello to %s.",
Expand All @@ -87,9 +89,10 @@ func pr03() error {
if err != nil {
return err
}
response, err := gemini15pro.Generate(context.Background(), request, nil)
response, err := model.Generate(context.Background(), request, nil)
//!-pr03.2

_ = response
_ = err
return nil
}

0 comments on commit 4956ba4

Please sign in to comment.