Skip to content

fix(contrib): repair language model registry and open-ended questionnaire - #296

Open
rootkiller6788 wants to merge 1 commit into
google-deepmind:mainfrom
rootkiller6788:fix-lm-registry-and-openended-embedder
Open

fix(contrib): repair language model registry and open-ended questionnaire#296
rootkiller6788 wants to merge 1 commit into
google-deepmind:mainfrom
rootkiller6788:fix-lm-registry-and-openended-embedder

Conversation

@rootkiller6788

Copy link
Copy Markdown
Contributor

Summary

Fixes two crash/breakage bugs in concordia:

1. Language-model setup registry is stale

language_models._REGISTRY still mapped gemini_vision to google.gemini_model_vision.GeminiModelVision, but the migration to the google.genai package (commit 8b4b156) renamed that module to gemini_model_multimodal.py. As a result language_model_setup(api_type='gemini_vision') failed to import the model and raised a misleading "please install dependencies" error even with everything installed.

The same migration dropped the google_aistudio api_type from the registry entirely, even though it remains the default api_type in every example run script and in the generate_personas CLI. Default invocations therefore crash immediately with ValueError: Unrecognized api_type: google_aistudio.

2. OpenEndedQuestionnaire crashes when no embedder is provided

OpenEndedQuestionnaire documents embedder as optional (defaults to None), but _process_answer called self._embedder(...) unconditionally for free/open-ended questions, raising TypeError: 'NoneType' object is not callable on the first answer. The sibling AsynchronousQuestionnaire handles this by falling back to the raw answer text; this change does the same.

Test plan

  • New regression tests for both fixes (verified to fail against the original code).
  • pytest concordia/contrib/language_models/ concordia/components/game_master/open_ended_questionnaire_test.py — pass.
  • pylint --errors-only on changed files — clean.
  • pyrefly check on changed files — 0 errors.

…aire

- point the gemini_vision registry entry at the renamed
  gemini_model_multimodal module so language_model_setup no longer
  fails to import it
- register google_aistudio, the api_type used by the example run
  scripts and the persona generator CLI, which the registry had
  dropped during the google.genai migration
- guard OpenEndedQuestionnaire._process_answer against a missing
  embedder (defaults to None) so answering a free-text question
  without an embedder stores the raw text instead of crashing

Add regression tests for both fixes.
copybara-service Bot pushed a commit that referenced this pull request Sep 4, 2026
--
621d618 by rootkiller6788 <rootkiller6788@users.noreply.github.com>:

fix(contrib): repair language model registry and open-ended questionnaire

- point the gemini_vision registry entry at the renamed
  gemini_model_multimodal module so language_model_setup no longer
  fails to import it
- register google_aistudio, the api_type used by the example run
  scripts and the persona generator CLI, which the registry had
  dropped during the google.genai migration
- guard OpenEndedQuestionnaire._process_answer against a missing
  embedder (defaults to None) so answering a free-text question
  without an embedder stores the raw text instead of crashing

Add regression tests for both fixes.

COPYBARA_INTEGRATE_REVIEW=#296 from rootkiller6788:fix-lm-registry-and-openended-embedder 621d618
PiperOrigin-RevId: 976275954
Change-Id: I0cd88c00b41d65e97c0776cbd254958a347f72a5
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.

2 participants