-
Notifications
You must be signed in to change notification settings - Fork 169
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
Add more samples in standardized format #199
Conversation
samples/node/safety_settings.js
Outdated
const unsafePrompt = | ||
"I support Martians Soccer Club and I think " + | ||
"Jupiterians Football Club sucks! Write a ironic phrase about them."; | ||
|
||
const result = await model.generateContent(unsafePrompt); | ||
|
||
try { | ||
result.response.text(); | ||
} catch (e) { | ||
console.error(e); | ||
console.log(result.response.candidates[0].safetyRatings); | ||
} | ||
// [END safety_settings] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws an error around half the time for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a modification that seems to trigger it every time I've tried, let me know what you think.
samples/node/safety_settings.js
Outdated
} | ||
|
||
async function run() { | ||
// await safetySettings(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to un-comment this call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed.
Adding the following samples in the new standardized sample format.
See https://docs.google.com/spreadsheets/d/10X--DI0YPL3QfEMObe387rYg0t4-kuv33yKn2TIal7E/edit?resourcekey=0-kfy1Ry4YAZh6O4DltLjV9w&gid=0#gid=0 (internal)