You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Previous messages in the conversation. Each item must be a valid JSON string with `text` and `role` (either `user` or `model`). Example: `{\"text\": \"Hello\", \"role\": \"user\"}`",
40
+
optional: true,
41
+
},
42
+
safetySettings: {
43
+
type: "string[]",
44
+
label: "Safety Settings",
45
+
description: "Configure content filtering for different harm categories. Each item must be a valid JSON string with `category` (one of: `HARASSMENT`, `HATE_SPEECH`, `SEXUALLY_EXPLICIT`, `DANGEROUS`, `CIVIC`) and `threshold` (one of: `BLOCK_NONE`, `BLOCK_ONLY_HIGH`, `BLOCK_MEDIUM_AND_ABOVE`, `BLOCK_LOW_AND_ABOVE`). Example: `{\"category\": \"HARASSMENT\", \"threshold\": \"BLOCK_MEDIUM_AND_ABOVE\"}`",
46
+
optional: true,
47
+
},
48
+
},
49
+
methods: {
50
+
formatHistoryToContent(history){
51
+
if(!history?.length){
52
+
return[];
53
+
}
54
+
55
+
returnhistory.map((itemStr)=>{
56
+
letitem;
57
+
try{
58
+
item=JSON.parse(itemStr);
59
+
}catch(e){
60
+
thrownewConfigurationError(`Invalid JSON in history item: ${itemStr}`);
61
+
}
62
+
63
+
if(!item.text||!item.role||![
64
+
"user",
65
+
"model",
66
+
].includes(item.role)){
67
+
thrownewConfigurationError("Each history item must include `text` and `role` (either `user` or `model`)");
68
+
}
69
+
70
+
return{
71
+
parts: [
72
+
{
73
+
text: item.text,
74
+
},
75
+
],
76
+
role: item.role,
77
+
};
78
+
});
79
+
},
80
+
formatSafetySettings(safetySettings){
81
+
if(!safetySettings?.length){
82
+
returnundefined;
83
+
}
84
+
85
+
returnsafetySettings.map((settingStr)=>{
86
+
letsetting;
87
+
try{
88
+
setting=JSON.parse(settingStr);
89
+
}catch(e){
90
+
thrownewConfigurationError(`Invalid JSON in safety setting: ${settingStr}`);
91
+
}
92
+
93
+
if(!setting.category||!setting.threshold){
94
+
thrownewConfigurationError("Each safety setting must include 'category' and 'threshold'");
Copy file name to clipboardExpand all lines: components/google_gemini/actions/generate-content-from-text-and-image/generate-content-from-text-and-image.mjs
description: "Generates content from both text and image input using the Gemini API. [See the documentation](https://ai.google.dev/tutorials/rest_quickstart#text-and-image_input)",
Copy file name to clipboardExpand all lines: components/google_gemini/actions/generate-content-from-text/generate-content-from-text.mjs
+17-25
Original file line number
Diff line number
Diff line change
@@ -6,28 +6,15 @@ export default {
6
6
key: "google_gemini-generate-content-from-text",
7
7
name: "Generate Content from Text",
8
8
description: "Generates content from text input using the Google Gemini API. [See the documentation](https://ai.google.dev/tutorials/rest_quickstart#text-only_input)",
0 commit comments