Skip to content

Conversation

@scotbrew
Copy link

@scotbrew scotbrew commented Dec 6, 2025

Description of changes

The gemini example uses invalid capitalization for the embedding function, resulting in an error. Correcting to use the current function name.

In examples/gemini/ for load_data.py and main.py:
Change
embedding_functions.GoogleGenerativeAIEmbeddingFunction
to
embedding_functions.GoogleGenerativeAiEmbeddingFunction

Fixes: #5977

Test plan

As described in README.md, execute the standard steps:

pip install -r requirements.txt
python load_data.py
python main.py

All should now execute properly.

Migration plan

N/A

Observability plan

N/A

Documentation Changes

None

The gemini example used invalid capitalization for the embedding function, resulting in an error.  Correcting to use the expected function name.

Change
  embedding_functions.GoogleGenerativeAIEmbeddingFunction
to
  embedding_functions.GoogleGenerativeAiEmbeddingFunction
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Dec 6, 2025

Fix Gemini example embedding setup and batching logic

The PR updates examples/gemini/load_data.py and examples/gemini/main.py to use embedding_functions.GoogleGenerativeAiEmbeddingFunction, explicitly pass model_name='gemini-embedding-001', and switch the chat model to genai.GenerativeModel('gemini-2.5-flash'). It also reworks document ingestion to build an explicit ids list, load documents in small batches, and records the Gemini example storage folder in .gitignore.

Key Changes

• Replace embedding_functions.GoogleGenerativeAIEmbeddingFunction with embedding_functions.GoogleGenerativeAiEmbeddingFunction in both example scripts and wire in model_name='gemini-embedding-001'.
• Instantiate genai.GenerativeModel('gemini-2.5-flash') for querying in examples/gemini/main.py.
• Introduce an ids accumulator, smaller batch size, and revised batching loop around collection.add in examples/gemini/load_data.py.
• Ignore examples/gemini*/chroma_storage/ outputs via .gitignore.

Affected Areas

• examples/gemini/load_data.py
• examples/gemini/main.py
• .gitignore

This summary was automatically generated by @propel-code-bot

Copy link
Member

@philipithomas philipithomas left a comment

Choose a reason for hiding this comment

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

Thank you for this fix!

@philipithomas philipithomas enabled auto-merge (squash) December 8, 2025 22:48
@philipithomas philipithomas changed the title In gemini example, correct embedding function name [DOC] In gemini example, correct embedding function name Dec 8, 2025
@scotbrew
Copy link
Author

scotbrew commented Dec 9, 2025

The first iteration of this PR addresses a clear function name syntax error. Further changes needed though to address logic as well as Gemini model changes. Awaiting quota reset for further testing.

* Revise ids list to align with documents and metadatas lists
* Specify model_name='gemini-embedding-001' for embedding function.
* Fix to logic for continuing document upload if collections not empty.
* Revise batch_size to work with Free Tier.

TODO: Consider changing the defaults in the embedding_function classes.
auto-merge was automatically disabled December 10, 2025 03:23

Head branch was pushed to by a user without write access

@scotbrew
Copy link
Author

Revised collections.add() logic in load_data.py to work with non-empty collection.
Changed batch_size for loading documents.
Updated gemini model for embedding.
Changed gemini query model to a simpler model.

Loading documents now able to be properly tested. Awaiting quota reset for query testing.

* Align the embedding function model in main.py to match the same embedding function model used in load_data.py.
* Remove the task_type to use the default.
@scotbrew
Copy link
Author

After the latest modification to main.py to align the embedding model with the same one used now in load_data.py, the script now successfully executes and provides a query response as expected. It no longer errors out with You exceeded your current quota.

Full testing of example script execution now succeeds.

@scotbrew
Copy link
Author

As the scope increased to address logic and the embedding model, should the title be revised?

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.

[Bug]: Invalid embedding function GoogleGenerativeAIEmbeddingFunction used in Gemini example

2 participants