@ai-sdk/google
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -5,2 +5,9 @@ import { LanguageModelV1 } from '@ai-sdk/provider'; | ||
interface GoogleGenerativeAISettings { | ||
/** | ||
Optional. The maximum number of tokens to consider when sampling. | ||
Models use nucleus sampling or combined Top-k and nucleus sampling. | ||
Top-k sampling considers the set of topK most probable tokens. | ||
Models running with nucleus sampling don't allow topK setting. | ||
*/ | ||
topK?: number; | ||
@@ -38,3 +45,4 @@ } | ||
/** | ||
Base URL for the Google API calls. | ||
Use a different URL prefix for API calls, e.g. to use proxy servers. | ||
The default prefix is `https://generativelanguage.googleapis.com/v1beta`. | ||
*/ | ||
@@ -47,3 +55,4 @@ baseURL?: string; | ||
/** | ||
API key for authenticating requests. | ||
API key that is being send using the `x-goog-api-key` header. | ||
It defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable. | ||
*/ | ||
@@ -50,0 +59,0 @@ apiKey?: string; |
{ | ||
"name": "@ai-sdk/google", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"license": "Apache-2.0", | ||
@@ -22,3 +22,3 @@ "sideEffects": false, | ||
"@ai-sdk/provider": "0.0.2", | ||
"@ai-sdk/provider-utils": "0.0.3" | ||
"@ai-sdk/provider-utils": "0.0.4" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
# Vercel AI SDK - Google Generative AI Provider | ||
The Google provider contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/) APIs. | ||
The Google provider for the [Vercel AI SDK](https://sdk.vercel.ai/docs) contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/) APIs. | ||
It creates language model objects that can be used with the `generateText`, `streamText`, `generateObject`, and `streamObject` AI functions. | ||
@@ -10,31 +10,40 @@ | ||
```bash | ||
npm i @ai-sdk/google | ||
``` | ||
## Provider Instance | ||
You can import `createGoogleGenerativeAI` from `@ai-sdk/google` and create a provider instance with various settings: | ||
You can import the default provider instance `google` from `@ai-sdk/google`: | ||
```ts | ||
import { google } from '@ai-sdk/google'; | ||
``` | ||
If you need a customized setup, you can import `createGoogleGenerativeAI` from `@ai-sdk/google` and create a provider instance with your settings: | ||
```ts | ||
import { createGoogleGenerativeAI } from '@ai-sdk/google'; | ||
const google = createGoogleGenerativeAI({ | ||
// optional base URL for proxies etc.: | ||
baseURL: '', | ||
// optional API key, default to env property GOOGLE_GENERATIVE_AI_API_KEY: | ||
apiKey: '', | ||
// optional custom headers: | ||
headers: { | ||
'custom-header': 'value', | ||
}, | ||
// custom settings | ||
}); | ||
``` | ||
The AI SDK also provides a shorthand `google` import with a Google provider instance that uses defaults: | ||
You can use the following optional settings to customize the Google Generative AI provider instance: | ||
```ts | ||
import { google } from '@ai-sdk/google'; | ||
``` | ||
- **baseURL** _string_ | ||
Use a different URL prefix for API calls, e.g. to use proxy servers. | ||
The default prefix is `https://generativelanguage.googleapis.com/v1beta`. | ||
- **apiKey** _string_ | ||
API key that is being send using the `x-goog-api-key` header. | ||
It defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable. | ||
- **headers** _Record<string,string>_ | ||
Custom headers to include in the requests. | ||
## Models | ||
@@ -58,1 +67,11 @@ | ||
``` | ||
The following optional settings are available for Google Generative AI models: | ||
- **topK** _number_ | ||
Optional. The maximum number of tokens to consider when sampling. | ||
Models use nucleus sampling or combined Top-k and nucleus sampling. | ||
Top-k sampling considers the set of topK most probable tokens. | ||
Models running with nucleus sampling don't allow topK setting. |
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
113481
1544
76
+ Added@ai-sdk/provider-utils@0.0.4(transitive)
- Removed@ai-sdk/provider-utils@0.0.3(transitive)
Updated@ai-sdk/provider-utils@0.0.4