mirror of
https://github.com/maximhq/maxim-go.git
synced 2026-11-06 04:31:21 +00:00
SDK to integrate Maxim in your Go app.
https://www.getmaxim.ai
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
### 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. |
||
| apis | ||
| internal | ||
| logging | ||
| middlewares | ||
| prompt | ||
| schemas | ||
| tests | ||
| utils | ||
| .gitignore | ||
| doc.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| maxim.go | ||
| project.json | ||
| README.md | ||
| utils.go | ||
Maxim Go Library
Breaking Change (v0.2.0): Types have been refactored from the
loggingpackage to theschemaspackage. Update imports fromgithub.com/maximhq/maxim-go/loggingtogithub.com/maximhq/maxim-go/schemasfor types such asMaximLLMResult,Usage,ChatCompletionToolCall, and related structs.