Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(go/plugins/googleai): add context caching to googleai #1518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alonsopec89
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):

@alonsopec89 alonsopec89 linked an issue Dec 13, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[Go] Add context caching to Google AI and Vertex AI plugins
1 participant