fix(bodies): type make_body_with_llm persona parameter via TYPE_CHECKING
The persona arg was typed Any to avoid a circular import. Added a TYPE_CHECKING guard to import EmailPersona annotation-only so mypy has the type without a runtime import cycle.
This commit is contained in:
@@ -25,11 +25,14 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import secrets
|
||||
from datetime import datetime, timezone
|
||||
from typing import Callable, Optional
|
||||
from typing import TYPE_CHECKING, Callable, Optional
|
||||
|
||||
from decnet.logging import get_logger
|
||||
from decnet.realism.taxonomy import ContentClass
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from decnet.realism.personas import EmailPersona
|
||||
|
||||
log = get_logger("realism.bodies")
|
||||
|
||||
|
||||
@@ -242,7 +245,7 @@ def make_body(
|
||||
|
||||
async def make_body_with_llm(
|
||||
content_class: ContentClass,
|
||||
persona, # EmailPersona — typed loosely to avoid an import cycle
|
||||
persona: "EmailPersona",
|
||||
*,
|
||||
llm=None, # LLMBackend | None
|
||||
breaker=None, # LLMCircuitBreaker | None
|
||||
|
||||
Reference in New Issue
Block a user