|
23 | 23 | from dataclasses import dataclass |
24 | 24 | from datetime import datetime |
25 | 25 | from inspect import isclass |
26 | | -from typing import Optional, cast, Any |
| 26 | +from typing import Any, Optional, cast |
27 | 27 |
|
28 | 28 | from openai._types import NotGiven |
29 | 29 | from packaging.version import Version |
@@ -161,6 +161,22 @@ class OpenAiDefinition: |
161 | 161 | sync=False, |
162 | 162 | min_version="1.66.0", |
163 | 163 | ), |
| 164 | + OpenAiDefinition( |
| 165 | + module="openai.resources.responses", |
| 166 | + object="Responses", |
| 167 | + method="parse", |
| 168 | + type="chat", |
| 169 | + sync=True, |
| 170 | + min_version="1.66.0", |
| 171 | + ), |
| 172 | + OpenAiDefinition( |
| 173 | + module="openai.resources.responses", |
| 174 | + object="AsyncResponses", |
| 175 | + method="parse", |
| 176 | + type="chat", |
| 177 | + sync=False, |
| 178 | + min_version="1.66.0", |
| 179 | + ), |
164 | 180 | ] |
165 | 181 |
|
166 | 182 |
|
@@ -570,7 +586,10 @@ def _extract_streamed_openai_response(resource: Any, chunks: Any) -> Any: |
570 | 586 | ) |
571 | 587 | curr["arguments"] += getattr(tool_call_chunk, "arguments", "") |
572 | 588 |
|
573 | | - elif delta.get("tool_calls", None) is not None and len(delta.get("tool_calls")) > 0: |
| 589 | + elif ( |
| 590 | + delta.get("tool_calls", None) is not None |
| 591 | + and len(delta.get("tool_calls")) > 0 |
| 592 | + ): |
574 | 593 | curr = completion["tool_calls"] |
575 | 594 | tool_call_chunk = getattr( |
576 | 595 | delta.get("tool_calls", None)[0], "function", None |
|
0 commit comments