@ai-sdk/google
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -24,2 +24,3 @@ "use strict"; | ||
Google: () => Google, | ||
createGoogleGenerativeAI: () => createGoogleGenerativeAI, | ||
google: () => google | ||
@@ -473,8 +474,25 @@ }); | ||
}; | ||
var google = new Google(); | ||
// src/google-provider.ts | ||
function createGoogleGenerativeAI(options = {}) { | ||
const google2 = new Google(options); | ||
const provider = function(modelId, settings) { | ||
if (new.target) { | ||
throw new Error( | ||
"The Google Generative AI model function cannot be called with the new keyword." | ||
); | ||
} | ||
return google2.chat(modelId, settings); | ||
}; | ||
provider.chat = google2.chat.bind(google2); | ||
provider.generativeAI = google2.generativeAI.bind(google2); | ||
return provider; | ||
} | ||
var google = createGoogleGenerativeAI(); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
Google, | ||
createGoogleGenerativeAI, | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -28,3 +28,3 @@ import { LanguageModelV1 } from '@ai-sdk/provider'; | ||
/** | ||
* Google provider. | ||
* @deprecated Use `createGoogleGenerativeAI` instead. | ||
*/ | ||
@@ -63,7 +63,34 @@ declare class Google { | ||
} | ||
interface GoogleGenerativeAIProvider { | ||
(modelId: GoogleGenerativeAIModelId, settings?: GoogleGenerativeAISettings): GoogleGenerativeAILanguageModel; | ||
chat(modelId: GoogleGenerativeAIModelId, settings?: GoogleGenerativeAISettings): GoogleGenerativeAILanguageModel; | ||
/** | ||
* @deprecated Use `chat()` instead. | ||
*/ | ||
generativeAI(modelId: GoogleGenerativeAIModelId, settings?: GoogleGenerativeAISettings): GoogleGenerativeAILanguageModel; | ||
} | ||
/** | ||
* Default Google provider instance. | ||
* Create a Google Generative AI provider. | ||
*/ | ||
declare const google: Google; | ||
declare function createGoogleGenerativeAI(options?: { | ||
/** | ||
* Base URL for the Google API calls. | ||
*/ | ||
baseURL?: string; | ||
/** | ||
* @deprecated Use `baseURL` instead. | ||
*/ | ||
baseUrl?: string; | ||
/** | ||
* API key for authenticating requests. | ||
*/ | ||
apiKey?: string; | ||
generateId?: () => string; | ||
}): GoogleGenerativeAIProvider; | ||
/** | ||
* Default Google Generative AI provider instance. | ||
*/ | ||
declare const google: GoogleGenerativeAIProvider; | ||
export { Google, google }; | ||
export { Google, type GoogleGenerativeAIProvider, createGoogleGenerativeAI, google }; |
@@ -24,2 +24,3 @@ "use strict"; | ||
Google: () => Google, | ||
createGoogleGenerativeAI: () => createGoogleGenerativeAI, | ||
google: () => google | ||
@@ -473,8 +474,25 @@ }); | ||
}; | ||
var google = new Google(); | ||
// src/google-provider.ts | ||
function createGoogleGenerativeAI(options = {}) { | ||
const google2 = new Google(options); | ||
const provider = function(modelId, settings) { | ||
if (new.target) { | ||
throw new Error( | ||
"The Google Generative AI model function cannot be called with the new keyword." | ||
); | ||
} | ||
return google2.chat(modelId, settings); | ||
}; | ||
provider.chat = google2.chat.bind(google2); | ||
provider.generativeAI = google2.generativeAI.bind(google2); | ||
return provider; | ||
} | ||
var google = createGoogleGenerativeAI(); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
Google, | ||
createGoogleGenerativeAI, | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ai-sdk/google", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -1,2 +0,2 @@ | ||
# Vercel AI SDK - Google Provider | ||
# Vercel AI SDK - Google Generative AI Provider | ||
@@ -14,8 +14,8 @@ The Google provider contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/) APIs. | ||
You can import `Google` from `ai/google` and initialize a provider instance with various settings: | ||
You can import `createGoogleGenerativeAI` from `@ai-sdk/google` and create a provider instance with various settings: | ||
```ts | ||
import { Google } from '@ai-sdk/google'; | ||
import { createGoogleGenerativeAI } from '@ai-sdk/google'; | ||
const google = new Google({ | ||
const google = createGoogleGenerativeAI({ | ||
baseURL: '', // optional base URL for proxies etc. | ||
@@ -32,5 +32,5 @@ apiKey: '', // optional API key, default to env property GOOGLE_GENERATIVE_AI_API_KEY | ||
## Generative AI Models | ||
## Models | ||
You can create models that call the [Google Generative AI API](https://ai.google.dev/api/rest) using the `.chat()` factory method. | ||
You can create models that call the [Google Generative AI API](https://ai.google.dev/api/rest) using the provider instance. | ||
The first argument is the model id, e.g. `models/gemini-pro`. | ||
@@ -40,3 +40,3 @@ The models support tool calls and some have multi-modal capabilities. | ||
```ts | ||
const model = google.chat('models/gemini-pro'); | ||
const model = google('models/gemini-pro'); | ||
``` | ||
@@ -48,5 +48,5 @@ | ||
```ts | ||
const model = google.chat('models/gemini-pro', { | ||
const model = google('models/gemini-pro', { | ||
topK: 0.2, | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109995
1532