Include examples in type checking
Remove `examples/` from the `pyrightconfig.json` ignore list and fix
the resulting type errors across all example files. Common fixes:
- Required API keys: `os.getenv("X")` -> `os.environ["X"]` so the
return type is `str` rather than `str | None`, and misconfiguration
fails fast.
- Narrow `LLMContextMessage` union members with `isinstance(..., dict)`
before dict-style access.
- `assert isinstance(params.llm, ...)` before calling service-specific
methods that aren't on the base `LLMService`.
- Guard optional frame fields (e.g. `LLMSearchResponseFrame.search_result`)
before use.
This commit is contained in:
@@ -54,9 +54,12 @@ transport_params = {
|
||||
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
logger.info(f"Starting bot")
|
||||
|
||||
region = os.getenv("GLADIA_REGION", "us-west")
|
||||
assert region in ("us-west", "eu-west"), f"Invalid GLADIA_REGION: {region}"
|
||||
|
||||
stt = GladiaSTTService(
|
||||
api_key=os.getenv("GLADIA_API_KEY", ""),
|
||||
region=os.getenv("GLADIA_REGION"),
|
||||
api_key=os.environ["GLADIA_API_KEY"],
|
||||
region=region,
|
||||
settings=GladiaSTTService.Settings(
|
||||
language_config=LanguageConfig(
|
||||
languages=[Language.EN],
|
||||
|
||||
Reference in New Issue
Block a user