-
Notifications
You must be signed in to change notification settings - Fork 166
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 canonical textgen samples #196
Conversation
samples/node/text_generation.js
Outdated
@@ -0,0 +1,258 @@ | |||
/** | |||
* @license | |||
* Copyright 2023 Google LLC |
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.
Since these are new files I think they should have 2024 Copyrights.
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.
Done.
samples/node/text_generation.js
Outdated
|
||
const result = await model.generateContentStream([prompt, imagePart]); | ||
|
||
// print text as it comes in |
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.
Add a period. I think this repeats in a few places.
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.
Done.
Made some more changes after doing live tests:
|
This is part of a larger project to convert samples to a standard format across all languages that can be used in devsite.
See internal doc: https://docs.google.com/spreadsheets/d/10X--DI0YPL3QfEMObe387rYg0t4-kuv33yKn2TIal7E/edit?resourcekey=0-kfy1Ry4YAZh6O4DltLjV9w&gid=0#gid=0
This PR addresses the first file ("text_generation") described in that doc which includes 9 examples. The code to be used in docs is delineated with [START] and [END] region tags marked with the canonical name for that sample.
Media files were taken from the live docs site (https://ai.google.dev/gemini-api/docs/vision?lang=node#technical-details-video) when available and from the Python repo when not available (e.g., audio sample): https://github.com/google-gemini/generative-ai-python/tree/main/third_party
I will delete and replace existing samples files in future PRs as the new samples for those cases are written.