Skip to content
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion genai/text-generation/textgen-with-txt-img.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function generateContent(
};

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For improved maintainability and readability, it's a good practice to declare string literals for configuration, like model names, as constants. This avoids using 'magic strings' directly in the code.

By defining it as a constant at the top of the file, it becomes easier to locate and update. This is particularly helpful for values that might change, such as model versions.

Example:

const MODEL_NAME = 'gemini-2.5-flash';

// ... later in the code
const response = await ai.models.generateContent({
  model: MODEL_NAME,
  // ...
});

contents: [image, 'What is shown in this image?'],
});

Expand Down
Loading