(context: Mapping[str, str] | BaseModel, key: str)
| 53 | |
| 54 | |
| 55 | def read_context_value(context: Mapping[str, str] | BaseModel, key: str) -> str | None: |
| 56 | # either dict or pydantic model |
| 57 | if isinstance(context, Mapping): |
| 58 | return context.get(key) |
| 59 | return getattr(context, key, None) |
| 60 | |
| 61 | |
| 62 | async def main() -> None: |