Ë
    uPêjE  ã                  óž  — U d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	m
Z
mZ ddlZddlmZmZmZ ddlmZ dd	lmZmZmZ dd
lmZ e	rddlmZ dZded<   dZded<   dZded<   dZ ded<   dZ!ded<   dZ"ded<   dZ#ded<   dZ$ded<   dZ%ded<   dZ&ded <    G d!„ d"e«      Z' G d#„ d$e«      Z( G d%„ d&e«      Z) G d'„ d(e«      Z* G d)„ d*e«      Z+ G d+„ d,e«      Z, G d-„ d.e«      Z-dEd/„Z.dFd0„Z/dGd1„Z0dHd2„Z1dId3„Z2dJd4„Z3 G d5„ d6e«      Z4 G d7„ d8e«      Z5 G d9„ d:e«      Z6 G d;„ d<e«      Z7 G d=„ d>e«      Z8 G d?„ d@e«      Z9dKdA„Z:dLdB„Z; G dC„ dDe«      Z<y)Ma  
Calls the Microsoft Foundry Responses API with the `bing_grounding` or `web_search`
tool to search the web (Grounding with Bing Search).

Microsoft docs: https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/bing-grounding

Setup:
    1. Set BING_GROUNDING_PROJECT_ENDPOINT to the Foundry project endpoint, e.g.
       https://<account>.services.ai.azure.com/api/projects/<project>
    2. Set BING_GROUNDING_MODEL to a model deployment in that project (e.g. gpt-4.1);
       it runs the grounded search and its tokens are billed on that deployment
    3. Optional: set BING_GROUNDING_CONNECTION_ID to a Grounding with Bing Search
       project connection id to use the `bing_grounding` tool; without it the
       project's built-in `web_search` tool is used
    4. Auth: pass api_key (an Azure API key, sent in the api-key header), or set
       BING_GROUNDING_TOKEN to an Entra bearer token for scope
       https://ai.azure.com/.default, or configure azure-identity (AZURE_CLIENT_ID /
       AZURE_CLIENT_SECRET / AZURE_TENANT_ID, managed identity, or any
       DefaultAzureCredential source) and the token is minted automatically

Usage:
    response = litellm.search(
        query="latest AI developments",
        search_provider="bing_grounding",
        max_results=5,
    )
é    )Úannotations)ÚCallableÚMapping)ÚMappingProxyType)ÚTYPE_CHECKINGÚFinalÚLiteralN)Ú	BaseModelÚ
ConfigDictÚValidationError)ÚBaseLLMException)ÚBaseSearchConfigÚSearchResponseÚSearchResult)Úget_secret_str)ÚLoggingzUhttps://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/bing-groundingr   Ú	_DOCS_URLÚBING_GROUNDING_PROJECT_ENDPOINTÚPROJECT_ENDPOINT_ENVÚBING_GROUNDING_MODELÚ	MODEL_ENVÚBING_GROUNDING_CONNECTION_IDÚCONNECTION_ID_ENVÚBING_GROUNDING_TOKENÚ	TOKEN_ENVzhttps://ai.azure.com/.defaultÚENTRA_SCOPEz/openai/v1/responsesÚ_RESPONSES_PATHi,  Ú_SNIPPET_FALLBACK_LENGTHiö  Ú_UPSTREAM_ERROR_STATUSz$llm_provider-x-litellm-response-costÚ_RESPONSE_COST_HEADERc                  óh   — e Zd ZU  edd¬«      ZdZded<   dZded	<   dZded
<   dZ	ded<   dZ
ded<   y)Ú_AnnotationÚignoreT©ÚextraÚfrozenÚ ÚstrÚtypeNú
str | NoneÚurlÚtitleú
int | NoneÚstart_indexÚ	end_index)Ú__name__Ú
__module__Ú__qualname__r   Úmodel_configr)   Ú__annotations__r+   r,   r.   r/   © ó    úm/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/llms/azure/search/transformation.pyr"   r"   @   s?   … Ù H°TÔ:€Là€Dˆ#ƒNØ€CˆÓØ€Eˆ:ÓØ"€K�Ó"Ø €IˆzÔ r6   r"   c                  óL   — e Zd ZU  edd¬«      ZdZded<   dZded<   dZd	ed
<   y)Ú_ContentPartr#   Tr$   r'   r(   r)   Útextr5   ztuple[_Annotation, ...]r   N)	r0   r1   r2   r   r3   r)   r4   r:   r   r5   r6   r7   r9   r9   J   s+   … Ù H°TÔ:€Là€Dˆ#ƒNØ€Dˆ#ƒNØ+-€KÐ(Ô-r6   r9   c                  ó>   — e Zd ZU  edd¬«      ZdZded<   dZded	<   y
)Ú_OutputItemr#   Tr$   r'   r(   r)   r5   ztuple[_ContentPart, ...]ÚcontentN)r0   r1   r2   r   r3   r)   r4   r=   r5   r6   r7   r<   r<   R   s"   … Ù H°TÔ:€Là€Dˆ#ƒNØ(*€GÐ%Ô*r6   r<   c                  ó0   — e Zd ZU  edd¬«      ZdZded<   y)Ú
_ErrorBodyr#   Tr$   Nr*   Úmessage)r0   r1   r2   r   r3   r@   r4   r5   r6   r7   r?   r?   Y   s   … Ù H°TÔ:€Là€GˆZÔr6   r?   c                  ó0   — e Zd ZU  edd¬«      ZdZded<   y)Ú_IncompleteDetailsr#   Tr$   Nr*   Úreason)r0   r1   r2   r   r3   rC   r4   r5   r6   r7   rB   rB   _   s   … Ù H°TÔ:€Là€FˆJÔr6   rB   c                  óZ   — e Zd ZU dZ edd¬«      Zded<   dZded	<   dZd
ed<   dZ	ded<   y)Ú_ResponsesEnvelopea7  A Foundry Responses API body. `output` is required: a body without it is not a
    Responses API response and must not be reported as a successful empty search.

    A 200 body can still carry `status` `failed` or `incomplete`; those are surfaced as
    errors rather than reported as a successful empty search.r#   Tr$   ztuple[_OutputItem, ...]ÚoutputNr*   Ústatusú_ErrorBody | NoneÚerrorz_IncompleteDetails | NoneÚincomplete_details)
r0   r1   r2   Ú__doc__r   r3   r4   rG   rI   rJ   r5   r6   r7   rE   rE   e   s=   … ñAñ  H°TÔ:€Là#Ó#Ø€FˆJÓØ#€EÐÓ#Ø48ÐÐ1Ô8r6   rE   c                  ó0   — e Zd ZU  edd¬«      ZdZded<   y)Ú_ErrorEnveloper#   Tr$   NrH   rI   )r0   r1   r2   r   r3   rI   r4   r5   r6   r7   rM   rM   t   s   … Ù H°TÔ:€Là#€EÐÔ#r6   rM   c                ó  — 	 t         j                  | «      }|j                  r|j                  j                  nd}|€| S 	 t
        j                  |«      }|j                  xs |S # t        $ r | cY S w xY w# t        $ r |cY S w xY w)a'  
    Surface the human-readable message inside Foundry's error envelope.

    Tool failures nest a second JSON document as a string inside `error.message`
    (observed live for `bing_grounding` connection errors), so the unwrap runs twice.
    Falls back to the raw body for anything else.
    N)rM   Úmodel_validate_jsonr   rI   r@   r?   )Úerror_messageÚenveloper@   Únesteds       r7   Ú_unwrap_error_detailrS   z   s�   € ðÜ(×<Ñ<¸]ÓKˆð 08¯~ª~�X—^‘^×+Ò+À4€GØ€ØÐðÜ"×6Ñ6°wÓ?ˆð �>‰>Ò$˜WÐ$øô ò ØÒðûô ò ØŠðús#   ‚A% Á A6 Á%A3Á2A3Á6BÂBc                óÜ   — |j                   }|�d|cxk  rt        | «      k  rn n|n
t        | «      }| d| j                  dd«      d   j                  «       }|r
|t         d S | dt         S )a
  
    The text a citation supports, not the citation marker itself.

    A url_citation's start/end indices span the inline marker ("([host](url))"),
    which follows the claim it backs, so the snippet is the marker's own line up
    to where the marker starts.
    Nr   ú
é   éÿÿÿÿ)r.   ÚlenÚrsplitÚstripr   )r:   Ú
annotationÚstartÚmarker_startÚclaims        r7   Ú_snippetr_   �   s}   € ð ×)Ñ)€EØ#(Ð#4¸¸eÔ9PÄsÈ4ÃyÕ9P™%ÔVYÐZ^ÓV_€LØ˜˜Ð&×-Ñ-¨d°AÓ6°rÑ:×@Ñ@ÓB€EÙØÔ.Ð.Ð/Ð0Ð0ØÐ)Ô)Ð*Ð*r6   c                óü   ‡— t        d„ | j                  D «       «      }t        t        |«      D �ci c]  }|j                  |“Œ c}«      Št        ˆfd„t
        j                  d„ |D «       «      D «       «      S c c}w )zMOne result per cited URL: first occurrence wins, order preserved as answered.c              3  óR  K  — | ]Ÿ  }|j                   d k(  rŽ|j                  D ]  }|j                   dk(  rn|j                  D ]_  }|j                   dk(  rN|j                  rBt	        |j
                  xs d|j                  xs dt        |j                  |«      dd¬«      –— Œa Œ� Œ¡ y­w)r@   Úoutput_textÚurl_citationr'   N)r,   r+   ÚsnippetÚdateÚlast_updated)r)   r=   r   r+   r   r,   r_   r:   )Ú.0ÚitemÚpartr[   s       r7   ú	<genexpr>z$_citation_results.<locals>.<genexpr>¢   s´   è ø€ ò ð Ø�9‰9˜	Ò!Ø—L‘Lòð Ø�9‰9˜Ò%Ø×*Ñ*òð Ø�?‰?˜nÒ,°·²ô 	Ø×"Ñ"Ò( bØ—‘Ò$ "Ü˜TŸY™Y¨
Ó3ØØ÷	
ð 	
ðð	
ðð	
ñùs   ‚B%B'c              3  ó(   •K  — | ]	  }‰|   –— Œ y ­w©Nr5   )rg   r+   Úfirst_by_urls     €r7   rj   z$_citation_results.<locals>.<genexpr>²   s   øè ø€ Ò\ s�˜cÕ"Ñ\ùs   ƒc              3  ó4   K  — | ]  }|j                   –— Œ y ­wrl   )r+   )rg   Úresults     r7   rj   z$_citation_results.<locals>.<genexpr>²   s   è ø€ Ò;[È6¸F¿J½JÑ;[ùs   ‚)ÚtuplerF   r   Úreversedr+   ÚdictÚfromkeys)rQ   Úcitedro   rm   s      @r7   Ú_citation_resultsru       sl   ø€ äñ ð —O‘Oôó €Eô +ÌXÐV[Ë_Ö+]À6¨F¯J©J¸Ñ,>Ò+]Ó^€LÜÓ\¬d¯m©mÑ;[ÐUZÔ;[Ó.[Ô\Ó\Ð\ùò ,^s   °A9c                óV   — t        | t        «      st        | t        «      sy| dkD  r| S dS )zßA positive-int `max_results`, else None. Rejects bools, an `int` subclass, and
    non-positive values so neither the request-side `count` nor the response-side cap
    forwards a value the other would silently ignore.
    Nr   )Ú
isinstanceÚboolÚint)Úmax_resultss    r7   Ú_valid_max_resultsr{   µ   s+   € ô
 �+œtÔ$¬J°{ÄCÔ,HØØ%¨š/ˆ;Ð3¨tÐ3r6   c                óz   — | j                  d«      }t        |t        «      syt        |j                  d«      «      S )a  The unified `max_results` cap the caller asked for, if any.

    The built-in web_search tool has no server-side result-count knob, so the cap is
    enforced here after the fact; connection mode also honors it as a hard ceiling on
    top of the tool's `count` hint.
    Úoptional_paramsNrz   )Úgetrw   r   r{   )Úresponse_kwargsr}   s     r7   Ú_requested_max_resultsr€   ¿   s8   € ð -×0Ñ0Ð1BÓC€OÜ�o¤wÔ/ØÜ˜o×1Ñ1°-Ó@ÓAÐAr6   c                ó   — |�| d | S | S rl   r5   )Úresultsrz   s     r7   Ú_cappedrƒ   Ì   s   € Ø$/Ð$;ˆ7�<�KÐ ÐHÀÐHr6   c                  ó8   — e Zd ZU  ed¬«      Zded<   dZded<   y)Ú_SearchConfigurationT©r&   r(   Úproject_connection_idNr-   Úcount)r0   r1   r2   r   r3   r4   rˆ   r5   r6   r7   r…   r…   Ð   s   … Ù TÔ*€LàÓØ€Eˆ:Ôr6   r…   c                  ó*   — e Zd ZU  ed¬«      Zded<   y)Ú_BingGroundingParamsTr†   z tuple[_SearchConfiguration, ...]Úsearch_configurationsN©r0   r1   r2   r   r3   r4   r5   r6   r7   rŠ   rŠ   ×   s   … Ù TÔ*€Là;Ô;r6   rŠ   c                  ó8   — e Zd ZU  ed¬«      ZdZded<   ded<   y)Ú_BingGroundingToolTr†   Úbing_groundingzLiteral['bing_grounding']r)   rŠ   N©r0   r1   r2   r   r3   r)   r4   r5   r6   r7   rŽ   rŽ   Ý   s   … Ù TÔ*€Là&6€DÐ
#Ó6Ø(Ô(r6   rŽ   c                  ó8   — e Zd ZU  ed¬«      ZdZded<   ded<   y)	Ú_UserLocationTr†   ÚapproximatezLiteral['approximate']r)   r(   ÚcountryNr�   r5   r6   r7   r’   r’   ä   s   … Ù TÔ*€Là#0€DÐ
 Ó0Ø„Lr6   r’   c                  ó<   — e Zd ZU  ed¬«      ZdZded<   dZded<   y)	Ú_WebSearchToolTr†   Ú
web_searchzLiteral['web_search']r)   Nz_UserLocation | NoneÚuser_location)r0   r1   r2   r   r3   r)   r4   r˜   r5   r6   r7   r–   r–   ë   s"   … Ù TÔ*€Là".€DÐ
Ó.Ø*.€MÐ'Ô.r6   r–   c                  ó>   — e Zd ZU  ed¬«      Zded<   ded<   ded<   y)	Ú_ResponsesRequestTr†   r(   ÚmodelÚinputz/tuple[_BingGroundingTool | _WebSearchTool, ...]ÚtoolsNrŒ   r5   r6   r7   rš   rš   ò   s   … Ù TÔ*€LàƒJØƒJØ:Ô:r6   rš   c                ó2  — t        t        «      }| j                  d«      }| j                  d«      }|r-t        |t	        |«      ¬«      }t        t        |f¬«      ¬«      S t        |t        «      rt        |j                  «       ¬«      nd }t        |¬«      S )Nrz   r”   )r‡   rˆ   )r‹   )r�   )r”   )r˜   )r   r   r~   r…   r{   rŽ   rŠ   rw   r(   r’   Úupperr–   )r}   Úconnection_idrz   r”   ÚconfigurationÚlocations         r7   Ú_search_toolr£   ú   s„   € Ü)Ô*;Ó<€MØ(×,Ñ,¨]Ó;€KØ$×(Ñ(¨Ó3€GÙÜ3Ø"/Ü$ [Ó1ô 
ˆô "Ô1EÐ]jÐ\lÔ1mÔnÐnÜ@JÈ7ÔTWÔ@X”m¨G¯M©M«OÕ<Ð^b€HÜ¨Ô1Ð1r6   c                 ó2   — ddl m}    | t        ¬«      «       S )Nr   ©Úget_azure_ad_token_provider)Úazure_scope)Ú3litellm.secret_managers.get_azure_ad_token_providerr¦   r   r¥   s    r7   Ú_default_entra_token_minterr©     s   € Ý_à?Ñ&´;Ô?ÓAÐAr6   c                  óÚ   ‡ — e Zd Zddˆ fd„Zedd„«       Z	 	 d	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Z	 d	 	 	 	 	 	 	 	 	 dd„Z		 	 	 	 	 	 	 	 dd„Z
	 	 	 	 	 	 	 	 dd„Zdd	„Zdd
„Z	 	 	 	 	 	 	 	 dd„Zˆ xZS )ÚBingGroundingSearchConfigc                ó0   •— t         ‰| �  «        || _        y rl   )ÚsuperÚ__init__Ú_entra_token_minter)ÚselfÚentra_token_minterÚ	__class__s     €r7   r®   z"BingGroundingSearchConfig.__init__  s   ø€ Ü‰ÑÔØ#5ˆÕ r6   c                  ó   — y)NzGrounding with Bing Searchr5   r5   r6   r7   Úui_friendly_namez*BingGroundingSearchConfig.ui_friendly_name  s   € à+r6   c                ó6   — i |¥| j                  ||«      ¥ddi¥S )zô
        Validate environment and return headers.

        Returns a new dict rather than mutating ``headers``: the http handler calls this
        a second time after ``litellm/search/main.py`` already did, so it has to be idempotent.
        zContent-Typezapplication/json)Ú_auth_header)r°   ÚheadersÚapi_keyÚapi_baseÚkwargss        r7   Úvalidate_environmentz.BingGroundingSearchConfig.validate_environment  s6   € ð
Øð
à×Ñ ¨Ó2ð
ð Ð.ñ
ð 	
r6   c                ó¤   — |rt        d|i«      S | j                  d|t        ft        d¬«      xs | j	                  |«      }t        dd|› �i«      S )a  
        A caller-supplied ``api_key`` is an Azure API key and rides the ``api-key`` header;
        an Entra bearer token (``BING_GROUNDING_TOKEN`` or one minted via azure-identity)
        rides ``Authorization: Bearer``. Foundry rejects the wrong scheme for each.
        zapi-keyN)Úcaller_api_keyÚcaller_api_baseÚkey_env_varsÚbase_env_varÚdefault_api_baseÚAuthorizationzBearer )r   Úresolve_server_api_keyr   r   Ú_mint_entra_token)r°   r¸   r¹   Útokens       r7   r¶   z&BingGroundingSearchConfig._auth_header*  sn   € ñ Ü# Y°Ð$8Ó9Ð9Ø×2Ñ2ØØ$Ü#˜Ü-Ø!ð 3ó 
ò .ð ×#Ñ# HÓ-ð 	ô   °G¸E¸7Ð2CÐ DÓEÐEr6   c           	     óÆ   — | j                  |d t        d«       | j                  xs t        }	  |«       S # t        $ r"}t        dt        › dt        › d|› �«      |‚d }~ww xY w)NzAzure AD tokenzGGrounding with Bing Search: no credential available. Pass api_key, set z  to an Entra bearer token, or configure azure-identity (AZURE_CLIENT_ID / AZURE_CLIENT_SECRET / AZURE_TENANT_ID or any DefaultAzureCredential source) for scope z. Underlying error: )Ú._assert_trusted_api_base_for_server_credentialr   r¯   r©   Ú	ExceptionÚ
ValueErrorr   r   )r°   r¾   ÚminterÚes       r7   rÄ   z+BingGroundingSearchConfig._mint_entra_token;  s   € Ø×;Ñ;Ø˜TÔ#7Ð9Iô	
ð ×0Ñ0ÒOÔ4Oˆð	Ù“8ˆOøÜò 	ÜØYÔZcÐYdð eô )˜MÐ)=¸a¸SðBóð
 ðûð	ús   ®5 µ	A ¾AÁA c                ó´   — |xs t        t        «      }|st        t        › d�«      ‚|j                  d«      }|j	                  t
        «      r|S |› t
        › �S )Nz„ is not set. Set it to your Microsoft Foundry project endpoint, e.g. https://<account>.services.ai.azure.com/api/projects/<project>.ú/)r   r   rÉ   ÚrstripÚendswithr   )r°   r¹   r}   Údatarº   Úresolved_baseÚtrimmeds          r7   Úget_complete_urlz*BingGroundingSearchConfig.get_complete_urlJ  sk   € ð  (ÒO¬>Ô:NÓ+OˆÙÜÜ'Ð(ð )að bóð ð '×-Ñ-¨cÓ2ˆØ×ÑœOÔ,ØˆNØ�œ?Ð+Ð,Ð,r6   c                óà   — t        t        «      }|st        t        › d�«      ‚t        |t	        |t
        «      rdj                  |«      n|t        |«      f¬«      }|j                  dd¬«      S )az  
        Transform Search request to the Foundry Responses API format.

        The unified params map as far as the API allows:
        - max_results -> the bing_grounding search configuration's `count`; the built-in
          web_search tool has no result-count knob, so that mode instead caps the returned
          results after the fact (see transform_search_response)
        - country -> web_search's approximate `user_location` (bing_grounding's `market`
          wants a full locale like en-US, which a bare country code cannot fill)
        - search_domain_filter, max_tokens_per_page -> no API equivalent, dropped
        zm is not set. Set it to a model deployment in the Foundry project that runs the grounded search, e.g. gpt-4.1.ú )r›   rœ   r�   ÚjsonT)ÚmodeÚexclude_none)	r   r   rÉ   rš   rw   ÚlistÚjoinr£   Ú
model_dump)r°   Úqueryr}   rº   r›   Úrequests         r7   Útransform_search_requestz2BingGroundingSearchConfig.transform_search_request\  sv   € ô" &¤iÓ0ˆÙÜÜ�+ð ?ð @óð ô +ØÜ%/°´tÔ%<�#—(‘(˜5”/À%Ü Ó0Ð2ô
ˆð
 ×!Ñ! v¸DÐ!ÓAÐAr6   c                ó   — 	 t         j                  |j                  «      }|j                  dk(  rL|j                  r,|j                  j                  r|j                  j                  nd}| j                  ||«      ‚t        t        |«      t        |«      «      }|s^|j                  dk(  rO|j                  r,|j                  j                   r|j                  j                   nd}| j                  d|› �|«      ‚| j#                  |«      S # t        $ r9}| j	                  d|› �|j
                  t        |j                  «      ¬«      ‚d }~ww xY w)Nz:response does not match the Foundry Responses API schema: ©rP   Ústatus_coder·   Úfailedzthe grounded search failedÚ
incompletezunknown reasonz$the grounded search was incomplete: )rE   rO   r=   r   Úget_error_classrá   rr   r·   rG   rI   r@   Ú_upstream_errorrƒ   ru   r€   rJ   rC   Ú_priced)	r°   Úraw_responseÚlogging_objrº   ÚparsedrË   Údetailr‚   rC   s	            r7   Útransform_search_responsez3BingGroundingSearchConfig.transform_search_responsez  s:  € ð	Ü.×BÑBÀ<×CWÑCWÓXˆFð �=‰=˜HÒ$à(.¯ª¸¿¹×9MÒ9M�—‘×$Ò$ÐSoð ð ×&Ñ& v¨|Ó<Ð<Ü Ô!2°6Ó!:Ô<RÐSYÓ<ZÓ[ˆÙ˜6Ÿ=™=¨LÒ8ð ×,Ò,°×1JÑ1J×1QÒ1Qð ×)Ñ)×0Ò0à%ð ð
 ×&Ñ&Ð)MÈfÈXÐ'VÐXdÓeÐeØ�|‰|˜GÓ$Ð$øô' ò 	Ø×&Ñ&Ø ZÐ[\ÐZ]Ð^Ø(×4Ñ4Ü˜\×1Ñ1Ó2ð 'ó ð ûð	ús   ‚D Ä	EÄ4EÅEc                óX   — | j                  |t        t        |j                  «      ¬«      S )Nrà   )rä   r   rr   r·   )r°   rê   rç   s      r7   rå   z)BingGroundingSearchConfig._upstream_error—  s.   € Ø×#Ñ#Ø Ü.Ü˜×-Ñ-Ó.ð $ó 
ð 	
r6   c                ó~   — t        t        |«      d¬«      }t        t        «      r|S t        di|j
                  d<   |S )zàweb_search mode runs no paid Grounding with Bing transaction, so it must not
        inherit the connection-mode ``bing_grounding/search`` price; zero its per-query
        cost while leaving connection mode to the cost map.Úsearch)r‚   Úobjectg        Úadditional_headers)r   rÙ   r   r   r    Ú_hidden_params)r°   r‚   Úresponses      r7   ræ   z!BingGroundingSearchConfig._pricedž  sN   € ô )Ü˜“MØô
ˆô Ô+Ô,ØˆOô " 3ð
ð 	×ÑØ ñ	
ð
 ˆr6   c                óh   — t        |«      j                  d«      }t        |d|› dt        › d�|¬«      S )Nz. zGrounding with Bing Search: z. See z for details.)rá   r@   r·   )rS   rÎ   r   r   )r°   rP   rá   r·   rê   s        r7   rä   z)BingGroundingSearchConfig.get_error_class¯  s>   € ô -¨]Ó;×BÑBÀ4ÓHˆÜØ#Ø2°6°(¸&ÄÀÈ=ÐYØô
ð 	
r6   rl   )r±   zCallable[[], str] | NoneÚreturnÚNone©rô   r(   )NN)
r·   údict[str, str]r¸   r*   r¹   r*   rº   rï   rô   r÷   )r¸   r*   r¹   r*   rô   zMapping[str, str])r¾   r*   rô   r(   )
r¹   r*   r}   údict[str, object]rÐ   z2dict[str, object] | list[dict[str, object]] | Nonerº   rï   rô   r(   )rÜ   zstr | list[str]r}   rø   rº   rï   rô   rø   )rç   úhttpx.Responserè   ÚLiteLLMLoggingObjrº   rï   rô   r   )rê   r(   rç   rù   rô   rÈ   )r‚   útuple[SearchResult, ...]rô   r   )rP   r(   rá   ry   r·   r÷   rô   rÈ   )r0   r1   r2   r®   Ústaticmethodr´   r»   r¶   rÄ   rÓ   rÞ   rë   rå   ræ   rä   Ú__classcell__)r²   s   @r7   r«   r«     s1  ø„ ö6ð ò,ó ð,ð #Ø#ð	
àð
ð ð
ð ð	
ð
 ð
ð 
ó
ó&Fó"ð& DHð	-àð-ð +ð-ð Að	-ð
 ð-ð 
ó-ð$BàðBð +ðBð ð	Bð
 
óBð<%à$ð%ð 'ð%ð ð	%ð
 
ó%ó:
óð"
àð
ð ð
ð  ð	
ð
 
÷
r6   r«   )rP   r(   rô   r(   )r:   r(   r[   r"   rô   r(   )rQ   rE   rô   rû   )rz   rï   rô   r-   )r   úMapping[str, object]rô   r-   )r‚   rû   rz   r-   rô   rû   )r}   rþ   rô   z#_BingGroundingTool | _WebSearchToolrö   )=rK   Ú
__future__r   Úcollections.abcr   r   Útypesr   Útypingr   r   r	   ÚhttpxÚpydanticr
   r   r   Ú)litellm.llms.base_llm.chat.transformationr   Ú+litellm.llms.base_llm.search.transformationr   r   r   Úlitellm.secret_managers.mainr   Ú*litellm.litellm_core_utils.litellm_loggingr   rú   r   r4   r   r   r   r   r   r   r   r   r    r"   r9   r<   r?   rB   rE   rM   rS   r_   ru   r{   r€   rƒ   r…   rŠ   rŽ   r’   r–   rš   r£   r©   r«   r5   r6   r7   ú<module>r	     s|  ðòõ8 #ç -Ý "ß 0Ñ 0ã ß ;Ñ ;å F÷ñ õ
 8áÝWàj€	ˆ5Ó jà?Ð �eÓ ?Ø)€	ˆ5Ó )Ø9Ð �5Ó 9Ø)€	ˆ5Ó )à4€ˆUÓ 4à/€�Ó /Ø"%Ð ˜%Ó %Ø #Ð ˜Ó #ØEÐ �uÓ Eô!�)ô !ô.�9ô .ô+�)ô +ô�ô ô˜ô ô9˜ô 9ô$�Yô $ó%ó,+ó ]ó*4ó
BóIô˜9ô ô<˜9ô <ô)˜ô )ô�Iô ô/�Yô /ô;˜	ô ;ó2óBôl
Ð 0õ l
r6   