Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions backend/app/core/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ class ProviderConfig:
Provider.GOOGLE: ProviderConfig(
required_fields=[
"api_key",
"project_id",
"location",
"sa_key",
"gcs_bucket",
],
sensitive_fields=["api_key", "sa_key"],
sensitive_fields=["api_key"],
Comment thread
Prajna1999 marked this conversation as resolved.
),
Provider.WEBHOOK_SECRET: ProviderConfig(
required_fields=["webhook_secret"], sensitive_fields=["webhook_secret"]
Expand Down
5 changes: 0 additions & 5 deletions backend/app/services/llm/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,6 @@ def transform_kaapi_config_to_native(
)

if kaapi_config.provider == Provider.GOOGLE:
if kaapi_config.type not in (CompletionType.STT, CompletionType.TTS):
raise ValueError(
f"google provider does not support completion type '{kaapi_config.type}'. "
"Use the 'google-aistudio' provider for text completions."
)
# Kaapi STT/TTS param shape is identical to Google's; reuse the Google mapper.
mapped_params, warnings = map_kaapi_to_google_params(
kaapi_config.params, kaapi_config.type
Expand Down
20 changes: 9 additions & 11 deletions backend/app/tests/services/llm/test_mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,25 +887,23 @@ def test_temperature_zero_is_preserved(self):

class TestTransformGoogleVertexRouting:
"""Routing contract for the ``google`` provider (which executes via
Vertex AI). Text completions are explicitly rejected — they must go
through the ``google-aistudio`` provider."""
Vertex AI)."""

def test_text_completion_is_rejected(self, db: Session):
"""``google`` is audio-only (Vertex STT/TTS) — text completions
must be routed through ``google-aistudio``."""
def test_text_completion_maps_via_google_mapper(self, db: Session):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the missing -> None return annotation.

As per coding guidelines: **/*.py: Use type hints on every function parameter and return value.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/app/tests/services/llm/test_mappers.py` at line 892, Update the
test_text_completion_maps_via_google_mapper method signature to include the
missing None return annotation, while retaining the existing db: Session
parameter annotation.

Source: Coding guidelines

"""``google`` text completions reuse the Google mapper and produce a
``google-native`` config (param shape is identical to Google's)."""
kaapi_config = KaapiCompletionConfig(
provider="google",
type="text",
params={"model": "gemini-2.5-pro"},
)

with pytest.raises(ValueError) as exc_info:
transform_kaapi_config_to_native(session=db, kaapi_config=kaapi_config)
native_config, warnings = transform_kaapi_config_to_native(
session=db, kaapi_config=kaapi_config
)

msg = str(exc_info.value)
assert "google" in msg
assert "text" in msg
assert "google-aistudio" in msg # hints the caller toward the right provider
assert native_config.provider == "google-native"
assert native_config.params["model"] == "gemini-2.5-pro"

def test_unsupported_language_emits_warning(self, db: Session):
"""Languages not in BCP47_LOCALE_TO_GEMINI_LANG fall back to auto-detect
Expand Down
Loading