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

Fixes for Gemini inside Vertex #11511

Merged

Conversation

tbeamish-benchsci
Copy link
Contributor

@tbeamish-benchsci tbeamish-benchsci commented Feb 29, 2024

Description

  1. Gemini requires an even message count and, in the Gemini LLM, we merge_neighboring_same_role_messages. This PR does the same thing in the Vertex LLM if we're using Gemini.

  2. We also set the default system_role in the LLMMetadata to be System.USER only if we're using Gemini, since Gemini only supports "user" and "model" roles.

  3. Finally we ensure the role of each message in Vertex is set to the appropriate MessageRole

NOTE: This change adds/updates NO UNIT TESTs to support it.

Fixes # (#11439)

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • I stared at the code and made sure it makes sense

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@tbeamish-benchsci tbeamish-benchsci force-pushed the fixes-for-gemini-in-vertex branch 2 times, most recently from 295872c to 2fd9b0e Compare March 4, 2024 22:17
@tbeamish-benchsci tbeamish-benchsci marked this pull request as ready for review March 4, 2024 22:42
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 4, 2024
Copy link
Collaborator

@logan-markewich logan-markewich left a comment

Choose a reason for hiding this comment

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

this looks good to me, thanks @tbeamish-benchsci !

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 4, 2024
@logan-markewich logan-markewich merged commit c5bed00 into run-llama:main Mar 5, 2024
8 checks passed
@tbeamish-benchsci tbeamish-benchsci deleted the fixes-for-gemini-in-vertex branch March 5, 2024 17:01
k8si added a commit to Mozilla-Ocho/llama_index that referenced this pull request Mar 5, 2024
* main: (61 commits)
  bump anthropic versions  (run-llama#11654)
  Fixes for Gemini inside Vertex (run-llama#11511)
  Update multimodal anthropic docs (run-llama#11643)
  fix anthropic tokenizer  (run-llama#11636)
  extend claude 3 multimodal cookbook (run-llama#11639)
  fix pydantic (run-llama#11631)
  Added Nest Asyncio to Opensearch Client Init to Support ASGI applicat… (run-llama#11622)
  update readmes (run-llama#11627)
  typo in chat refine prompt (run-llama#11628)
  Add Anthropic Multi Modal (run-llama#11623)
  Add Vertex AI Text Embedding and Multimodal Embedding (run-llama#11561)
  Update anthropic models (run-llama#11612)
  Bumped Opensearch Integration Version (run-llama#11618)
  Solve issue of duplicate Settings classes (run-llama#11606)
  fix composable retrieval (run-llama#11617)
  Updated AzureCosmosDBMongoDBVectorSearch to Pydantic Vector Store base class (run-llama#11613)
  Updated model information for Perplexity.ai (run-llama#11603)
  Solve issue in custom_agent document ,  RetryAgentWorker._run_step() got an unexpected keyword argument 'input' (run-llama#11611)
  Fix empty metadata error for CSV Reader (run-llama#11563)
  Feature: Improve batch embedding generation throughput for Cohere in Bedrock (run-llama#11572)
  ...
bdonkey added a commit to bdonkey/gpt_index that referenced this pull request Mar 11, 2024
* main:
  bump anthropic versions  (run-llama#11654)
  Fixes for Gemini inside Vertex (run-llama#11511)
  Update multimodal anthropic docs (run-llama#11643)
  fix anthropic tokenizer  (run-llama#11636)
  extend claude 3 multimodal cookbook (run-llama#11639)
  fix pydantic (run-llama#11631)
  Added Nest Asyncio to Opensearch Client Init to Support ASGI applicat… (run-llama#11622)
  update readmes (run-llama#11627)
  typo in chat refine prompt (run-llama#11628)
  Add Anthropic Multi Modal (run-llama#11623)
  Add Vertex AI Text Embedding and Multimodal Embedding (run-llama#11561)
  Update anthropic models (run-llama#11612)
  Bumped Opensearch Integration Version (run-llama#11618)
  Solve issue of duplicate Settings classes (run-llama#11606)
  fix composable retrieval (run-llama#11617)
  Updated AzureCosmosDBMongoDBVectorSearch to Pydantic Vector Store base class (run-llama#11613)
  Updated model information for Perplexity.ai (run-llama#11603)
  Solve issue in custom_agent document ,  RetryAgentWorker._run_step() got an unexpected keyword argument 'input' (run-llama#11611)
  Fix empty metadata error for CSV Reader (run-llama#11563)
Izukimat pushed a commit to Izukimat/llama_index that referenced this pull request Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants