|
24 | 24 | """ |
25 | 25 |
|
26 | 26 | import asyncio |
27 | | -import time |
28 | 27 | from unittest.mock import AsyncMock, MagicMock, patch |
29 | 28 |
|
30 | 29 | import httpx |
@@ -84,16 +83,19 @@ async def aiter_bytes(_chunk_size=None): |
84 | 83 | # Verbatim copy of LiteLLM's make_azure_openai_chat_completion_request |
85 | 84 | # (litellm/llms/azure/azure.py lines 154-179) |
86 | 85 | # --------------------------------------------------------------------------- |
87 | | -async def make_azure_openai_chat_completion_request(azure_client, data, timeout): |
| 86 | +async def make_azure_openai_chat_completion_request( |
| 87 | + azure_client, data, timeout |
| 88 | +): |
88 | 89 | """ |
89 | 90 | Helper to: |
90 | 91 | - call chat.completions.create.with_raw_response when litellm.return_response_headers is True |
91 | 92 | - call chat.completions.create by default |
92 | 93 | """ |
93 | | - start_time = time.time() |
94 | 94 | try: |
95 | | - raw_response = await azure_client.chat.completions.with_raw_response.create( |
96 | | - **data, timeout=timeout |
| 95 | + raw_response = ( |
| 96 | + await azure_client.chat.completions.with_raw_response.create( |
| 97 | + **data, timeout=timeout |
| 98 | + ) |
97 | 99 | ) |
98 | 100 |
|
99 | 101 | headers = dict(raw_response.headers) |
@@ -157,7 +159,9 @@ async def reproducer(): |
157 | 159 | print(f"✓ OTel spans: {[s.name for s in spans]}") |
158 | 160 |
|
159 | 161 | instrumentor.uninstrument() |
160 | | - print("\nReproducer passed — 'StreamWrapper' has no attribute 'headers' is fixed.") |
| 162 | + print( |
| 163 | + "\nReproducer passed — 'StreamWrapper' has no attribute 'headers' is fixed." |
| 164 | + ) |
161 | 165 |
|
162 | 166 |
|
163 | 167 | if __name__ == "__main__": |
|
0 commit comments