Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,11 @@ def _parse_response_from_openai(
metadata: dict[str, Any] = response.metadata or {}
contents: list[Content] = []
local_shell_tool_name = self._get_local_shell_tool_name(options.get("tools"))
for item in response.output: # type: ignore[reportUnknownMemberType]
try:
response_outputs = response.output # type: ignore[reportUnknownMemberType]
except AttributeError:
response_outputs = []
for item in response_outputs: # type: ignore[reportUnknownVariableType]
match item.type:
# types:
# ParsedResponseOutputMessage[Unknown] |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,13 +788,13 @@ def _parse_text_from_openai(self, choice: Choice | ChunkChoice) -> Content | Non
def _get_metadata_from_chat_response(self, response: ChatCompletion) -> dict[str, Any]:
"""Get metadata from a chat response."""
return {
"system_fingerprint": response.system_fingerprint,
"system_fingerprint": getattr(response, "system_fingerprint", None),
Comment thread
eavanvalkenburg marked this conversation as resolved.
}

def _get_metadata_from_streaming_chat_response(self, response: ChatCompletionChunk) -> dict[str, Any]:
"""Get metadata from a streaming chat response."""
return {
"system_fingerprint": response.system_fingerprint,
"system_fingerprint": getattr(response, "system_fingerprint", None),
Comment thread
eavanvalkenburg marked this conversation as resolved.
}

def _get_metadata_from_chat_choice(self, choice: Choice | ChunkChoice) -> dict[str, Any]:
Expand Down