Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vue/solid/svelte) keepLastMessageOnError #2269

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat (provider/google): add cachedContent optional setting (#2261)
lgrammel authored Jul 12, 2024
commit 2e59d2661b031b5ea8eac340010cb947245c9c45
5 changes: 5 additions & 0 deletions .changeset/cool-donkeys-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/google': patch
---

feat (provider/google): add cachedContent optional setting
Original file line number Diff line number Diff line change
@@ -93,6 +93,11 @@ The following optional settings are available for Google Generative AI models:
Top-k sampling considers the set of topK most probable tokens.
Models running with nucleus sampling don't allow topK setting.

- **cachedContent** _string_

Optional. The name of the cached content used as context to serve the prediction.
Format: cachedContents/{cachedContent}

- **safetySettings** _Array\<\{ category: string; threshold: string \}\>_

Optional. Safety settings for the model.
3 changes: 3 additions & 0 deletions packages/google/src/google-generative-ai-language-model.ts
Original file line number Diff line number Diff line change
@@ -110,6 +110,7 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV1 {
systemInstruction,
safetySettings: this.settings.safetySettings,
...prepareToolsAndToolConfig(mode),
cachedContent: this.settings.cachedContent,
},
warnings,
};
@@ -125,6 +126,7 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV1 {
contents,
systemInstruction,
safetySettings: this.settings.safetySettings,
cachedContent: this.settings.cachedContent,
},
warnings,
};
@@ -146,6 +148,7 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV1 {
},
toolConfig: { functionCallingConfig: { mode: 'ANY' } },
safetySettings: this.settings.safetySettings,
cachedContent: this.settings.cachedContent,
},
warnings,
};
7 changes: 7 additions & 0 deletions packages/google/src/google-generative-ai-settings.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,13 @@ Models running with nucleus sampling don't allow topK setting.
*/
topK?: number;

/**
Optional.
The name of the cached content used as context to serve the prediction.
Format: cachedContents/{cachedContent}
*/
cachedContent?: string;

/**
Optional. A list of unique safety settings for blocking unsafe content.
*/