Skip to content

Commit 38619a7

Browse files
committed
fix: correct HeyGen deprecation warning stacklevel for model_post_init
1 parent 0be1014 commit 38619a7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/agora_agent/agentkit/vendors/avatar.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ def validate_quality(cls, v: str) -> str:
8181
return v
8282

8383
def model_post_init(self, __context: Any) -> None:
84+
# stacklevel=3: warn() <- model_post_init <- pydantic __init__ <- user code,
85+
# so the warning points at the user's construction site, not pydantic internals.
8486
warnings.warn(
8587
"HeyGenAvatar is deprecated; use LiveAvatarAvatar instead.",
8688
DeprecationWarning,
87-
stacklevel=2,
89+
stacklevel=3,
8890
)
8991

9092
@property

0 commit comments

Comments
 (0)