| 154 | |
| 155 | |
| 156 | class AsyncOpenAIWrapper(OriginalAsyncOpenAI): |
| 157 | chat: AsyncChatWrapper |
| 158 | openpipe_reporting_client: AsyncOpenPipe |
| 159 | openpipe_completions_client: OriginalAsyncOpenAI |
| 160 | |
| 161 | # Support auto-complete |
| 162 | def __init__( |
| 163 | self, |
| 164 | *, |
| 165 | openpipe: Optional[Dict[str, str]] = None, |
| 166 | api_key: Union[str, None] = None, |
| 167 | organization: Union[str, None] = None, |
| 168 | base_url: Union[str, httpx.URL, None] = None, |
| 169 | timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, |
| 170 | max_retries: int = DEFAULT_MAX_RETRIES, |
| 171 | default_headers: Union[Mapping[str, str], None] = None, |
| 172 | default_query: Union[Mapping[str, object], None] = None, |
| 173 | http_client: Union[httpx.Client, None] = None, |
| 174 | _strict_response_validation: bool = False, |
| 175 | ) -> None: |
| 176 | super().__init__( |
| 177 | api_key=api_key, |
| 178 | organization=organization, |
| 179 | base_url=base_url, |
| 180 | timeout=timeout, |
| 181 | max_retries=max_retries, |
| 182 | default_headers=default_headers, |
| 183 | default_query=default_query, |
| 184 | http_client=http_client, |
| 185 | _strict_response_validation=_strict_response_validation, |
| 186 | ) |
| 187 | |
| 188 | self.openpipe_reporting_client = AsyncOpenPipe() |
| 189 | self.openpipe_completions_client = OriginalAsyncOpenAI( |
| 190 | api_key=api_key, |
| 191 | organization=organization, |
| 192 | base_url=base_url, |
| 193 | timeout=timeout, |
| 194 | max_retries=max_retries, |
| 195 | default_headers=default_headers, |
| 196 | default_query=default_query, |
| 197 | http_client=http_client, |
| 198 | _strict_response_validation=_strict_response_validation, |
| 199 | ) |
| 200 | configure_openpipe_clients( |
| 201 | self.openpipe_reporting_client, self.openpipe_completions_client, openpipe |
| 202 | ) |
| 203 | |
| 204 | self.chat = AsyncChatWrapper( |
| 205 | self, self.openpipe_reporting_client, self.openpipe_completions_client |
| 206 | ) |
nothing calls this directly
no outgoing calls
no test coverage detected