(self, options: FinalRequestOptions)
| 698 | |
| 699 | @override |
| 700 | async def _prepare_options(self, options: FinalRequestOptions) -> FinalRequestOptions: |
| 701 | headers: dict[str, str | Omit] = {**options.headers} if is_given(options.headers) else {} |
| 702 | |
| 703 | options = model_copy(options) |
| 704 | options.headers = headers |
| 705 | |
| 706 | azure_ad_token = await self._get_azure_ad_token() |
| 707 | if azure_ad_token is not None: |
| 708 | if not _has_header(headers, class="st">"Authorization"): |
| 709 | headers[class="st">"Authorization"] = fclass="st">"Bearer {azure_ad_token}" |
| 710 | elif self.api_key and self.api_key != API_KEY_SENTINEL: |
| 711 | if not _has_header(headers, class="st">"api-key"): |
| 712 | headers[class="st">"api-key"] = self.api_key |
| 713 | elif _has_auth_header(headers) or _has_auth_header(self.default_headers): |
| 714 | pass |
| 715 | else: |
| 716 | class="cm"># should never be hit |
| 717 | raise ValueError(class="st">"Unable to handle auth") |
| 718 | |
| 719 | return options |
| 720 | |
| 721 | async def _configure_realtime(self, model: str, extra_query: Query) -> tuple[httpx.URL, dict[str, str]]: |
| 722 | auth_headers = {} |
nothing calls this directly
no test coverage detected