Skip to content

Conversation

@Surjasa
Copy link

@Surjasa Surjasa commented Nov 7, 2025

Wrong Tutorial issue #1030
Summary:

-The notebook Talk_to_documents_with_embeddings.ipynb used the same embedding type for both query and document, and used the lowercase string retrieval_document.

That is incorrect: document embeddings should use RETRIEVAL_DOCUMENT and query embeddings should use RETRIEVAL_QUERY (with the exact casing used by the SDK constants).

-This change corrects the embedding type names and casing in the notebook and normalizes notebook metadata per the repository style (execution_count: null and cleared outputs) so diffs are minimal and consistent.

What I changed:
Updated the notebook cell(s) that constructed/used embeddings so:
-document embeddings use RETRIEVAL_DOCUMENT
-query embeddings use RETRIEVAL_QUERY (where appropriate)
-corrected any occurrences of the lowercase retrieval_document to the proper constant
-Ran notebook normalization/formatting to ensure execution_count is null and outputs are empty (no runtime output saved).

Why this fixes the issue:
Using the correct embedding type and casing matches the SDK/guide expectations and prevents incorrect behavior or confusion when users copy the example.

Fixes issue #1030

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Nov 7, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Surjasa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the "Talk_to_documents_with_embeddings.ipynb" example by rectifying the embedding task type configurations and standardizing the notebook's metadata. The primary goal is to ensure the example accurately demonstrates the usage of "RETRIEVAL_DOCUMENT" and "RETRIEVAL_QUERY" constants, thereby preventing potential user confusion and aligning with SDK expectations.

Highlights

  • Embedding Type Correction: The notebook now correctly distinguishes between "RETRIEVAL_DOCUMENT" for document embeddings and "RETRIEVAL_QUERY" for query embeddings, addressing an issue where both used the same type or incorrect casing.
  • Notebook Normalization: Jupyter notebook metadata has been standardized by setting "execution_count" to null and clearing all cell outputs, ensuring cleaner diffs and consistent repository style.
  • Documentation Update: Explanatory text within the notebook has been updated to accurately reflect the required "RETRIEVAL_QUERY" and "RETRIEVAL_DOCUMENT" task types for the "gemini-embedding-001" model.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request does a great job of correcting the embedding types and casing in the Talk_to_documents_with_embeddings.ipynb notebook, aligning it with the SDK's best practices. The normalization of notebook metadata is also a good cleanup step. I found one place where a query embedding still uses an incorrect task_type, which I've pointed out in a specific comment. Once that's addressed, this will be a solid improvement.

@Surjasa Surjasa mentioned this pull request Nov 7, 2025
@Surjasa Surjasa changed the title Fix embedding types & casing (#1030) Fix embedding types & casing Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant