Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
jba committed Apr 29, 2024
1 parent aa89077 commit 5d68cdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions vertexai/genai/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func TestLive(t *testing.T) {
checkMatch(t, got, `15.* cm|[1-9].* inches`)
})
t.Run("system-instructions", func(t *testing.T) {
t.Skip("feature not yet available")
model := client.GenerativeModel(*modelName)
model.Temperature = Ptr[float32](0)
model.SystemInstruction = &Content{
Expand All @@ -71,7 +70,7 @@ func TestLive(t *testing.T) {
t.Fatal(err)
}
got := responseString(resp)
checkMatch(t, got, `15.* cm|[1-9].* inches`)
checkMatch(t, got, `[1-9][0-9].* cm|[1-9].* inches`)
fmt.Println(got)

})
Expand Down
6 changes: 3 additions & 3 deletions vertexai/genai/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import (
"context"
"fmt"
"log"
"os"

"cloud.google.com/go/vertexai/genai"

"google.golang.org/api/iterator"
"google.golang.org/api/option"
)

// Your GCP project
Expand Down Expand Up @@ -57,7 +55,9 @@ func ExampleGenerativeModel_GenerateContent() {
// for the complete set of configuration options.
func ExampleGenerativeModel_GenerateContent_config() {
ctx := context.Background()
client, err := genai.NewClient(ctx, option.WithAPIKey(os.Getenv("GEMINI_API_KEY")))
const projectID = "YOUR PROJECT ID"
const location = "GCP LOCATION"
client, err := genai.NewClient(ctx, projectID, location)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 5d68cdb

Please sign in to comment.