I can find four different Go SDKs
- google/generative-ai-go – Gemini API only, can list models
- … go/vertexai/genai – Vertex AI only?
- …/genai – Cannot list models, can switch between Vertex AI and Gemini API
- cloud.google.com/go/ai – ???
What are the differences between the different Go SDKs and why can I not use the “genai package - google.golang.org/genai - Go Packages” SDK to obtain a list of models?
Hi @John_Cheng ,
Welcome to the Forum !!
Sorry for the late response !
why can I not use the “genai package - google.golang.org/genai - Go Packages” SDK to obtain a list of models?
Ans- The primary reason is the design philosophy of this SDK as an abstraction layer.
Differences:
Import Path |
Primary Target |
Authentication |
Scope |
Recommendation |
google/generative-ai-go |
Google AI Gemini API |
API Key |
Direct Gemini API |
Use if API Key is mandatory, less GCP integration needed. |
cloud.google.com/go/vertexai/genai |
Vertex AI GenAI |
GCP Auth (ADC, etc.) |
GenAI via Vertex AI |
Use if exclusively working with models deployed on Vertex AI within GCP. Note: cloud.google.com/go/genai is the newer approach. |
genai package - google.golang.org/genai - Go Packages |
Google AI or Vertex AI |
API Key or GCP Auth |
Unified client for both |
Recommended for new development due to flexibility and being the latest unified client. |
cloud.google.com/go/ai |
Other GCP AI Services |
GCP Auth |
Various (often non-gen AI) |
Not for accessing modern generative models like Gemini/PaLM. |
Thank you!!