SDK to integrate Maxim in your Go app. https://www.getmaxim.ai
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Akshay Deo 360caabb02
[Maxim Go] Adds Vertex provider support (#27)
### TL;DR

Added Vertex AI support to the Maxim Go SDK with a new transport middleware and comprehensive test coverage.

### What changed?

- **Go version**: Upgraded from 1.24 to 1.25.0
- **Dependencies**: Added Google Cloud compute metadata and OAuth2 packages for Vertex AI authentication
- **Provider support**: Added `ProviderVertex` constant and updated result parsing to handle both Gemini and Vertex providers
- **New middleware**: Created `MaximVertexTransport` that delegates to the existing Gemini middleware but sets the provider to Vertex
- **Model extraction**: Added `extractVertexModel()` function to parse Vertex AI URLs with publisher/model format (e.g., `publishers/google/models/gemini-2.0-flash`)
- **Token counting**: Updated streaming response parser to always use the last chunk's `usageMetadata` for accurate cumulative token counts
- **Test coverage**: Added comprehensive unit tests and end-to-end integration tests for Vertex AI functionality

### How to test?

**Unit tests:**
```bash
go test ./middlewares -run TestVertex
```

**Integration tests (requires Vertex AI credentials):**
```bash
# Set required environment variables
export VERTEX_PROJECT_ID=your-project
export VERTEX_LOCATION=us-central1
export VERTEX_ACCESS_TOKEN=$(gcloud auth print-access-token)
export MAXIM_API_KEY=your-maxim-key
export MAXIM_LOG_REPO_ID=your-repo-id

# Run integration tests
go test ./tests -run TestVertex_E2E
```

### Why make this change?

Vertex AI is Google's enterprise AI platform that uses the same wire format as the Gemini API but with different authentication, URLs, and model naming conventions. This change enables Maxim tracing for Vertex AI workloads by reusing the existing Gemini middleware infrastructure while properly handling Vertex-specific requirements like OAuth2 authentication and publisher-prefixed model names.
2026-04-01 14:16:21 +05:30
apis feat: Adds attachment support 2026-03-03 19:42:47 +05:30
internal fix: mod name and imports 2024-10-05 19:00:09 +05:30
logging [Maxim Go] Adds Vertex provider support 2026-04-01 13:20:03 +05:30
middlewares [Maxim Go] Adds Vertex provider support 2026-04-01 13:20:03 +05:30
prompt fix: response output struct added to get prompt version 2025-10-09 15:52:48 +05:30
schemas [Maxim Go] Adds image generation logging support 2026-04-01 00:25:45 +05:30
tests [Maxim Go] Adds Vertex provider support 2026-04-01 13:20:03 +05:30
utils fix: mod name and imports 2024-10-05 19:00:09 +05:30
.gitignore feat: Adds attachment support 2026-03-03 19:42:47 +05:30
doc.go feat: Adds tool calls & streaming support for all providers 2026-03-16 17:08:25 +05:30
go.mod [Maxim Go] Adds Vertex provider support 2026-04-01 13:20:03 +05:30
go.sum [Maxim Go] Adds Vertex provider support 2026-04-01 13:20:03 +05:30
LICENSE Create LICENSE 2025-03-05 11:11:03 +05:30
maxim.go feat: added support for MAXIM_BASE_URL env 2025-10-27 23:04:01 +05:30
project.json fix: mod name and imports 2024-10-05 19:00:09 +05:30
README.md feat: Adds tool calls & streaming support for all providers 2026-03-16 17:08:25 +05:30
utils.go fix: mod name and imports 2024-10-05 19:00:09 +05:30

Maxim Go Library

Breaking Change (v0.2.0): Types have been refactored from the logging package to the schemas package. Update imports from github.com/maximhq/maxim-go/logging to github.com/maximhq/maxim-go/schemas for types such as MaximLLMResult, Usage, ChatCompletionToolCall, and related structs.