UNPKG

@genkit-ai/vertexai

Version:

Genkit AI framework plugin for Google Cloud Vertex AI APIs including Gemini APIs, Imagen, and more.

29 lines 915 B
import { getGenkitClientHeader } from "./common/index.mjs"; async function listModels(authClient, location, projectId) { const fetch = (await import("node-fetch")).default; const accessToken = await authClient.getAccessToken(); const response = await fetch( `https://${location}-aiplatform.googleapis.com/v1beta1/publishers/google/models`, { method: "GET", headers: { Authorization: `Bearer ${accessToken}`, "x-goog-user-project": projectId, "Content-Type": "application/json", "X-Goog-Api-Client": getGenkitClientHeader() } } ); if (!response.ok) { const ee = await response.text(); throw new Error( `Error from Vertex AI predict: HTTP ${response.status}: ${ee}` ); } const modelResponse = await response.json(); return modelResponse.publisherModels; } export { listModels }; //# sourceMappingURL=list-models.mjs.map