mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
core/agent: clear basedpyright warnings on Responses adapter
This commit is contained in:
@@ -146,10 +146,11 @@ def _reasoning_summary_text(response: Response) -> str:
|
||||
summary = raw.get("summary")
|
||||
if not isinstance(summary, list):
|
||||
continue
|
||||
for block in summary:
|
||||
if not isinstance(block, dict):
|
||||
summary_items = cast("list[object]", summary)
|
||||
for block_obj in summary_items:
|
||||
if not isinstance(block_obj, dict):
|
||||
continue
|
||||
block_map = cast("dict[str, object]", block)
|
||||
block_map = cast("dict[str, object]", block_obj)
|
||||
if block_map.get("type") in {"summary_text", "output_text"}:
|
||||
text = block_map.get("text")
|
||||
if isinstance(text, str) and text:
|
||||
@@ -258,7 +259,7 @@ def usage_chunk_from_response(response: Response, *, model: str) -> ChatCompleti
|
||||
created=created,
|
||||
model=model,
|
||||
choices=[],
|
||||
usage=cast("dict[str, Any]", response.usage),
|
||||
usage=response.usage,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ class ResponsesChatClient:
|
||||
uses ``POST /responses``.
|
||||
"""
|
||||
|
||||
_client: OpenAIClient
|
||||
|
||||
def __init__(self, client: OpenAIClient) -> None:
|
||||
self._client = client
|
||||
|
||||
@@ -80,10 +82,8 @@ class ResponsesChatClient:
|
||||
} and isinstance(event.delta, str) and event.delta:
|
||||
yield reasoning_delta_chunk(model=model, content=event.delta)
|
||||
continue
|
||||
if etype == "response.completed" and event.response is not UNSET and isinstance(
|
||||
event.response, dict
|
||||
):
|
||||
# Decode full response for tools + usage
|
||||
if etype == "response.completed" and event.response is not UNSET:
|
||||
# Decode full response for tools + usage (field is dict | Unset).
|
||||
import msgspec
|
||||
|
||||
from plyngent.lmproto.openai.model import Response as ResponseModel
|
||||
|
||||
Reference in New Issue
Block a user