
    @'h݆                     \   d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ d dl,m-c m.Z/ d dl0m1Z1m2Z2m3Z3m4Z4 d dl5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z? d dl@mAZAmBZB d d	lCmDZD d d
lEmFZFmGZG d dlHmIZI d dlJmKZKmLZL d dlMmNZN d dlOmPZP d dlQmRZR d dlSmTZTmUZUmVZVmWZWmXZXmYZYmZZZ  e/j                  e\      Z]erd dl^m_Z_ dZ`de def   de def   fdZae+ G d de&             Zbde7ddfdZc G d deI      Zdy)    N)AsyncOpenAIAzureOpenAI)OpenAI)ResponseResponseStreamEventResponseCompletedEventResponseCreatedEvent$ResponseFileSearchCallCompletedEvent'ResponseFunctionCallArgumentsDeltaEvent&ResponseFunctionCallArgumentsDoneEventResponseInProgressEventResponseOutputItemAddedEvent ResponseTextAnnotationDeltaEventResponseTextDeltaEvent#ResponseWebSearchCallCompletedEventResponseOutputItemResponseOutputMessageResponseFileSearchToolCallResponseFunctionToolCallResponseFunctionWebSearchResponseComputerToolCallResponseReasoningItem)TYPE_CHECKINGAnyAsyncGeneratorCallableDict	GeneratorListLiteralOptionalProtocolSequenceTupleTypeUnionruntime_checkable)achat_to_completion_decorator$astream_chat_to_completion_decoratorchat_to_completion_decorator#stream_chat_to_completion_decorator)
ChatMessageChatResponseChatResponseAsyncGenChatResponseGenCompletionResponseCompletionResponseAsyncGenCompletionResponseGenLLMMetadataMessageRole	TextBlock)FieldPrivateAttr)DEFAULT_TEMPERATURE)llm_chat_callbackllm_completion_callback)FunctionCallingLLM)ToolSelectionModel)parse_partial_json)PromptTemplate)FlexibleModel)	O1_MODELScreate_retry_decoratoris_function_calling_modelopenai_modelname_to_contextsizeresolve_openai_credentialsresolve_tool_choiceto_openai_message_dicts)BaseToolzgpt-4o-minif.returnc                 h     t        j                         dt        dt        dt        f fd       }|S )NargskwargsrJ   c                     t        | dd      }|dk  r | g|i |S t        |dddd      }  |      | g|i |S )Nmax_retriesr   T<         )rO   random_exponentialstop_after_delay_secondsmin_secondsmax_seconds)getattrrB   )selfrL   rM   rO   retryrI   s        h/home/kushmeetdev/Regenta/Chatbot/venv/lib/python3.12/site-packages/llama_index/llms/openai/responses.pywrapperz$llm_retry_decorator.<locals>.wrapperd   sd    dM15!T+D+F++&##%'
 uQx.t.v..    )	functoolswrapsr   )rI   r[   s   ` rZ   llm_retry_decoratorr_   c   s:    __Q/S /C /C / / Nr\   c                   &    e Zd ZdZdedee   fdZy)	TokenizerzBTokenizers support an encode function that returns a list of ints.textrJ   c                      y N )rX   rb   s     rZ   encodezTokenizer.encodez   s    r\   N)__name__
__module____qualname____doc__strr   intrf   re   r\   rZ   ra   ra   v   s    L3 49 r\   ra   responsec                     | j                   j                  j                  dg       }t        |      dkD  r|d   g| j                   j                  d<   y y )N
tool_callsrQ   r   )messageadditional_kwargsgetlen)rm   ro   s     rZ   force_single_tool_callrt   ~   sM    !!3377bIJ
:<FqM?**<8 r\   c            9       
    e Zd ZU dZ eed      Zeed<    ee	ddd      Z
eed	<    ed
ddd
      Zeed<    edd      Zee   ed<    edd      Zeee      ed<    edd      Zee   ed<    edd      Zeed<    edd      Zeed<    edd      Zeee      ed<    edd      Zeed<    edd       Zee   ed!<    edd"      Zeeeef      ed#<    eed$%      Zeeef   ed&<    ed'd(d)      Zeed*<    ed+d,d)      Zeed-<    edd.      Z eed/<    edd0      Z!eeeef      ed1<    edd2      Z"eed3<    ed45      Z#eed6<    ed75      Z$eed8<    edd9      Z%ee&d:      ed;<    edd<      Z'ee   ed=<    e(       Z)e*ed><    e(       Z+e,ed?<    e(       Z-ee.j^                     ed@<    e(       Z0ee.jb                     edA<    e(       Z2ee   edB<   ee	dddddddddddddd'd+dddddddddfded	edee   d;ee&d:      deee      dee   dededeee      ded!ee   dCee   d#eeeef      d/ed&eeeef      d*ed-ed3ee   d6ee   d8ee   d1eeeef      dDee.j^                     dEee.jb                     dFee*   dGee,   d=ee   dHedIdf8 fdJZ3e4dIefdK       Z5e6dIe7fdL       Z8e6dIee9   fdM       Z:dIefdNZ;dIefdOZ<d}dPedIeeef   fdQZ=dHedIeeef   fdRZ> e?       dSe@eA   dHedIeBfdT       ZC e?       dSe@eA   dHedIeDfdU       ZE eF       	 d}dVedWedHedIeGfdX       ZH eF       	 d}dVedWedHedIeIfdY       ZJdZeeK   dIeBfd[ZLeMdSe@eA   dHedIeBfd\       ZNeO	 d~d]ePd^ed_eeQ   d`ee   d&eeef   daeeQ   dedCee   dIeReeeQ   ee   eeef   eeQ   ee   ef   fdb       ZSeMdSe@eA   dHedIeDfdc       ZT e?       dSe@eA   dHedIeBfdd       ZU e?       dSe@eA   dHedIeVfde       ZW eF       	 d}dVedWedHedIeGfdf       ZX eF       	 d}dVedWedHedIeYfdg       ZZeMdSe@eA   dHedIeBfdh       Z[eMdSe@eA   dHedIeVfdi       Z\	 	 	 	 	 	 ddje@dk   dlee]eeAf      dmeeeA      dnedoe]eef   dped/ee   dHedIeeef   fdqZ^	 ddrdsdtedHedIee_   fduZ`eaj                  	 d~dveced   dVeedweeeef      dxedIedf
 fdy       Zfeaj                  	 d~dveced   dVeedweeeef      dxedIedf
 fdz       Zgeaj                  	 d~dveced   dVeedweeeef      dxedIehe]edeif   ddf   f
 fd{       Zjeaj                  	 d~dveced   dVeedweeeef      dxedIeke]edeif   df   f
 fd|       Zl xZmS )OpenAIResponsesaO  
    OpenAI Responses LLM.

    Args:
        model: name of the OpenAI model to use.
        temperature: a float from 0 to 1 controlling randomness in generation; higher will lead to more creative, less deterministic responses.
        max_output_tokens: the maximum number of tokens to generate.
        include: Additional output data to include in the model response.
        instructions: Instructions for the model to follow.
        track_previous_responses: Whether to track previous responses. If true, the LLM class will statefully track previous responses.
        store: Whether to store previous responses in OpenAI's storage.
        built_in_tools: The built-in tools to use for the model to augment responses.
        truncation: Whether to auto-truncate the input if it exceeds the model's context window.
        user: An optional identifier to help track the user's requests for abuse.
        strict: Whether to enforce strict validation of the structured output.
        additional_kwargs: Add additional parameters to OpenAI request body.
        max_retries: How many times to retry the API call if it fails.
        timeout: How long to wait, in seconds, for an API call before failing.
        api_key: Your OpenAI api key
        api_base: The base URL of the API to call
        api_version: the version of the API to call
        default_headers: override the default headers for API requests.
        http_client: pass in your own httpx.Client instance.
        async_http_client: pass in your own httpx.AsyncClient instance.

    Examples:
        `pip install llama-index-llms-openai`

        ```python
        from llama_index.llms.openai import OpenAIResponses

        llm = OpenAIResponses(model="gpt-4o-mini", api_key="sk-...")

        response = llm.complete("Hi, write a short story")
        print(response.text)
        ```
    zThe OpenAI model to use.)defaultdescriptionmodelz)The temperature to use during generation.g        g       @)rw   rx   geletemperature      ?z)The top-p value to use during generation.top_pz)The maximum number of tokens to generate.r   )rx   gtmax_output_tokensNz8Additional output data to include in the model response.includez%Instructions for the model to follow.instructionsFzeWhether to track previous responses. If true, the LLM class will statefully track previous responses.track_previous_responsesz8Whether to store previous responses in OpenAI's storage.storez=The built-in tools to use for the model to augment responses.built_in_toolsdisabledzLWhether to auto-truncate the input if it exceeds the model's context window.
truncationzCAn optional identifier to help track the user's requests for abuse.userz$Metadata to include in the API call.call_metadataz7Additional kwargs for the OpenAI API at inference time.)default_factoryrx   rq      z"The maximum number of API retries.)rw   rx   rz   rO   g      N@z*The timeout, in seconds, for API requests.timeoutz>Whether to enforce strict validation of the structured output.strictz%The default headers for API requests.default_headerszThe OpenAI API key.api_keyzThe base URL for OpenAI API.)rx   api_basezThe API version for OpenAI API.api_versionz'The effort to use for reasoning models.)lowmediumhighreasoning_effortz*The context window override for the model.context_window_client_aclient_http_client_async_http_client_previous_response_idprevious_response_idhttp_clientasync_http_clientopenai_clientasync_openai_clientrM   rJ   c                    |xs i }t        |||      \  }}}|t        v rd}t        |   di d|d|d|d|d|d|d	|d
|d|	d|
d|d|d|d|d|d|d|d|d|d|d|| || _        | j
                  rd| _        || _        || _        |xs t        di | j                         | _        |xs t        di | j                  d      | _        y )N)r   r   r   r}   ry   r|   r   r   r   r   r   r   r   r   r   rq   rO   r   r   r   r   r   r   r   r   T)is_asyncre   )rE   rA   super__init__r   r   r   r   r   
SyncOpenAI_get_credential_kwargsr   r   r   )rX   ry   r|   r   r   r   r   r   r   r   r   r   r   r   r   rq   rO   r   r   r   r   r   r   r   r   r   r   rM   	__class__s                               rZ   r   zOpenAIResponses.__init__  s   < .3)C#*
&; IK 	
	
#	
 0	
 .		

 	
 &	
 &>	
 	
 *	
 "	
 	
 0	
 $	
 	
 $	
  !	
" #	
$ ,%	
& ('	
( )	
* *-	
2 &:" ((DJ'"3$S
(ST5P5P5R(S+ 
{ 0
))4)80
r\   c                      y)Nopenai_responses_llmre   )clss    rZ   
class_namezOpenAIResponses.class_nameU  s    %r\   c           	          t        | j                  xs t        | j                               | j                  xs ddt        | j                               | j                        S )NT)ry   )r   
num_outputis_chat_modelrC   
model_name)r3   r   rD   _get_model_namer   rC   ry   rX   s    rZ   metadatazOpenAIResponses.metadataY  s]    .. G.t/C/C/EF--3&?**,' zz	
 		
r\   c                 H    t        j                  | j                               S )z
        Get a tokenizer for this model, or None if a tokenizing method is unknown.

        OpenAI can do this using the tiktoken package, subclasses may not have
        this convenience.
        )tiktokenencoding_for_modelr   r   s    rZ   
_tokenizerzOpenAIResponses._tokenizerf  s     **4+?+?+ABBr\   c                     | j                   }d|v r|j                  d      d   }|S |j                  d      r|j                  d      d   }|S )Nzft-:r   zft:rQ   )ry   split
startswith)rX   r   s     rZ   r   zOpenAIResponses._get_model_namep  s[    ZZ
J#))#.q1J  ""5)#))#.q1Jr\   c                 >    t        | j                         t              S rd   )
isinstance_get_clientr   r   s    rZ   _is_azure_clientz OpenAIResponses._is_azure_clientx  s    $**,k::r\   r   c                     | j                   | j                  | j                  | j                  | j                  |r| j
                  dS | j                  dS )N)r   base_urlrO   r   r   r   )r   r   rO   r   r   r   r   )rX   r   s     rZ   r   z&OpenAIResponses._get_credential_kwargs{  sU    ||++||#336>422
 	
 EIDUDU
 	
r\   c                 
   | j                   xs g }| j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  g ||j                  dg       | j                  | j                  | j                  d}| j                  t        v r| j                  d| j                  i|d<   |j                  | j                          |xs i }|j                  |       |S )Ntools)ry   r   r   r   r   r   r   r|   r   r~   r   r   effortr   )r   ry   r   r   r   r   r   r   r|   popr~   r   r   rA   r   updaterq   )rX   rM   initial_toolsmodel_kwargss       rZ   _get_model_kwargsz!OpenAIResponses._get_model_kwargs  s    ++1rZZ|| --!%!7!7**$($>$>ZZ++?}?vzz'2'>?ZZ//II
 ::"t'<'<'H08$:O:O/PL+, 	D2232F#r\   messagesc                 (     | j                   |fi |S rd   )_chatrX   r   rM   s      rZ   chatzOpenAIResponses.chat  s    tzz(-f--r\   c                 (     | j                   |fi |S rd   )_stream_chatr   s      rZ   stream_chatzOpenAIResponses.stream_chat  s     !t  4V44r\   prompt	formattedc                 >    t        | j                        } ||fi |S rd   )r*   r   )rX   r   r   rM   complete_fns        rZ   completezOpenAIResponses.complete  s"     34::>6,V,,r\   c                 >    t        | j                        } ||fi |S rd   )r+   r   )rX   r   r   rM   stream_complete_fns        rZ   stream_completezOpenAIResponses.stream_complete  s&     AARARS!&3F33r\   outputc                 8   t        t        j                  g       }dg i}g }|D ]T  }t        |t              rg }|j
                  D ]j  }t        |d      r%|j                  t        |j                               t        |d      r|j                  |d<   t        |d      s\|j                  |d<   l |j                  j                  |       t        |t              r|d   j                  |       t        |t              r|j                  |       t        |t               r|d   j                  |       t        |t"              r|d   j                  |       >t        |t$              sP||d<   W |r|r||j&                  d<   t)        ||	      S )
N)roleblocksbuilt_in_tool_callsrb   )rb   annotationsrefusal	reasoningro   )rp   rq   )r,   r4   	ASSISTANTr   r   contenthasattrappendr5   rb   r   r   r   extendr   r   r   r   r   rq   r-   )rX   r   rp   rq   ro   itemr   parts           rZ   _parse_response_outputz&OpenAIResponses._parse_response_output  sp   ;#8#8D2B7
 	6D$ 56 LL DDtV,iTYY&?@t]3;?;K;K)-8tY/7;||))4D %%f-D"<=!"78??ED":;!!$'D";<!"78??ED":;!"78??ED"7815!+.+	6. '6@G%%l3G?PQQr\   c           	      X   t        || j                  d      } | j                  j                  j                  d|dd | j
                  di |}| j                  r|j                  | _        | j                  |j                        }||_        |j                  |j                  d<   |S NTry   is_responses_apiFinputstreamusagere   )rG   ry   r   	responsescreater   r   idr   r   r   rawr   rq   rX   r   rM   message_dictsrm   chat_responses         rZ   r   zOpenAIResponses._chat  s    /**!
 ;T\\33:: 

 %d$$.v.
 (()1D&33HOOD$3;>>''0r\   eventr   ro   r   current_tool_callc                 .   d}|}	t        | t              st        | t              r|r| j                  j                  }	nt        | t
              r)t        | j                  t              r| j                  }nt        | t              r| j                  }||z  }nrt        | t              r$|_|xj                  | j                  z  c_        n>t        | t              rF|+| j                  |_        d|_        |j                  t        di |j                                d}nt        | t               r3|j#                  dg       }
|
j                  | j$                         |
|d<   nt        | t&              r|j                  |        nt        | t(              r|j                  |        nat        | t*              r| |d<   nKt        | t,              r;t/        | d      r/t/        | j                  d      r| j                  j0                  |d<   ||||||	|fS )	a:  
        Process a ResponseStreamEvent and update the state accordingly.

        Args:
            event: The response stream event to process
            content: Current accumulated content string
            tool_calls: List of completed tool calls
            built_in_tool_calls: List of built-in tool calls
            additional_kwargs: Additional keyword arguments to include in ChatResponse
            current_tool_call: The currently in-progress tool call, if any
            track_previous_responses: Whether to track previous response IDs
            previous_response_id: Previous response ID if tracking

        Returns:
            A tuple containing the updated state:
            (content, tool_calls, built_in_tool_calls, additional_kwargs, current_tool_call, updated_previous_response_id, delta)
         N	completedr   r   rm   r   re   )r   r	   r   rm   r   r   r   r   r   deltar   	argumentsr   statusr   
model_dumpr   rr   
annotationr
   r   r   r   r   r   )r   r   ro   r   rq   r   r   r   r   updated_previous_response_idr   s              rZ   process_response_eventz&OpenAIResponses.process_response_event  s   H ';$e12j*7
 (/4~~/@/@,;<%**&>?$)JJ!56KKEuGFG ,!++u{{:+EF ,.3oo!++6!( !!,N/@/K/K/MN
 %)!?@+//rBKu//0/:m,CD&&u-BC&&u-45-2k*56uj)genng.N-2^^-A-A!'* (
 	
r\   c                 b     t        | j                  d      dt        f fd} |       S )NTr   rJ   c               3     K   d} g }g }dg i}d }
j                   } 
j                  j                  j                  d		dd 
j                  d	i D ]  }t
        j                  || ||||
j                  |      \  } }}}}}}
j                  r|
j                   k7  r|
_         |r||d<   t        t        t        j                  | |rd|ini       |||        y w
Nr   r   Tr   )r   r   ro   r   rq   r   r   r   ro   )r   r   rq   )rp   r   r   rq   re   )r   r   r   r   r   rv   r  r   r-   r,   r4   r   )r   ro   r   rq   r   local_previous_response_idr   r   rM   r   rX   s           rZ   genz)OpenAIResponses._stream_chat.<locals>.gen`  s;    GJ"$!6 ;DH)-)C)C&6//66 # )$((262 . $::#)(;&7&7-1-J-J)C ; 	'%%. 112d6P6PP1KD.&?R%&;< #'(22 '% ,8*D  &7 G.s   C!C$)rG   ry   r/   rX   r   rM   r	  r   s   ` ` @rZ   r   zOpenAIResponses._stream_chatV  s2     0**!
6	_ 6	p ur\   c                 D   K    | j                   |fi | d {   S 7 wrd   )_achatr   s      rZ   achatzOpenAIResponses.achat  s$      !T[[4V4444     c                 D   K    | j                   |fi | d {   S 7 wrd   )_astream_chatr   s      rZ   astream_chatzOpenAIResponses.astream_chat  s&      (T'';F;;;;r  c                 Z   K   t        | j                        } ||fi | d {   S 7 wrd   )r(   r  )rX   r   r   rM   acomplete_fns        rZ   	acompletezOpenAIResponses.acomplete  s,      5T[[A!&3F3333   "+)+c                 Z   K   t        | j                        } ||fi | d {   S 7 wrd   )r)   r  )rX   r   r   rM   astream_complete_fns        rZ   astream_completez OpenAIResponses.astream_complete  s0      C4CUCUV(:6::::r  c           	      t  K   t        || j                  d      } | j                  j                  j                  d|dd | j
                  di | d {   }| j                  r|j                  | _        | j                  |j                        }||_        |j                  |j                  d<   |S 7 ^wr   )rG   ry   r   r   r   r   r   r   r   r   r   r   r   rq   r   s         rZ   r  zOpenAIResponses._achat  s      0**!
 $B4==#:#:#A#A $
$
 %d$$.v.$
 
 (()1D&33HOOD$3;>>''0
s   AB8B6AB8c                 j    K   t        | j                  d      dt        f fd} |       S w)NTr   rJ   c                   K   d} g }g }dg i}d }j                   } j                  j                  j                  d	
dd j                  d	i 	 d {   }|2 3 d {   }t
        j                  || ||||j                  |      \  } }}}}}}j                  r|j                   k7  r|_         |r||d<   t        t        t        j                  | |rd|ini       |||       7 7 6 y wr  )r   r   r   r   r   rv   r  r   r-   r,   r4   r   )r   ro   r   rq   r   r  response_streamr   r   rM   r   rX   s            rZ   r	  z*OpenAIResponses._astream_chat.<locals>.gen  sU    GJ"$!6 ;DH)-)C)C&$BDMM$;$;$B$B %#% )$((262% O  / * *e $::#)(;&7&7-1-J-J)C ; 	'%%. 112d6P6PP1KD.&?R%&;< #'(22 '% ,8*D  &7 K*s7   AC9C3C9C7#C5$C7'BC95C77C9)rG   ry   r.   r
  s   ` ` @rZ   r  zOpenAIResponses._astream_chat  s7      0**!
8	/ 8	t us   .3r   rH   user_msgchat_historyallow_parallel_tool_callstool_choiceverbosec                 r   |D 	cg c]#  }	ddi|	j                   j                         d   % }
}	||}n| j                  }|r|
D ]  }d|d<   d|d   d<    t        |t              rt        t        j                  |	      }|xs g }|r|j                  |       ||
xs d|
rt        |      nd|d
|S c c}	w )Predict and call the tool.typefunctionNTr   F
parametersadditionalProperties)r   r   )r   r   r   parallel_tool_calls)
r   to_openai_toolr   r   rk   r,   r4   USERr   rF   )rX   r   r  r  r  r   r!  r   rM   tool
tool_specs	tool_specr   s                rZ   _prepare_chat_with_toolsz(OpenAIResponses._prepare_chat_with_tools  s      
 ZN4==#?#?#A*#MN

 

 F[[F' H	&*	(#BG	,'(>?H h$"(8(8(KH%2OOH% !'4?I.{;t#<	

 
 	
-
s   (B4rm   r-   error_on_no_tool_callc                 h   |j                   j                  j                  dg       }t        |      dk  r|rt	        dt        |       d      g S g }|D ]I  }	 t        |j                        }|j                  t        |j                  |j                  |             K |S # t        $ r i }Y Bw xY w)r#  ro   rQ   z)Expected at least one tool call, but got z tool calls.)tool_id	tool_nametool_kwargs)rp   rq   rr   rs   
ValueErrorr>   r   r   r<   call_idname)rX   rm   r/  rM   ro   tool_selections	tool_callargument_dicts           rZ   get_tool_calls_from_responsez,OpenAIResponses.get_tool_calls_from_responseF  s     ..22<D 	 z?Q$ ?J?PP\]  	# 	I# 293F3F G ""%--'nn -	   # "#s   B##B10B1
output_cls
llm_kwargsprompt_argsc                 R    |xs i }d|vrdn|d   |d<   t        |   ||fd|i|S )Structured predict.r   requiredr<  )r   structured_predictrX   r;  r   r<  r=  r   s        rZ   rA  z"OpenAIResponses.structured_predictk  sU      %2
 (z9Jz-?X 	=!
 w)
+5
9D
 	
r\   c                 n   K   |xs i }d|vrdn|d   |d<   t        |   ||fd|i| d{   S 7 w)r?  r   r@  r<  N)r   astructured_predictrB  s        rZ   rD  z#OpenAIResponses.astructured_predict  sc       %2
 (z9Jz-?X 	=!
 W0
+5
9D
 
 	
 
   +535c                 R    |xs i }d|vrdn|d   |d<   t        |   ||fd|i|S )Stream structured predict.r   r@  r<  )r   stream_structured_predictrB  s        rZ   rH  z)OpenAIResponses.stream_structured_predict  sU      %2
 (z9Jz-?X 	=!
 w0
+5
9D
 	
r\   c                 n   K   |xs i }d|vrdn|d   |d<   t        |   ||fd|i| d{   S 7 w)rG  r   r@  r<  N)r   astream_structured_predictrB  s        rZ   rJ  z*OpenAIResponses.astream_structured_predict  sc       %2
 (z9Jz-?X 	=!
 W7
+5
9D
 
 	
 
rE  )Frd   )NNTautoFN)T)nrg   rh   ri   rj   r6   DEFAULT_OPENAI_MODELry   rk   __annotations__r8   r|   floatr~   r   r!   rl   r   r   r   r   boolr   r   dictr   r   r   r   r   rq   rO   r   r   r   r   r   r   r   r    r   r7   r   r   r   r   r   httpxClientr   AsyncClientr   r   classmethodr   propertyr3   r   ra   r   r   r   r   r   r9   r#   r,   r-   r   r/   r   r:   r0   r   r2   r   r   r   r_   r   staticmethodr   r   r$   r  r   r  r.   r  r  r1   r  r  r  r&   r.  r<   r:  
dispatcherspanr%   r=   r?   rA  rD  r   r@   rH  r   rJ  __classcell__)r   s   @rZ   rv   rv      s|   $L $2LE3  #?	K  ?	E5  (-?(x}  $)N$GXd3i   #(;#L(3-  &+{&d  NE4  ,1S,NHT$Z(  bJ   YD(3-  /4:/M8DcN+  ).M)tCH~  8K 
 @GU 
 TFD  16"I1OXd38n-  3HIGSI&DEHcE)JKKKCH=Dhw'>?@  %*@%NHSM 
 &-GZ''MHk)+6=L(5<<(86Am!2!23C+6=8C=8 *0+/GK'+&*)./3$".2266:!%"&%)48.29=.259(,7N
N
 N
 $C=	N

 #7+B#CDN
 $s)$N
 smN
 #'N
 N
 !d,N
 N
 smN
 'smN
  S#X/N
 N
  $DcN3!N
" #N
$ %N
& #'N
( 3-)N
* c]+N
, "$sCx.1-N
. ell+/N
0 $E$5$561N
2  
+3N
4 &k25N
6 !7N
8 9N
: 
;N
` &3 & & 

+ 

 

 CHY/ C C ;$ ;
t 
S#X 
# $sCx. : .Xk2 .c .l . . 5 -59<5	5 5
 -2--&*->A-	- - -244&*4>A4	4 4RT2D-E R, R@ h{3 s |  ,  /3`
"`
`
 12`
 "#Y	`

  S>`
 $$<=`
 #'`
 'sm`
 
%&S	S#X)*	
`
 `
D A -A9<A	A AH 5;'5 5 
	5 5 <;'< < 
	< < -244&*4>A4	4 4 -2;;&*;>A;	#; ;  -9<	 0 C -C9<C	C CP 7;48*.(.!%*

#*
 5k!123*
 tK01	*

 $(*
 39%*
 *
 *
 *
 
c3h*
^ '+# #  $# 	#
 
m	#J __
 04	
K
 
 T#s(^,	

 
 

 
& __
 04	
K
 
 T#s(^,	

 
 

 
& __
 04	
K
 
 T#s(^,	

 
 
5-.d:	;
 
& __
 04	
K
 
 T#s(^,	

 
 
e]23T9	:
 
r\   rv   )er]   rQ  r   openair   r   r   r   openai.types.responsesr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   typingr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'    llama_index.core.instrumentationcoreinstrumentation
instrument(llama_index.core.base.llms.generic_utilsr(   r)   r*   r+    llama_index.core.base.llms.typesr,   r-   r.   r/   r0   r1   r2   r3   r4   r5    llama_index.core.bridge.pydanticr6   r7   llama_index.core.constantsr8   llama_index.core.llms.callbacksr9   r:   &llama_index.core.llms.function_callingr;   llama_index.core.llms.llmr<   r=   llama_index.core.llms.utilsr>   llama_index.core.promptsr?   llama_index.core.program.utilsr@   llama_index.llms.openai.utilsrA   rB   rC   rD   rE   rF   rG   get_dispatcherrg   rW  llama_index.core.tools.typesrH   rL  r_   ra   rt   rv   re   r\   rZ   <module>rn     s!      + '     *    $ 6 5    F : : 3 8   'Z&&x0
5$ 8CH- (382D &   K\ Kd Ku
( u
r\   