Skip to content

fix: migrate model type enum construction#36550

Draft
WH-2099 wants to merge 1 commit into
mainfrom
fix/model-type-enum-construction
Draft

fix: migrate model type enum construction#36550
WH-2099 wants to merge 1 commit into
mainfrom
fix/model-type-enum-construction

Conversation

@WH-2099
Copy link
Copy Markdown
Member

@WH-2099 WH-2099 commented May 23, 2026

Summary

  • replace Graphon ModelType.value_of(...) usages with direct ModelType(...) construction
  • cover provider management and model load-balancing call sites
  • prepare Dify for the Graphon enum alias parsing change in fix: support model type alias parsing graphon#157

Merge note

This PR is intentionally blocked until langgenius/graphon#157 is merged, released, and the Dify Graphon dependency is upgraded to that release. Before that dependency upgrade, ModelType(...) may not accept legacy provider model type aliases such as embeddings, text-generation, and reranking.

Validation

  • uv run --project api ruff format --check api/core/provider_manager.py api/services/model_load_balancing_service.py api/services/model_provider_service.py
  • uv run --project api ruff check api/core/provider_manager.py api/services/model_load_balancing_service.py api/services/model_provider_service.py

Closes #36549

@WH-2099 WH-2099 self-assigned this May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 44.96% 44.96% 0.00%
Strict coverage 44.48% 44.48% 0.00%
Typed symbols 23,177 23,177 0
Untyped symbols 28,682 28,682 0
Modules 2610 2610 0

@WH-2099 WH-2099 requested a review from asukaminato0721 May 23, 2026 11:00
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 23, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.11%. Comparing base (72ee50c) to head (521545d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #36550      +/-   ##
==========================================
- Coverage   86.11%   86.11%   -0.01%     
==========================================
  Files        4483     4483              
  Lines      214917   214917              
  Branches    39897    39897              
==========================================
- Hits       185068   185066       -2     
- Misses      26457    26459       +2     
  Partials     3392     3392              
Flag Coverage Δ
api 85.75% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: migrate model type enum construction

2 participants