Google Cloud providers for the OmniStorage, OmniLLM, and OmniChat ecosystems.
| Module | Package | Description |
|---|---|---|
| omnillm | github.com/plexusone/omni-google/omnillm |
Gemini LLM provider for omnillm-core |
| omnistorage | github.com/plexusone/omni-google/omnistorage |
GCS and Drive backends for omnistorage-core |
| omnichat | github.com/plexusone/omni-google/omnichat/gmail |
Gmail provider for omnichat |
# For Gemini LLM provider
go get github.com/plexusone/omni-google/omnillm
# For storage backends (GCS, Drive)
go get github.com/plexusone/omni-google/omnistorage
# For Gmail messaging provider
go get github.com/plexusone/omni-google/omnichat/gmailThe omnillm module provides a Gemini provider for omnillm-core.
import (
"context"
"os"
"github.com/plexusone/omni-google/omnillm"
)
func main() {
ctx := context.Background()
// Create provider with API key
provider := gemini.NewProvider(os.Getenv("GEMINI_API_KEY"))
// Create a chat completion
resp, err := provider.CreateChatCompletion(ctx, &provider.ChatCompletionRequest{
Model: "gemini-2.0-flash",
Messages: []provider.Message{
{Role: "user", Content: "Hello, Gemini!"},
},
})
if err != nil {
panic(err)
}
fmt.Println(resp.Choices[0].Message.Content)
}import (
omnillm "github.com/plexusone/omnillm-core"
_ "github.com/plexusone/omni-google/omnillm" // Register Gemini provider
)
provider, err := omnillm.NewProvider(omnillm.ProviderConfig{
Provider: omnillm.ProviderNameGemini,
APIKey: os.Getenv("GEMINI_API_KEY"),
})- ✅ Chat completions
- ✅ Streaming responses
- ✅ System prompts
- ✅ Multi-turn conversations
The omnistorage module provides Google Cloud Storage and Google Drive backends.
| Backend | Package | Description |
|---|---|---|
| Google Drive | omnistorage/backend/drive |
Google Drive API with OAuth2 and service account auth |
| Google Cloud Storage | omnistorage/backend/gcs |
GCS with Application Default Credentials |
Both backends implement omnistorage.ExtendedBackend with full support for:
- 📄 Read/Write operations
- ℹ️ Stat, Copy, Move
- 📂 Mkdir, Rmdir
- ⚡ Server-side copy
- 🔐 Hash support (MD5, CRC32C for GCS)
import (
"context"
"github.com/plexusone/omni-google/omnistorage/backend/drive"
)
func main() {
ctx := context.Background()
backend, err := drive.New(drive.Config{
CredentialsFile: "/path/to/service-account.json",
RootFolderID: "your-folder-id",
})
if err != nil {
panic(err)
}
defer backend.Close()
// Write a file
w, _ := backend.NewWriter(ctx, "docs/hello.txt")
w.Write([]byte("Hello from Drive!"))
w.Close()
}import (
"context"
"github.com/plexusone/omni-google/omnistorage/backend/gcs"
)
func main() {
ctx := context.Background()
backend, err := gcs.New(gcs.Config{
Bucket: "my-bucket",
})
if err != nil {
panic(err)
}
defer backend.Close()
// Write a file
w, _ := backend.NewWriter(ctx, "data/hello.txt")
w.Write([]byte("Hello from GCS!"))
w.Close()
}import (
omnistorage "github.com/plexusone/omnistorage-core/object"
_ "github.com/plexusone/omni-google/omnistorage/backend/drive"
_ "github.com/plexusone/omni-google/omnistorage/backend/gcs"
)
// Open Google Drive
driveBackend, _ := omnistorage.Open("gdrive", map[string]string{
"credentials_file": "/path/to/creds.json",
"root_folder_id": "folder-id",
})
// Open GCS
gcsBackend, _ := omnistorage.Open("gcs", map[string]string{
"bucket": "my-bucket",
})| Feature | Google Drive | GCS |
|---|---|---|
| Read/Write | Yes | Yes |
| Stat | Yes | Yes |
| Copy | Yes (server-side) | Yes (server-side) |
| Move | Yes (server-side) | Yes (copy+delete) |
| Mkdir | Yes | Yes (marker objects) |
| Range Read | Yes | Yes |
| MD5 Hash | Yes | Yes |
| CRC32C Hash | No | Yes |
| Versioning | No | Yes (bucket config) |
| Shared Drives | Yes | N/A |
The omnichat/gmail module provides a Gmail provider for omnichat.
import (
"context"
"log/slog"
"os"
"github.com/plexusone/omni-google/omnichat/gmail"
)
func main() {
ctx := context.Background()
// Load credentials from file
creds, _ := os.ReadFile("client_secret.json")
// Create Gmail provider
provider, err := gmail.New(
gmail.WithCredentialsJSON(creds),
gmail.WithFromAddress("me"),
gmail.WithLogger(slog.Default()),
)
if err != nil {
panic(err)
}
// Connect (will prompt OAuth flow on first run)
if err := provider.Connect(ctx); err != nil {
panic(err)
}
defer provider.Disconnect(ctx)
// Send an email
err = provider.SendEmail(ctx,
"[email protected]",
"Hello from OmniChat",
"This email was sent via Gmail API!",
false, // plain text
)
}import (
"github.com/plexusone/omnichat/provider"
"github.com/plexusone/omni-google/omnichat/gmail"
)
router := provider.NewRouter(logger)
gmailProvider, _ := gmail.New(
gmail.WithCredentialsJSON(creds),
gmail.WithFromAddress("me"),
gmail.WithLogger(logger),
)
router.Register(gmailProvider)
router.ConnectAll(ctx)
// Send email via router
router.Send(ctx, "gmail", "[email protected]", provider.OutgoingMessage{
Content: "Hello from OmniChat!",
Format: provider.MessageFormatPlain,
Metadata: map[string]any{
"subject": "Test Email",
},
})- Create OAuth2 credentials in Google Cloud Console
- Enable Gmail API for your project
- Download
client_secret.json - On first run, OAuth flow opens browser for authorization
- Token is cached to
~/.omnichat/gmail_token.json
Set your API key:
export GEMINI_API_KEY="your-api-key"-
Service Account (recommended for server-to-server):
- Create a service account in Google Cloud Console
- Download the JSON key file
- Share the target folder with the service account email
-
OAuth2 User Credentials (for user-facing apps):
- Create OAuth2 client credentials
- Implement OAuth2 flow to get user token
-
Application Default Credentials (recommended):
- Run
gcloud auth application-default loginlocally - Use Workload Identity in GKE
- Automatic on Compute Engine, Cloud Run, etc.
- Run
-
Service Account:
- Create a service account with Storage permissions
- Download the JSON key file
- omnillm-core - Core LLM abstraction library
- omnistorage-core - Core storage abstraction library
- omnichat - Unified messaging platform interface
- omni-aws - AWS Bedrock, S3, and Secrets Manager providers
- omni-github - GitHub repository backend
MIT License - see LICENSE for details.