Ë
    µŒj²P  ã                   ó¬  — d dl Z d dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
mZmZmZ d dlmZ d dlmZ d dlmZ d dlmZmZ d d	lmZmZ d d
lmZmZmZmZmZm Z  dZ! G d„ de"«      Z# G d„ de$e«      Z% G d„ d«      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, G d„ de«      Z- G d „ d!ee-«      Z.y)"é    N)Úabstractmethod)ÚEnum)ÚAnyÚDictÚListÚMappingÚOptional)Úurlparse)ÚCallbackManagerForLLMRun)ÚBaseLLM)Ú
GenerationÚ	LLMResult)Úconvert_to_secret_strÚget_from_dict_or_env)Ú	BaseModelÚ
ConfigDictÚ	SecretStrÚfield_validatorÚmodel_validatorÚ	validatoré2   c                   óT   — e Zd ZdZdefdededededdf
d	„Z	 dd
ede	e
   dedefd„Zy)ÚAzureMLEndpointClientz AzureML Managed Endpoint client.Ú Úendpoint_urlÚendpoint_api_keyÚdeployment_nameÚtimeoutÚreturnNc                 óZ   — |r|st        d«      ‚|| _        || _        || _        || _        y)zInitialize the class.zXA key/token and REST endpoint should 
                be provided to invoke the endpointN)Ú
ValueErrorr   r   r   r   )Úselfr   r   r   r   s        ús/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain_community/llms/azureml_endpoint.pyÚ__init__zAzureMLEndpointClient.__init__   s<   € ñ  ¡|Üð6óð ð )ˆÔØ 0ˆÔØ.ˆÔØˆ�ó    ÚbodyÚrun_managerÚkwargsc                 óR  — dd| j                   z   dœ}| j                  dk7  r| j                  |d<   t        j                  j	                  | j
                  ||«      }t        j                  j                  ||j                  d| j                  «      ¬«      }|j                  «       }|S )zcall.úapplication/jsonzBearer )zContent-TypeÚAuthorizationr   zazureml-model-deploymentr   )r   )
r   r   ÚurllibÚrequestÚRequestr   ÚurlopenÚgetr   Úread)r"   r&   r'   r(   ÚheadersÚreqÚresponseÚresults           r#   ÚcallzAzureMLEndpointClient.call.   sš   € ð /Ø'¨$×*?Ñ*?Ñ?ñ
ˆð ×Ñ 2Ò%Ø26×2FÑ2FˆGÐ.Ñ/ä�n‰n×$Ñ$ T×%6Ñ%6¸¸gÓFˆÜ—>‘>×)Ñ)Ø˜Ÿ™ I¨t¯|©|Ó<ð *ó 
ˆð —‘“ˆØˆr%   ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚDEFAULT_TIMEOUTÚstrÚintr$   Úbytesr	   r   r   r6   © r%   r#   r   r      sx   „ Ù*ð  "Ø&ñàðð ðð ð	ð
 ðð 
óð* ;?ñàðð Ð6Ñ7ðð ð	ð
 
ôr%   r   c                   ó   — e Zd ZdZdZdZdZy)ÚAzureMLEndpointApiTypezýAzure ML endpoints API types. Use `dedicated` for models deployed in hosted
    infrastructure (also known as Online Endpoints in Azure Machine Learning),
    or `serverless` for models deployed as a service with a
    pay-as-you-go billing or PTU.
    Ú	dedicatedÚrealtimeÚ
serverlessN)r8   r9   r:   r;   rC   rD   rE   r@   r%   r#   rB   rB   H   s   „ ñð €IØ€HØ�Jr%   rB   c            	       óê   — e Zd ZU dZ	 dZee   ed<   	 dZee   ed<   	 dZ	eed<   e
dedefd	„«       Zedee   fd
„«       Zej                   fdedededefd„Zeej                   fdededefd„«       Zy)ÚContentFormatterBasezZTransform request and response of AzureML endpoint to match with
    required schema.
    r*   Úcontent_typeÚacceptszšError while formatting response payload for chat model of type  `{api_type}`. Are you using the right formatter for the deployed  model and endpoint type?Úformat_error_msgÚpromptr   c                 ón   — ddddddddœ}|j                  «       D ]  \  }}| j                  ||«      } Œ | S )	z*Escapes any special characters in `prompt`z\\z\"z\bz\fz\nz\rz\t)Ú\Ú"ÚÚÚ
ÚÚ	)ÚitemsÚreplace)rK   Ú
escape_mapÚescape_sequenceÚescaped_sequences       r#   Úescape_special_charactersz.ContentFormatterBase.escape_special_characters�   sT   € ð ØØØØØØñ
ˆ
ð 2<×1AÑ1AÖ1CÑ-ˆOÐ-Ø—^‘^ OÐ5EÓF‰Fð 2Dð ˆr%   c                 ó$   — t         j                  gS )z«Supported APIs for the given formatter. Azure ML supports
        deploying models using different hosting methods. Each method may have
        a different API structure.©rB   rC   ©r"   s    r#   Úsupported_api_typesz(ContentFormatterBase.supported_api_types”   s   € ô '×0Ñ0Ð1Ð1r%   Úmodel_kwargsÚapi_typec                 ó   — t        «       ‚)zÄFormats the request body according to the input schema of
        the model. Returns bytes or seekable file like object in the
        format specified in the content_type request header.
        )ÚNotImplementedError)r"   rK   r^   r_   s       r#   Úformat_request_payloadz+ContentFormatterBase.format_request_payloadœ   s   € ô "Ó#Ð#r%   Úoutputc                  ó   — y)z™Formats the response body according to the output
        schema of the model. Returns the data type that is
        received from the response.
        Nr@   )r"   rc   r_   s      r#   Úformat_response_payloadz,ContentFormatterBase.format_response_payload¨   s   � r%   N)r8   r9   r:   r;   rH   r	   r=   Ú__annotations__rI   rJ   ÚstaticmethodrY   Úpropertyr   rB   r]   rC   r   r   rb   r   r?   r   re   r@   r%   r#   rG   rG   T   s÷   … ñðð8 #5€L�(˜3‘-Ó4Ø@à/€GˆX�c‰]Ó/ØGð	$ð �có ð ð¨#ð °#ò ó ðð$ ð2 TÐ*@Ñ%Aò 2ó ð2ð ,B×+KÑ+Kñ	
$àð
$ð ð
$ð )ð	
$ð
 
ó
$ð ð ,B×+KÑ+Kñàðð )ðð 
ò	ó ñr%   rG   c                   óX   — e Zd ZdZedee   fd„«       Zdede	dede
fd„Zde
dedefd	„Zy
)ÚGPT2ContentFormatterzContent handler for GPT2r   c                 ó$   — t         j                  gS r7   r[   r\   s    r#   r]   z(GPT2ContentFormatter.supported_api_types·   ó   € ä&×0Ñ0Ð1Ð1r%   rK   r^   r_   c                 ó”   — t         j                  |«      }t        j                  dd|› d�gi|dœ«      }t        j                  |«      S )NÚinput_stringrN   ©ÚinputsÚ
parameters©rG   rY   ÚjsonÚdumpsr=   Úencode©r"   rK   r^   r_   Úrequest_payloads        r#   rb   z+GPT2ContentFormatter.format_request_payload»   sM   € ô &×?Ñ?ÀÓGˆÜŸ*™*à)¨a°¨x°q¨M¨?Ð;Ø*ñó
ˆô �z‰z˜/Ó*Ð*r%   rc   c                 óÖ   — 	 t        j                  |«      d   d   }t        |¬«      S # t        t        t        f$ r+}t        | j                  j                  |¬«      «      |‚d }~ww xY w)Nr   Ú0©r_   ©Útext©	rs   ÚloadsÚKeyErrorÚ
IndexErrorÚ	TypeErrorr!   rJ   Úformatr   ©r"   rc   r_   ÚchoiceÚes        r#   re   z,GPT2ContentFormatter.format_response_payloadÇ   sj   € ð	UÜ—Z‘Z Ó'¨Ñ*¨3Ñ/ˆFô ˜vÔ&Ð&øô œ*¤iÐ0ò 	UÜ˜T×2Ñ2×9Ñ9À8Ð9ÓLÓMÐSTÐTûð	Uús   ‚) ©A(½&A#Á#A(N©r8   r9   r:   r;   rh   r   rB   r]   r=   r   r?   rb   r   re   r@   r%   r#   rj   rj   ´   sf   „ Ù"àð2 TÐ*@Ñ%Aò 2ó ð2ð
+Øð
+Ø)-ð
+Ø9Oð
+à	ó
+ð'Øð'Ø'=ð'à	ô'r%   rj   c                   ó4   ‡ — e Zd ZU dZdZeed<   dˆ fd„Zˆ xZS )ÚOSSContentFormatterz`Deprecated: Kept for backwards compatibility

    Content handler for LLMs from the OSS catalog.NÚcontent_formatterc                 óL   •— t         ‰| �  «        t        j                  d«       y )Nz’`OSSContentFormatter` will be deprecated in the future. 
                      Please use `GPT2ContentFormatter` instead.  
                      ©Úsuperr$   ÚwarningsÚwarn©r"   Ú	__class__s    €r#   r$   zOSSContentFormatter.__init__Ø   s   ø€ Ü‰ÑÔÜ�‰ðõ	
r%   ©r   N©	r8   r9   r:   r;   r‰   r   rf   r$   Ú__classcell__©r�   s   @r#   rˆ   rˆ   Ñ   s   ø… ñ6ð "Ð�sÓ!÷
ñ 
r%   rˆ   c                   óX   — e Zd ZdZedee   fd„«       Zdede	dede
fd„Zde
dedefd	„Zy
)ÚHFContentFormatterz6Content handler for LLMs from the HuggingFace catalog.r   c                 ó$   — t         j                  gS r7   r[   r\   s    r#   r]   z&HFContentFormatter.supported_api_typesä   rl   r%   rK   r^   r_   c                 ó�   — t         j                  |«       t        j                  d|› d�g|dœ«      }t        j                  |«      S )NrN   ro   rr   rv   s        r#   rb   z)HFContentFormatter.format_request_payloadè   sF   € ô 	×6Ñ6°vÔ>ÜŸ*™*à˜v˜h a˜=˜/Ø*ñó
ˆô �z‰z˜/Ó*Ð*r%   rc   c                 óÜ   — 	 t        j                  |«      d   d   d   }t        |¬«      S # t        t        t        f$ r+}t        | j                  j                  |¬«      «      |‚d }~ww xY w)Nr   ry   Úgenerated_textrz   r{   r}   rƒ   s        r#   re   z*HFContentFormatter.format_response_payloadô   sp   € ð	UÜ—Z‘Z Ó'¨Ñ*¨3Ñ/Ð0@ÑAˆFô ˜vÔ&Ð&øô œ*¤iÐ0ò 	UÜ˜T×2Ñ2×9Ñ9À8Ð9ÓLÓMÐSTÐTûð	Uús   ‚, ¬A+Á &A&Á&A+Nr†   r@   r%   r#   r–   r–   á   sf   „ Ù@àð2 TÐ*@Ñ%Aò 2ó ð2ð
+Øð
+Ø)-ð
+Ø9Oð
+à	ó
+ð'Øð'Ø'=ð'à	ô'r%   r–   c                   óX   — e Zd ZdZedee   fd„«       Zdede	dede
fd„Zde
dedefd	„Zy
)ÚDollyContentFormatterz*Content handler for the Dolly-v2-12b modelr   c                 ó$   — t         j                  gS r7   r[   r\   s    r#   r]   z)DollyContentFormatter.supported_api_types  rl   r%   rK   r^   r_   c                 ó”   — t         j                  |«      }t        j                  dd|› d�gi|dœ«      }t        j                  |«      S )Nrn   rN   )Ú
input_datarq   rr   rv   s        r#   rb   z,DollyContentFormatter.format_request_payload  sM   € ô &×?Ñ?ÀÓGˆÜŸ*™*à-°!°F°8¸1°¨Ð?Ø*ñó
ˆô �z‰z˜/Ó*Ð*r%   rc   c                 óÐ   — 	 t        j                  |«      d   }t        |¬«      S # t        t        t        f$ r+}t        | j                  j                  |¬«      «      |‚d }~ww xY w)Nr   rz   r{   r}   rƒ   s        r#   re   z-DollyContentFormatter.format_response_payload  se   € ð	UÜ—Z‘Z Ó'¨Ñ*ˆFô ˜vÔ&Ð&øô œ*¤iÐ0ò 	UÜ˜T×2Ñ2×9Ñ9À8Ð9ÓLÓMÐSTÐTûð	Uús   ‚& ¦A%º&A Á A%Nr†   r@   r%   r#   rœ   rœ   þ   sf   „ Ù4àð2 TÐ*@Ñ%Aò 2ó ð2ð
+Øð
+Ø)-ð
+Ø9Oð
+à	ó
+ð'Øð'Ø'=ð'à	ô'r%   rœ   c                   óX   — e Zd ZdZedee   fd„«       Zdede	dede
fd„Zde
dedefd	„Zy
)ÚCustomOpenAIContentFormatterzAContent formatter for models that use the OpenAI like API scheme.r   c                 óB   — t         j                  t         j                  gS r7   )rB   rC   rE   r\   s    r#   r]   z0CustomOpenAIContentFormatter.supported_api_types  s   € ä&×0Ñ0Ô2H×2SÑ2SÐTÐTr%   rK   r^   r_   c                 óR  — t         j                  |«      }|t        j                  t        j                  fv r t        j                  dd|› d�g|dœi«      }n<|t        j                  k(  rt        j                  d|i|¥«      }nt        d|› d�«      ‚t        j                  |«      S )z/Formats the request according to the chosen apirŸ   rN   )rn   rq   rK   ú`api_type` ú# is not supported by this formatter)rG   rY   rB   rC   rD   rs   rt   rE   r!   r=   ru   rv   s        r#   rb   z3CustomOpenAIContentFormatter.format_request_payload"  s´   € ô &×?Ñ?ÀÓGˆØÜ"×,Ñ,Ü"×+Ñ+ð
ñ 
ô #Ÿj™jà Ø+,¨V¨H°A¨¨Ø&2ñ#ðó‰Oð Ô/×:Ñ:Ò:Ü"Ÿj™j¨(°FÐ)K¸lÐ)KÓL‰OäØ˜h˜ZÐ'JÐKóð ô �z‰z˜/Ó*Ð*r%   rc   c           	      óà  — |t         j                  t         j                  fv r(	 t        j                  |«      d   d   }t        |¬«      S |t         j                  k(  r	 t        j                  |«      d   d   }t        |t        «      st        d«      ‚	 t        |d   j                  «       t        |j!                  d	«      |j!                  d
«      ¬«      ¬«      S t        d|› d�«      ‚# t
        t        t        f$ r+}t        | j                  j                  |¬«      «      |‚d}~ww xY w# t
        t        t        f$ r+}t        | j                  j                  |¬«      «      |‚d}~ww xY w)zFormats responser   ry   rz   Nr{   ÚchoicesziEndpoint response is not well formed for a chat model. Expected `dict` but `{type(choice)}` was received.r|   Úfinish_reasonÚlogprobs)r©   rª   )r|   Úgeneration_infor¥   r¦   )rB   rC   rD   rs   r~   r   r€   r�   r!   rJ   r‚   r   rE   Ú
isinstanceÚdictÚstripr0   rƒ   s        r#   re   z4CustomOpenAIContentFormatter.format_response_payload;  sk  € ð Ü"×,Ñ,Ü"×+Ñ+ð
ñ 
ðYÜŸ™ FÓ+¨AÑ.¨sÑ3�ô  6Ô*Ð*ØÔ-×8Ñ8Ò8ð	YÜŸ™ FÓ+¨IÑ6°qÑ9�Ü! &¬$Ô/Ü#ð$óð ð 0ô Ø˜F‘^×)Ñ)Ó+Ü $Ø"(§*¡*¨_Ó"=Ø#ŸZ™Z¨
Ó3ô!ôð ô ˜; x jÐ0SÐTÓUÐUøô+ œj¬)Ð4ò YÜ  ×!6Ñ!6×!=Ñ!=ÀxÐ!=Ó!PÓQÐWXÐXûðYûô œj¬)Ð4ò YÜ  ×!6Ñ!6×!=Ñ!=ÀxÐ!=Ó!PÓQÐWXÐXûðYús/   ¤C, Á6D. Ã,D+Ä &D&Ä&D+Ä.E-Å&E(Å(E-Nr†   r@   r%   r#   r¢   r¢     sm   „ ÙKàðU TÐ*@Ñ%Aò Uó ðUð+Øð+Ø)-ð+Ø9Oð+à	ó+ð2VØðVØ'=ðVà	ôVr%   r¢   c                   ó4   ‡ — e Zd ZU dZdZeed<   dˆ fd„Zˆ xZS )ÚLlamaContentFormatterzNDeprecated: Kept for backwards compatibility

    Content formatter for Llama.Nr‰   c                 óL   •— t         ‰| �  «        t        j                  d«       y )NzŒ`LlamaContentFormatter` will be deprecated in the future. 
                Please use `CustomOpenAIContentFormatter` instead.  
            r‹   r�   s    €r#   r$   zLlamaContentFormatter.__init__d  s   ø€ Ü‰ÑÔÜ�‰ðõ	
r%   r‘   r’   r”   s   @r#   r°   r°   ]  s   ø… ñ$ð "Ð�sÓ!÷
ñ 
r%   r°   c                   ó¾  — e Zd ZU dZdZeed<   	 ej                  Z	eed<   	  e
d«      Zeed<   	 dZeed<   	 eZeed<   	 dZeed	<   d
Zeed<   dZeed<   	 dZee   ed<   	  ed¬«      Z ed¬«      ededefd„«       «       Z ed«      dededefd„«       Z  e!dd¬«      ededefd„«       «       Z" ed«      dededefd„«       Z# ed	d¬«      dedede$fd„«       Z%y)ÚAzureMLBaseEndpointz Azure ML Online Endpoint models.r   r   Úendpoint_api_typer   r   r   NÚhttp_clienté   Úmax_retriesr‰   r^   r@   )Úprotected_namespacesÚbefore)ÚmodeÚvaluesr   c                 óô   — t        t        |dd«      «      |d<   t        |dd«      |d<   t        |ddd«      |d<   t        |dd	t        j                  «      |d<   t        |d
dt	        t
        «      «      |d
<   |S )Nr   ÚAZUREML_ENDPOINT_API_KEYr   ÚAZUREML_ENDPOINT_URLr   ÚAZUREML_DEPLOYMENT_NAMEr   r´   ÚAZUREML_ENDPOINT_API_TYPEr   ÚAZUREML_TIMEOUT)r   r   rB   rC   r=   r<   )Úclsr»   s     r#   Úvalidate_environz$AzureMLBaseEndpoint.validate_environ‘  s¥   € ô &;Ü  Ð);Ð=WÓXó&
ˆÐ!Ñ"ô "6Ø�NÐ$:ó"
ˆˆ~Ñô %9ØÐ%Ð'@À"ó%
ˆÐ Ñ!ô ';ØØØ'Ü"×,Ñ,ó	'
ˆÐ"Ñ#ô 1ØØØÜ”Ó ó	
ˆˆyÑð ˆr%   Úfield_valuec           	      ó”   — |j                  d«      }||j                  vr(t        dt        |«      › d|j                  › d|› d�«      ‚|S )z>Validate that content formatter is supported by endpoint type.r´   zContent formatter fz8 is not supported by this endpoint. Supported types are z but endpoint is Ú.)r0   r]   r!   Útype)rÂ   rÄ   r»   r´   s       r#   Úvalidate_content_formatterz.AzureMLBaseEndpoint.validate_content_formatter¬  sh   € ð
 #ŸJ™JÐ':Ó;ÐØ K×$CÑ$CÑCÜØ%¤d¨;Ó&7Ð%8ð 91Ø1<×1PÑ1PÐ0Qð R#Ø#4Ð"5°Qð8óð ð
 Ðr%   ÚafterÚvaluec                 ó”   — |j                  d«      r|dd }t        |«      }|j                  r|j                  dk(  rt        d«      ‚|S )z'Validate that endpoint url is complete.Ú/NéÿÿÿÿzÁ`endpoint_url` should contain the full invocation URL including `/score` for `endpoint_api_type='dedicated'` or `/completions` or `/models/chat/completions` for `endpoint_api_type='serverless'`)Úendswithr
   Úpathr!   )rÂ   rÊ   Úurls      r#   Úvalidate_endpoint_urlz)AzureMLBaseEndpoint.validate_endpoint_urlº  sN   € ð �>‰>˜#ÔØ˜#˜2�JˆEÜ�u‹oˆØ�xŠx˜3Ÿ8™8 sš?Üð7óð ð ˆr%   c                 ó  — t        |j                  d«      «      }|t        j                  k(  s|t        j                  k(  r|j
                  dk(  st        d«      ‚|t        j                  k(  r|j
                  dvrt        d«      ‚|S )zBValidate that endpoint api type is compatible with the URL format.r   z/scorezõEndpoints of type `dedicated` should follow the format `https://<your-endpoint>.<your_region>.inference.ml.azure.com/score`. If your endpoint URL ends with `/completions` or`/models/chat/completions`,use `endpoint_api_type='serverless'` instead.)z/completionsz/models/chat/completionszÜEndpoints of type `serverless` should follow the format `https://<your-endpoint>.<your_region>.inference.ml.azure.com/completions` or `https://<your-endpoint>.<your_region>.inference.ml.azure.com/models/chat/completions`)r
   r0   rB   rC   rD   rÏ   r!   rE   )rÂ   rÄ   r»   r   s       r#   Úvalidate_endpoint_api_typez.AzureMLBaseEndpoint.validate_endpoint_api_typeÊ  s‘   € ô
   §
¡
¨>Ó :Ó;ˆàÔ1×;Ñ;Ò;ØÔ4×=Ñ=Ò=Ø×#Ñ# xÒ/Üð@óð ð Ô1×<Ñ<Ò<Ø×!Ñ!Ð)UÑUäðmóð ð Ðr%   T)Úalwaysc                 óÐ   — |j                  d«      }|j                  d«      }|j                  d«      }|j                  dt        «      }t        ||j                  «       ||«      }|S )z?Validate that api key and python package exists in environment.r   r   r   r   )r0   r<   r   Úget_secret_value)rÂ   rÄ   r»   r   Úendpoint_keyr   r   rµ   s           r#   Úvalidate_clientz#AzureMLBaseEndpoint.validate_clientç  sg   € ð —z‘z .Ó1ˆØ—z‘zÐ"4Ó5ˆØ Ÿ*™*Ð%6Ó7ˆØ—*‘*˜Y¬Ó8ˆä+ØØ×)Ñ)Ó+ØØó	
ˆð Ðr%   )&r8   r9   r:   r;   r   r=   rf   rB   rC   r´   r   r   r   r   r<   r   r>   rµ   r   r·   r‰   r^   r	   r­   r   Úmodel_configr   Úclassmethodr   rÃ   r   rG   rÈ   r   rÑ   rÓ   r   rØ   r@   r%   r#   r³   r³   m  s›  … Ù*à€L�#Óð+ð 1G×0PÑ0PÐÐ-ÓPðCñ #8¸Ó";Ð�iÓ;ð/ð €O�SÓðMð #€GˆSÓ"Ø3à€K�Óà€K�Óà!Ð�sÓ!ðð $(€L�(˜4‘.Ó'Ø1á°2Ô6€Lá˜(Ô#Øð dð ¨sò ó ó $ðñ2 Ð"Ó#ðØðØ'+ðà	òó $ðñ �^¨'Ô2Øð¨#ð °#ò ó ó 3ðñ Ð"Ó#ðØðØ'+ðà	òó $ðñ8 ˆ} TÔ*ð¨#ð °tð Ð@Uò ó +ñr%   r³   c                   ó€   — e Zd ZdZedeeef   fd„«       Zedefd„«       Z		 	 dde
e   dee
e      dee   d	edef
d
„Zy)ÚAzureMLOnlineEndpointa¯  Azure ML Online Endpoint models.

    Example:
        .. code-block:: python
            azure_llm = AzureMLOnlineEndpoint(
                endpoint_url="https://<your-endpoint>.<your_region>.inference.ml.azure.com/score",
                endpoint_api_type=AzureMLApiType.dedicated,
                endpoint_api_key="my-api-key",
                timeout=120,
                content_formatter=content_formatter,
            )
    r   c                 óJ   — | j                   xs i }i d| j                  i¥d|i¥S )zGet the identifying parameters.r   r^   )r^   r   )r"   Ú_model_kwargss     r#   Ú_identifying_paramsz)AzureMLOnlineEndpoint._identifying_params  s>   € ð ×)Ñ)Ò/¨Rˆð
Ø  $×"6Ñ"6Ð7ð
à˜}Ð-ð
ð 	
r%   c                  ó   — y)zReturn type of llm.Úazureml_endpointr@   r\   s    r#   Ú	_llm_typezAzureMLOnlineEndpoint._llm_type  s   € ð "r%   NÚpromptsÚstopr'   r(   c                 ót  — | j                   xs i }|j                  |«       |r||d<   g }|D ]~  }| j                  j                  ||| j                  «      }| j
                  j                  ||¬«      }	| j                  j                  |	| j                  «      }
|j                  |
g«       Œ€ t        |¬«      S )an  Run the LLM on the given prompts.

        Args:
            prompts: The prompt to pass into the model.
            stop: Optional list of stop words to use when generating.
        Returns:
            The string generated by the model.
        Example:
            .. code-block:: python
                response = azureml_model.invoke("Tell me a joke.")
        rä   )r&   r'   )Úgenerations)
r^   Úupdater‰   rb   r´   rµ   r6   re   Úappendr   )r"   rã   rä   r'   r(   rÞ   ræ   rK   rw   Úresponse_payloadrš   s              r#   Ú	_generatezAzureMLOnlineEndpoint._generate  sÇ   € ð$ ×)Ñ)Ò/¨RˆØ×Ñ˜VÔ$ÙØ$(ˆM˜&Ñ!ØˆãˆFØ"×4Ñ4×KÑKØ˜ t×'=Ñ'=óˆOð  $×/Ñ/×4Ñ4Ø$°+ð  5ó  Ðð "×3Ñ3×KÑKØ  $×"8Ñ"8óˆNð ×Ñ Ð/Õ0ð ô  [Ô1Ð1r%   )NN)r8   r9   r:   r;   rh   r   r=   r   rß   râ   r   r	   r   r   rê   r@   r%   r#   rÜ   rÜ   ù  s–   „ ñð ð
 W¨S°#¨XÑ%6ò 
ó ð
ð ð"˜3ò "ó ð"ð %)Ø:>ñ	$2à�c‘ð$2ð �t˜C‘yÑ!ð$2ð Ð6Ñ7ð	$2ð
 ð$2ð 
ô$2r%   rÜ   )/rs   Úurllib.requestr,   r�   Úabcr   Úenumr   Útypingr   r   r   r   r	   Úurllib.parser
   Ú langchain_core.callbacks.managerr   Ú#langchain_core.language_models.llmsr   Úlangchain_core.outputsr   r   Úlangchain_core.utilsr   r   Úpydanticr   r   r   r   r   r   r<   Úobjectr   r=   rB   rG   rj   rˆ   r–   rœ   r¢   r°   r³   rÜ   r@   r%   r#   Ú<module>rö      sÓ   ðÛ Û Û Ý Ý ß 5Õ 5Ý !å EÝ 7ß 8ß L÷÷ ð €ô,˜Fô ,ô^	˜S $ô 	÷]ñ ]ô@'Ð/ô 'ô:
Ð.ô 
ô 'Ð-ô 'ô:'Ð0ô 'ô:?VÐ#7ô ?VôD
Ð8ô 
ô I˜)ô IôX@2˜GÐ%8õ @2r%   