Skip to content

refactor(api): type app parameter feature toggles with FeatureToggleD…#34651

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
YB0y:refactor/typed-dict-app-parameters
Apr 7, 2026
Merged

refactor(api): type app parameter feature toggles with FeatureToggleD…#34651
asukaminato0721 merged 1 commit intolanggenius:mainfrom
YB0y:refactor/typed-dict-app-parameters

Conversation

@YB0y
Copy link
Copy Markdown
Contributor

@YB0y YB0y commented Apr 7, 2026

Summary

  • Add FeatureToggleDict TypedDict with key enabled (bool)
  • Tighten 6 fields in AppParametersDict from dict[str, Any] to FeatureToggleDict: suggested_questions_after_answer, speech_to_text, text_to_speech, retriever_resource, annotation_reply, more_like_this

Why this change

These 6 fields all follow the same {"enabled": bool} pattern — the function constructs them with features_dict.get("...", {"enabled": False}). Using dict[str, Any] hides this common structure. FeatureToggleDict makes the toggle pattern explicit and reusable.

sensitive_word_avoidance and file_upload are left as dict[str, Any] since they have additional nested keys beyond enabled.

Changes

  • core/app/app_config/common/parameters_mapping/__init__.py: Define FeatureToggleDict, update 6 fields in AppParametersDict

Test plan

  • ruff check passes

Part of #32863 (core/app/app_config/common/parameters_mapping/__init__.py)

@YB0y YB0y requested a review from QuantumGhost as a code owner April 7, 2026 05:19
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. refactor labels Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Pyrefly Diff

No changes detected.

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 7, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 7, 2026
Merged via the queue into langgenius:main with commit 84d8940 Apr 7, 2026
27 checks passed
@YB0y YB0y deleted the refactor/typed-dict-app-parameters branch April 8, 2026 13:35
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 refactor size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants