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

Add more samples in standardized format #199

Merged
merged 7 commits into from
Jul 8, 2024
Merged

Add more samples in standardized format #199

merged 7 commits into from
Jul 8, 2024

Conversation

hsubox76
Copy link
Collaborator

@hsubox76 hsubox76 commented Jul 3, 2024

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)

filename region tag
function_calling function_calling
controlled_generation json_controlled_generation
controlled_generation json_no_schema
model_configuration configure_model
safety_settings safety_settings
safety_settings safety_settings_multi
system_instruction system_instruction

@hsubox76 hsubox76 marked this pull request as ready for review July 3, 2024 19:53
@hsubox76 hsubox76 requested a review from dlarocque July 3, 2024 19:53
Comment on lines 37 to 49
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]
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

}

async function run() {
// await safetySettings();
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed.

@dlarocque dlarocque self-requested a review July 8, 2024 20:17
@hsubox76 hsubox76 merged commit 41389e8 into main Jul 8, 2024
8 checks passed
@hsubox76 hsubox76 deleted the ch-samples-misc branch July 8, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants