Skip to content

Conversation

@falonso81
Copy link
Contributor

Add context caching to vertexai
#1443

How to test:

func main() {
    fmt.Println("hello world!!!!")
    ctx := context.Background()
   err := googleai.Init(ctx, &googleai.Config{APIKey: os.Getenv("GOOGLE_GENAI_API_KEY")})
    if err != nil {
        log.Fatal(err)
    }
    m := googleai.Model("gemini-1.5-flash")
    if m == nil {
        log.Fatal(errors.New("googleai init failed"))
    }

    strrr, err := ai.GenerateText(ctx, m, ai.WithTextPrompt("Tell me a joke about golang developers."))
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(strrr)

    strrr, err = ai.GenerateText(ctx, m, ai.WithTextPrompt("Tell me a joke about golang developers. "))
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(strrr)
}

Checklist (if applicable):

@falonso81 falonso81 requested a review from apascal07 December 13, 2024 18:34
@falonso81 falonso81 linked an issue Dec 13, 2024 that may be closed by this pull request
@falonso81
Copy link
Contributor Author

closing, new PR here #1566

@hugoaguirre
Copy link
Contributor

@alonsopec89, the changes for googleai plugin are not present in the new PR you previously mentioned (#1566). Is there a particular reason for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants