fix: enhance type hinting and null checks in LLMQuotaLayer for model instance extraction

This commit is contained in:
Novice 2026-03-24 11:11:40 +08:00
parent c189de10f1
commit 59ab7382b8
No known key found for this signature in database
GPG Key ID: A253106A7475AA3E
1 changed files with 2 additions and 2 deletions

View File

@ -108,8 +108,8 @@ class LLMQuotaLayer(GraphEngineLayer):
def _extract_model_instance(node: Node) -> ModelInstance | None:
match node.node_type:
case BuiltinNodeTypes.LLM | BuiltinNodeTypes.PARAMETER_EXTRACTOR | BuiltinNodeTypes.QUESTION_CLASSIFIER:
instance = getattr(node, "model_instance", None)
if isinstance(instance, ModelInstance):
instance: ModelInstance | None = getattr(node, "model_instance", None)
if instance is not None:
return instance
logger.warning(
"LLMQuotaLayer skipped quota deduction because node does not expose a model instance,"