README.md

 1![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/googleapis/go-genai)
 2[![Go Reference](https://pkg.go.dev/badge/google.golang.org/genai.svg)](https://pkg.go.dev/google.golang.org/genai)
 3
 4## ✨ NEW ✨
 5
 6### Google Gemini Multimodal Live support
 7
 8Introducing support for the Gemini Multimodal Live feature. Here's an example Multimodal Live server showing realtime conversation and video streaming: [code](./examples/live/live_streaming_server.go)
 9
10# Google Gen AI Go SDK
11
12The Google Gen AI Go SDK enables developers to use Google's state-of-the-art
13generative AI models (like Gemini) to build AI-powered features and applications.
14This SDK supports use cases like:
15- Generate text from text-only input
16- Generate text from text-and-images input (multimodal)
17- ...
18
19For example, with just a few lines of code, you can access Gemini's multimodal
20capabilities to generate text from text-and-image input.
21
22```go
23parts := []*genai.Part{
24  {Text: "What's this image about?"},
25  {InlineData: &genai.Blob{Data: imageBytes, MIMEType: "image/jpeg"}},
26}
27result, err := client.Models.GenerateContent(ctx, "gemini-2.0-flash", []*genai.Content{{Parts: parts}}, nil)
28```
29
30## Installation and usage
31
32Add the SDK to your module with `go get google.golang.org/genai`.
33
34## Create Clients
35
36### Imports
37```go
38import "google.golang.org/genai"
39```
40
41### Gemini API Client:
42```go
43client, err := genai.NewClient(ctx, &genai.ClientConfig{
44	APIKey:   apiKey,
45	Backend:  genai.BackendGeminiAPI,
46})
47```
48
49### Vertex AI Client:
50```go
51client, err := genai.NewClient(ctx, &genai.ClientConfig{
52	Project:  project,
53	Location: location,
54	Backend:  genai.BackendVertexAI,
55})
56```
57
58## License
59
60The contents of this repository are licensed under the
61[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).