Skip to content

feat(config): let indexed multi-LLM members configure Vertex AI project/region#2384

Open
cdbartholomew wants to merge 1 commit into
mainfrom
feat/multi-llm-vertexai-member-fields
Open

feat(config): let indexed multi-LLM members configure Vertex AI project/region#2384
cdbartholomew wants to merge 1 commit into
mainfrom
feat/multi-llm-vertexai-member-fields

Conversation

@cdbartholomew

Copy link
Copy Markdown
Contributor

Summary

Extends the indexed multi-LLM layer (#2365) so a vertexai member can actually be used in a failover / round-robin chain.

Today an indexed member (HINDSIGHT_API_LLM_<n>_*) carries only provider / api_key / model / base_url. The vertexai provider additionally needs a project id (and a region; it defaults to us-central1) — GeminiLLM._init_vertexai raises "VERTEXAI_PROJECT_ID is required" without one. And LLMProvider.__init__ previously sourced Vertex project/region only from global config via get_config(), with no way to set them per instance. Net effect: vertexai could not be a member of a chain — only the global/primary provider.

Change

  • LLMMemberConfig: add optional vertexai_project_id / vertexai_region.
  • _parse_llm_members: read {prefix}LLM_{n}_VERTEXAI_PROJECT_ID / _VERTEXAI_REGION (global and the RETAIN_/REFLECT_/CONSOLIDATION_ per-op prefixes), mirroring the existing per-member env keys.
  • _member_to_llm: thread the two fields into the member's LLMConfig.
  • LLMProvider.__init__: accept vertexai_project_id / vertexai_region; an explicit per-instance value wins, otherwise fall back to global config (llm_vertexai_project_id / llm_vertexai_regionus-central1). Single-LLM setups are unchanged.

Why

Without this, a multi-LLM chain can only fail over between key-based providers; a vertexai member can't initialize. This lets operators run, e.g., a key-based primary with a Vertex AI failover member (or vice-versa) targeting a specific project/region.

Tests

tests/test_multi_llm_config.py (+4):

  • vertexai member parses project/region (global prefix)
  • per-op prefix (REFLECT_) parses them
  • a non-vertex member leaves the fields None (no regression)
  • build path: the member's own project/region reach the Vertex client (SDK client patched; no live call), proving per-instance values are used rather than the global fallback

uv run pytest tests/test_multi_llm_config.py tests/test_multi_llm_provider.py → 38 passed. ruff check / ruff format --check / ty check clean.

Notes / non-goals

  • Single-LLM / global-config Vertex behavior is unchanged (global fallback preserved).
  • Retry/fast-fail behavior is unchanged — that's existing config (HINDSIGHT_API_LLM_MAX_RETRIES, per-op overrides) layered on top of the chain.

…ct/region

Indexed multi-LLM members previously carried only provider/api_key/model/
base_url, so a 'vertexai' member could not initialize (its client requires a
project id, and the region defaults to us-central1). That made vertexai
unusable as a member of a failover/round-robin chain.

Add optional vertexai_project_id / vertexai_region to LLMMemberConfig, parse
them from {prefix}LLM_{n}_VERTEXAI_PROJECT_ID / _VERTEXAI_REGION (global and
per-op prefixes), thread them through the member build path, and accept them on
LLMProvider so an explicit per-instance value wins while existing single-LLM
setups still fall back to the global config.
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.

1 participant