ó
    °"³jz ã                  óœ  • S SK Jr  S SKrS SKrS SKJrJr  S SKJ	r	J
r
JrJr  S SKJrJr  S SKJr  S SKJrJrJrJrJrJrJr  S SKJrJrJrJrJr  S S	K J!r!  S S
K"J#r#J$r$J%r%  S SK&J'r'  SSK(J)r)J*r*J+r,  SSK-J.r.J/r/  SSK0J1r1J2r2J3r3  SSK4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArA  SSKBJCrCJDrDJErEJFrF  SSKGJHrHJIrIJJrJ  \(       a  SSKKJLrLJMrM  \%" S5      rN \%" S\OS9rP \
\/\.   \P/\P4   \
\/\.   \P/\	\P   4   -  \
\P/\P4   -  \
\P/\	\P   4   -  rQ SrRSrS          SWS jrTSXS jrUSYS jrVSSS.               SZS jjrWSS .             S[S! jjrXSS"S#.           S\S$ jjrYSS"S#.             S]S% jjrZSSS"S&.                 S^S' jjr[SS .         S_S( jjr\S`S) jr]\ " S* S+\\.\P4   5      5       r^\" SS,9 " S- S.\\\7   5      5       r_\" SS/9 " S0 S1\_\7   5      5       r`\" SS/9 " S2 S3\_\7   5      5       ra " S4 S5\_\7   5      rb\" SS/9 " S6 S7\_\7   \5      5       rc " S8 S9\c\7   5      rd\" SS/9 " S: S;\c\7   5      5       re\" SS/9 " S< S=\_\7   5      5       rf " S> S?\\\7   5      rgSaS@ jrh\" SS,9 " SA SB\g\7   5      5       ri\" SS/9 " SC SD\i\7   5      5       rj\ " SE SF5      5       rk " SG SH\5      rl " SI SJ\5      rm\" SS/9 " SK SL\i\7   5      5       rn " SM SN\g\7   5      ro\" SS/9 " SO SP\o\7   5      5       rp\" SS/9 " SQ SR\I\.   5      5       rq\    SbSS j5       rr\ScST j5       rrScSU jrrSdSV jrsg)eé    )ÚannotationsN)ÚABCÚabstractmethod)Ú	AwaitableÚCallableÚMappingÚSequence)Ú	dataclassÚfield)ÚNoneType)ÚTYPE_CHECKINGÚAnyÚGenericÚLiteralÚcastÚ
get_originÚoverload)Ú	BaseModelÚJsonÚTypeAdapterÚValidationErrorÚcreate_model)ÚSchemaValidator)ÚSelfÚ	TypedDictÚTypeVar)Úget_function_type_hintsé   )Ú_function_schemaÚ_utilsÚmessages)Ú
AgentDepsTÚ
RunContext)Ú
ModelRetryÚToolRetryErrorÚ	UserError)ÚNativeOutputÚOutputContextÚOutputDataTÚ
OutputModeÚOutputObjectDefinitionÚ
OutputSpecÚOutputTypeOrFunctionÚPromptedOutputÚ
TextOutputÚTextOutputFuncÚ
ToolOutputÚ_ChoicesActionsÚ_OutputSpecItem)ÚDeferredToolRequestsÚGenerateToolJsonSchemaÚObjectJsonSchemaÚToolDefinition)ÚOUTPUT_TOOLSET_IDÚAbstractToolsetÚToolsetTool)ÚAbstractCapabilityÚ	RawOutputÚTÚOutputDataT_inv)ÚdefaultÚfinal_resultz/The final response which ends this conversationc               óB   ^ ^^^^• SmSUU UU4S jjnSU UUU4S jjnXE4$ )a¶  Build validate and process handlers that delegate to `processor.hook_validate`/`hook_execute`.

Output hooks see the **semantic value** (what the model was asked to produce), not the
internal dict-wrapped shape used by Pydantic validation. Each processor decides what its
semantic value looks like via its `hook_validate`/`hook_execute` methods, and opaque
per-invocation state (e.g. the resolved union member) flows through the closure.
Nc              “  ó8   >#   • TR                  U TTS9u  nmU$ 7f)N)Úrun_contextÚallow_partial)Úhook_validate)ÚdataÚsemanticrD   Ú	processorrC   Ústates     €€€€ÚP/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/_output.pyÚdo_validateÚ+_build_output_handlers.<locals>.do_validate_   s'   øé € à#×1Ñ1°$ÀKÐ_lÐ1Ðm‰ˆ�%Øˆùs   ƒc              “  óD   >#   • TR                  U TTTS9I S h  v•N $  N7f©N©rC   Úwrap_validation_errors)Úhook_execute)ÚoutputrH   rC   rI   rP   s    €€€€rJ   Ú
do_processÚ*_build_output_handlers.<locals>.do_processd   s2   øé € Ø×+Ñ+Ø�E {ÐKað ,ð 
÷ 
ð 	
ñ 
ùs   ƒ ™š )rF   r<   Úreturnr   ©rR   r   rU   r   © )rH   rC   rD   rP   rK   rS   rI   s   ````  @rJ   Ú_build_output_handlersrX   L   s)   ü€ ð" €E÷ò ÷

ò 
ð
 Ð"Ð"ó    c                ó|   •  [        X5      $ ! [         a$    [        U5      nUSL=(       a    [        X5      s $ f = f)a  `isinstance(value, type_)` that also works for generics like `list[Bar]`.

`isinstance(x, list[Bar])` raises `TypeError`; we fall back to the generic origin
(here `list`), so union output resolution still matches the collection type when the
element type can't be checked at runtime.
N)Ú
isinstanceÚ	TypeErrorr   )ÚvalueÚtype_Úorigins      rJ   Ú_isinstance_maybe_genericr`   l   sC   € ð@Ü˜%Ó'Ð'øÜó @Ü˜EÓ"ˆØ˜TÐ!×?¤j°Ó&?Ò?ð@ús   ‚
 �+;º;c                ó|   • [         R                  R                  XR                  UR                  S9n[        U5      $ )N©Ú	tool_nameÚtool_call_id)Ú	_messagesÚRetryPromptPartÚ
from_errorrc   rd   r%   )ÚerC   Úms      rJ   Ú_make_retry_promptrj   z   s5   € Ü×!Ñ!×,Ñ,¨Q×:OÑ:OÐ^i×^vÑ^vÐ,Ðw€AÜ˜!ÓÐrY   FT)rD   rP   c             ƒ  ó<  #   •  U R                  XUS9I Sh  v•N n U R                  XX4S9I Sh  v•N nU R                  XUS9I Sh  v•N $  N5 N! [        [        4 a€  nU(       a)  U(       a!  [	        U[        5      (       a  [        X�5      Uee  U R                  XX8S9I Sh  v•N  n SnAN{! [        [        4 a  n	U(       a  [        X‘5      U	ee Sn	A	ff = fSnAff = f N›! [         a    e [        [        4 a  nU(       a  [        X�5      Uee SnAff = f7f)ac  Run the output validate hooks around `do_validate`.

Validate hooks only fire for structured output that needs parsing.

`ValidationError` and `ModelRetry` from any hook (before, after, wrap, on_error) are
caught by the outer handler and converted to `ToolRetryError` when
`wrap_validation_errors` is True. When False (streaming), errors propagate as-is.
©Úoutput_contextrR   N©rm   rR   Úhandler©rm   rR   Úerror)	Úbefore_output_validateÚwrap_output_validater   r$   r[   rj   Úon_output_validate_errorÚafter_output_validater%   )
Ú
capabilityrC   rm   rR   rK   rD   rP   Ú	validatedrh   Ú
hook_errors
             rJ   Úrun_output_validate_hooksry      s4  é € ð$Ø!×8Ñ8¸ÐlrÐ8Ðs×sˆð	Ø(×=Ñ=ØÀ6ð >ð ÷ ˆIð"  ×5Ñ5°kÐirÐ5Ðs×sÐsñ) tñøô  ¤Ð,ó 	ÞÞ)¬j¸¼O×.LÑ.LÜ,¨QÓ<À!ÐCØðØ",×"EÑ"EØÀvð #Fð #÷ ð •	øô $¤ZÐ0ó Þ)Ü,¨ZÓEÈ:ÐUØûðþð	úñ tøÜó ØÜœZÐ(ó ö "Ü$ QÓ4¸!Ð;Øûðüs¦   ‚D„C& —A˜C& �A °A±A µC& ÁC$Á	C& ÁDÁC& ÁA ÁC!Á!0CÂB0Â%B(Â&B0Â+C& Â0CÃ CÃCÃCÃC!Ã!C& Ã&DÄ DÄDÄD©rP   c             ƒ  óž  #   •  U R                  XUS9I Sh  v•N n U R                  XX4S9I Sh  v•N nU R                  XUS9I Sh  v•N $  N5 N! [         a    e [         a    e [         a#  nU R                  XX7S9I Sh  v•N  n SnANXSnAff = f NL! [         a    e [        [        4 a  nU(       a  [        Xq5      Uee SnAff = f7f)uŠ  Run the output process hooks around `do_process`.

Process hooks fire for all output types (text, structured, image) â€” in every mode,
including tool output.

`ValidationError` and `ModelRetry` from any hook (before, after, wrap, on_error) are caught
by the outer handler and converted to `ToolRetryError` when `wrap_validation_errors` is True.
When False (streaming), errors propagate as-is.
rl   Nrn   rp   )	Úbefore_output_processÚwrap_output_processr%   r$   Ú	ExceptionÚon_output_process_errorÚafter_output_processr   rj   )rv   rC   rm   rR   rS   rP   Úresultrh   s           rJ   Úrun_output_process_hooksr‚   ±   sö   é € ð$Ø!×7Ñ7¸ÐkqÐ7Ðr×rˆð	Ø%×9Ñ9ØÀ6ð :ð ÷ ˆFð  ×4Ñ4°[ÐhnÐ4Ðo×oÐoñ# sñøô ó 	ØÜó 	ØÜó 	ð &×=Ñ=ØÀ6ð >ð ÷ ð �Fûð	úñ pøÜó ØÜœZÐ(ó ö "Ü$ QÓ4¸!Ð;Øûðüsˆ   ‚C„B —A˜B �A °A±A µB ÁBÁ	B ÁCÁB ÁA ÁBÁ/BÂBÂBÂB ÂBÂB ÂC
Â1CÃC
Ã
CrW   )rP   Úoutput_validatorsc           
   ƒ  ó¼   ^^#   • [        S[        S5      SSUR                  UR                  UR                  S9nSUU4S jjn[        U TUSUUS9I Sh  v•N $  N7f)z¯Run output process hooks for a `None` result (empty model response with `allows_none`).

Output validators run inside process hooks, matching the text/structured/image paths.
ÚtextNF©ÚmodeÚoutput_typeÚ
object_defÚhas_functionÚallows_textÚallows_imageÚallows_deferred_toolsc              “  ó^   >#   • U nT H  nUR                  UT5      I S h  v•N nM     U$  N
7f©N©Úvalidate©rR   r�   Ú	validatorrƒ   rC   s      €€rJ   rS   Ú*run_none_process_hooks.<locals>.do_processö   ó5   øé € ØˆÛ*ˆIØ$×-Ñ-¨f°kÓB×BŠFñ +àˆñ Cùó   ƒ- +¡-©rC   rm   rR   rS   rP   rV   )r(   Útyper‹   rŒ   r�   r‚   )rv   rC   ÚschemarP   rƒ   rm   rS   s    `  `  rJ   Úrun_none_process_hooksrš   à   sr   ùé € ô #ØÜ˜“JØØØ×&Ñ&Ø×(Ñ(Ø$×:Ñ:ñ€N÷ð ô *ØØØ%ØØØ5ñ÷ ð ñ ùs   „AAÁAÁAc          
   ƒ  ó²   ^^#   • [        S[        R                  SSUR                  SUR                  S9nSUU4S jjn[        UTUU UUS9I Sh  v•N $  N7f)	u©   Run output process hooks for image output (no validate hooks â€” nothing to parse).

Output validators run inside process hooks, consistent with text/structured output.
ÚimageNFTr†   c              “  ó^   >#   • U nT H  nUR                  UT5      I S h  v•N nM     U$  N
7fr�   r�   r’   s      €€rJ   rS   Ú+run_image_process_hooks.<locals>.do_process  r•   r–   r—   rV   )r(   re   ÚBinaryImager‹   r�   r‚   )rœ   rv   rC   r™   rP   rƒ   rm   rS   s     `  `  rJ   Úrun_image_process_hooksr      sn   ùé € ô #ØÜ×)Ñ)ØØØ×&Ñ&ØØ$×:Ñ:ñ€N÷ð ô *ØØØ%ØØØ5ñ÷ ð ñ ùs   „AAÁAÁA)rD   rP   rƒ   c          
   ƒ  ó4  ^^^#   • U R                  U5      n[        U TXVS9u  n	mSUUU4S jjn
[        U [        5      (       a  [	        UTUUU	UUS9I Sh  v•N nOU	" U5      I Sh  v•N n[        UTUUU
US9I Sh  v•N n[        [        U5      $  N; N, N7f)ad  Process output text through the processor with capability output hooks.

Validate hooks only fire for structured output (BaseObjectOutputProcessor) where
real parsing occurs. Process hooks fire for all output types.

Output validators (`@agent.output_validator`) run inside process hooks, ensuring
`wrap_output_process` wraps the complete output pipeline.
)rC   rD   rP   c              “  ó~   >#   • T" U 5      I S h  v•N nT H  nUR                  UT5      I S h  v•N nM     U$  N) N7fr�   r�   )rR   r�   r“   Úbase_do_processrƒ   rC   s      €€€rJ   rS   Ú)run_output_with_hooks.<locals>.do_processH  s?   øé € Ù& vÓ.×.ˆÛ*ˆIØ$×-Ñ-¨f°kÓB×BŠFñ +àˆñ /áBùs   ƒ=�9�=®;¯=»=)rC   rm   rR   rK   rD   rP   Nr—   rV   )Úget_output_contextrX   r[   ÚBaseObjectOutputProcessorry   r‚   r   r)   )rH   r…   rC   rv   r™   rD   rP   rƒ   rm   rK   rS   rw   r�   r£   s     `    `     @rJ   Úrun_output_with_hooksr§   -  sº   úé € ð& ×1Ñ1°&Ó9€NÜ#9Ø˜{¸-ñ$Ñ €K�÷ñ ô �)Ô6×7Ñ7ä3ØØ#Ø)ØØ#Ø'Ø#9ñ
÷ 
‰	ñ & dÓ+×+ˆ	ä+ØØØ%ØØØ5ñ÷ €Fô ”˜VÓ$Ð$ñ-
ñ ,ñùs6   …ABÁBÁBÁ'BÁ(BÁ=BÁ>BÂBÂBc             ƒ  óò   #   •  U R                  X!5      I Sh  v•N $  N! [         aK  nU(       a>  [        R                  R	                  XAR
                  UR                  S9n[        U5      Uee SnAff = f7f)u*  Execute an output function with error handling, converting `ModelRetry` to `ToolRetryError`.

Tracing for output-function execution is provided by the
[`Instrumentation`][pydantic_ai.capabilities.Instrumentation] capability's
`wrap_output_process` hook â€” this function executes the function plain.

Args:
    function_schema: The function schema containing the function to execute
    run_context: The current run context containing tool information
    args: Arguments to pass to the function
    wrap_validation_errors: If True, wrap `ModelRetry` exceptions in `ToolRetryError`

Returns:
    The result of the function execution

Raises:
    ToolRetryError: When `wrap_validation_errors` is True and a `ModelRetry` is caught
    ModelRetry: When `wrap_validation_errors` is False and a `ModelRetry` occurs
Nrb   )Úcallr$   re   rf   rg   rc   rd   r%   )Úfunction_schemarC   ÚargsrP   Úrri   s         rJ   Úexecute_output_functionr­   i  sq   é € ð4	Ø$×)Ñ)¨$Ó<×<Ð<Ñ<øÜó Þ!Ü×)Ñ)×4Ñ4Ø×2Ñ2À×AYÑAYð 5ð ˆAô ! Ó#¨Ð*àûðüs1   ‚A7„ ˜™ œA7� Ÿ
A4©AA/Á/A4Á4A7c              ƒ  óÞ   #   • [         R                  " U 5      (       a  U " 5       I Sh  v•N $ [         R                  " [         R                  " U 5      I Sh  v•N 5      I Sh  v•N $  N> N N7f)a[  Call the action the model picked from a `Choices` set.

The action takes no arguments and may be async; a plain `def` runs in a thread the way an output
function's does, and may still return an awaitable. A `ModelRetry` it raises propagates to the output
process hooks, which turn it into a retry prompt exactly as they do for an output function.
N)r    Úis_async_callableÚawait_maybeÚrun_in_executor)Úactions    rJ   Úexecute_choice_actionr³   �  sO   é € ô ×Ò ×'Ñ'Ù“X�~ÐÜ×#Ò#¬&×*@Ò*@ÀÓ*H×$HÓI×IÐIñ Ù$HÑIùs3   ‚&A-¨A'©-A-ÁA)ÁA-Á"A+Á#A-Á)A-Á+A-c                  óh   • \ rS rSr% S\S'   \" SS9rS\S'   \" SS9rS\S'   S	 r      SS
 jr	Sr
g)ÚOutputValidatori›  z0OutputValidatorFunc[AgentDepsT, OutputDataT_inv]ÚfunctionF©ÚinitÚboolÚ
_takes_ctxÚ	_is_asyncc                óÄ   • [        [        R                  " U R                  5      R                  5      S:„  U l        [        R                  " U R                  5      U l        g )Nr   )	ÚlenÚinspectÚ	signaturer¶   Ú
parametersrº   r    r¯   r»   ©Úselfs    rJ   Ú__post_init__ÚOutputValidator.__post_init__¡  s>   € Üœg×/Ò/°·±Ó>×IÑIÓJÈQÑNˆŒÜ×1Ò1°$·-±-Ó@ˆ�rY   c              ƒ  óÂ  #   • U R                   (       a  X!4nOU4nU R                  (       a<  [        [        [        /[
        [           4   U R                  5      nU" U6 I Sh  v•N $ [        [        [        /[        [
        [           -  4   U R                  5      n[        R                  " [        R                  " U/UQ76 I Sh  v•N 5      I Sh  v•N $  Nu N N7f)zôRun the validator function on `result`.

Propagates `ModelRetry` raised by the user's validator unwrapped; the caller
(`run_output_process_hooks`, `stream_text`, etc.) decides whether to wrap in
`ToolRetryError` for retry handling or re-raise.
N)rº   r»   r   r   r   r   r=   r¶   r    r°   r±   )rÂ   r�   rC   r«   r¶   s        rJ   r‘   ÚOutputValidator.validate¥  s¬   é € ð �?�?ØÐ&‰Dà�9ˆDà�>�>ÜœH¤c U¬I´a©LÐ%8Ñ9¸4¿=¹=ÓIˆHÙ! 4˜×(Ð(äœ¤# ¬¬I´a©LÑ(8Ð!8Ñ9¸4¿=¹=ÓIˆÜ×'Ò'¬f×.DÒ.DÀXÐ.UÐPTÒ.U×(UÓV×VÐVñ )ñ )VÑVùs7   ‚A!CÁ#CÁ$A$CÃCÃ	CÃCÃCÃCÃC)r»   rº   N)r�   r=   rC   úRunContext[AgentDepsT]rU   r=   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r   rº   r»   rÃ   r‘   Ú__static_attributes__rW   rY   rJ   rµ   rµ   ›  sQ   ‡ à>Ó>Ù %Ñ(€J�Ó(Ù Ñ'€IˆtÓ'òAðWàðWð ,ðWð 
÷	WrY   rµ   )Úkw_onlyc                  óð   • \ rS rSr% S\S'   SrS\S'   SrS\S'   SrS	\S
'   SrS\S'   Sr	S\S'   \
SS j5       r\
SS j5       r\SSSS.         SS jj5       r\   S         SS jj5       rSrg)ÚOutputSchemai½  r¹   Úallows_noneNú'BaseOutputProcessor[OutputDataT] | NoneÚtext_processorúOutputToolset[Any] | NoneÚtoolsetzOutputObjectDefinition | Noner‰   Fr�   rŒ   c                ó   • [        5       er�   ©ÚNotImplementedErrorrÁ   s    rJ   r‡   ÚOutputSchema.modeÆ  s   € ä!Ó#Ð#rY   c                ó   • U R                   S L$ r�   ©rÓ   rÁ   s    rJ   r‹   ÚOutputSchema.allows_textÊ  s   € à×"Ñ"¨$Ð.Ð.rY   ©ÚnameÚdescriptionÚstrictc          
     ó	  • [        U5      n[        U;   =(       d    SU;   nU(       a;  U Vs/ s H  ow[        Ld  M  Uc  M  UPM     nn[        U5      S:X  a  [        S5      e[        U;   nU(       a6  U Vs/ s H  ow[        Ld  M  UPM     nn[        U5      S:X  a  [        S5      e[
        R                  U;   n	U	(       a&  U Vs/ s H  ow[
        R                  Ld  M  UPM     nn[        S U 5       S5      =n(       a¨  [        U5      S:”  a  [        S5      e[        UR                  5      n
[        U
;   a  [        S5      e[
        R                  U
;   a  [        S	5      e[        UR                  U R                  U
UR                  UR                  UR                  S
9UU	US9$ [        S U 5       S5      =n(       a�  [        U5      S:”  a  [        S5      e[        UR                  5      n
[        U
;   a  [        S5      e[
        R                  U
;   a  [        S5      e[        UR                  U R                  U
UR                  UR                  S9UU	US9$ / n/ n/ nU HÕ  nU[         L a(  UR#                  [%        [&        [            U5      5        M4  [)        U[*        5      (       a  UR#                  U5        M\  [)        U[,        5      (       a  UR#                  U5        M„  [)        U[.        5      (       a  [        S5      e[)        U[0        5      (       a  [        S5      eUR#                  U5        M×     U(       a8  U(       d  U(       a*  UR#                  [%        [2        [4           [        5      5        [6        R9                  XÍ-   X#US
9nSn[        U5      S:”  at  [        U5      S:”  a  [        S5      eUS   n[)        U[*        5      (       a  [;        UR<                  5      nO
[?        5       nU(       a  [A        UUUU	US9$ [C        UUU	US9$ [        U5      S:”  a  [A        UUU	US9$ [        U5      S:”  a  [E        U R                  XÒX4S
9UUU	US9$ U	(       a	  [G        X†S9$ [        S5      es  snf s  snf s  snf )z4Build an OutputSchema dataclass from an output type.Nr   z<At least one output type must be provided other than `None`.zLAt least one output type must be provided other than `DeferredToolRequests`.c              3  óT   #   • U  H  n[        U[        5      (       d  M  Uv •  M      g 7fr�   )r[   r'   ©Ú.0rR   s     rJ   Ú	<genexpr>Ú%OutputSchema.build.<locals>.<genexpr>ë  s   é € Ð\² f¼:ÀfÌl×;[Ÿ6™6²ùó   ‚(Ÿ	(r   z,`NativeOutput` must be the only output type.z¤`NativeOutput` cannot contain `DeferredToolRequests`. Include it alongside the native output marker instead: `output_type=[NativeOutput(...), DeferredToolRequests]`z’`NativeOutput` cannot contain `BinaryImage`. Include it alongside the native output marker instead: `output_type=[NativeOutput(...), BinaryImage]`rÝ   )ÚtemplaterH   r�   rŒ   rÑ   c              3  óT   #   • U  H  n[        U[        5      (       d  M  Uv •  M      g 7fr�   )r[   r.   rã   s     rJ   rå   ræ     s   é € Ð`²'¨¼ZÈÔP^×=_ŸV™V²'ùrç   z.`PromptedOutput` must be the only output type.zª`PromptedOutput` cannot contain `DeferredToolRequests`. Include it alongside the prompted output marker instead: `output_type=[PromptedOutput(...), DeferredToolRequests]`z˜`PromptedOutput` cannot contain `BinaryImage`. Include it alongside the prompted output marker instead: `output_type=[PromptedOutput(...), BinaryImage]`)rÞ   rß   z*Only one `str` or `TextOutput` is allowed.)rÕ   rÓ   r�   rŒ   rÑ   ©rÓ   r�   rŒ   rÑ   )rÕ   r�   rŒ   rÑ   )rH   rÕ   r�   rŒ   rÑ   )r�   rÑ   z*At least one output type must be provided.)$Ú_flatten_output_specr   r½   r&   r4   re   rŸ   ÚnextÚoutputsÚNativeOutputSchemarè   Ú_build_processorrÞ   rß   rà   ÚPromptedOutputSchemaÚstrÚappendr   r˜   r[   r/   r1   r'   r.   r-   r)   ÚOutputToolsetÚbuildÚTextFunctionOutputProcessorÚoutput_functionÚTextOutputProcessorÚToolOutputSchemaÚTextOutputSchemaÚAutoOutputSchemaÚImageOutputSchema)ÚclsÚoutput_specrÞ   rß   rà   rí   rÑ   rR   r�   rŒ   Úflattened_outputsÚtext_outputsÚtool_outputsÚother_outputsrÕ   rÓ   Útext_outputs                    rJ   rô   ÚOutputSchema.buildÎ  s~  € ô ' {Ó3ˆô  'Ñ)×<¨T°W©_ˆÞÙ,3ÓeªG &ÄXÐ7M“vÐRX—v©GˆGÐeÜ�7‹|˜qÓ ÜÐ ^Ó_Ð_ä 4¸Ñ ?ÐÞ Ù,3ÓZªG &ÔEYÐ7Y—v©GˆGÐZÜ�7‹|˜qÓ ÜÐ nÓoÐoä ×,Ñ,°Ñ7ˆÞÙ,3Ó[ªG &ÄY×EZÑEZÐ7Z—v©GˆGÐ[äÑ\±Ó\Ð^bÓcÐcˆ6ÕcÜ�7‹|˜aÓÜÐ NÓOÐOä 4°V·^±^Ó DÐä#Ð'8Ó8Üð {óð ô ×$Ñ$Ð(9Ó9Üð ióð ô &ØŸ™Ø×.Ñ.Ø%ØŸ™Ø &× 2Ñ 2Ø!Ÿ=™=ð	 /ð ð '<Ø)Ø'ñð ô Ñ`±'Ó`ÐbfÓgÐgˆVÕgÜ�7‹|˜aÓÜÐ PÓQÐQä 4°V·^±^Ó DÐä#Ð'8Ó8Üð Aóð ô ×$Ñ$Ð(9Ó9Üð oóð ô (ØŸ™Ø×.Ñ.Ø%ØŸ™Ø &× 2Ñ 2ð /ð ð
 '<Ø)Ø'ñ
ð 
ð GIˆØ:<ˆØEGˆÛˆFØœŠ}Ø×#Ñ#¤D¬¬c©°FÓ$;Ö<Ü˜F¤J×/Ñ/Ø×#Ñ# FÖ+Ü˜F¤J×/Ñ/Ø×#Ñ# FÖ+Ü˜F¤L×1Ñ1äÐ NÓOÐOÜ˜F¤N×3Ñ3äÐ PÓQÐQà×$Ñ$ VÖ,ñ ö& žL®MØ× Ñ ¤Ô&:¼;Ñ&GÌÓ!RÔSä×%Ñ% lÑ&BÈÐouÐ%ÐvˆàBFˆäˆ|Ó˜qÓ Ü�<Ó  1Ó$ÜÐ LÓMÐMØ& q™/ˆKä˜+¤z×2Ñ2Ü!<¸[×=XÑ=XÓ!Y‘ä!4Ó!6�æÜ'Ø#Ø#1Ø*?Ø!-Ø +ñð ô (Ø#1Ø*?Ø!-Ø +ñ	ð ô ˆ|Ó˜qÓ Ü#ØØ&;Ø)Ø'ñ	ð ô ˆ}Ó Ó!Ü#Ø×.Ñ.¨}ÐU`Ð.ÐpØØ&;Ø)Ø'ñð ö Ü$Ð;PÑjÐjäÐDÓEÐEùò_ fùò [ùò \s(   ¬Q>¼Q>ÁQ>Á7RÂRÃRÃ!Rc                óf   • [        U 5      n [        U 5      S:X  a  [        U S   XUS9$ [        XXS9$ )Nr   r   )rR   rÞ   rß   rà   )rí   rà   rÞ   rß   )rë   r½   ÚObjectOutputProcessorÚUnionOutputProcessor)rí   rÞ   rß   rà   s       rJ   rï   ÚOutputSchema._build_processorn  s;   € ô ' wÓ/ˆÜˆw‹<˜1ÓÜ(°¸±
ÀÐgmÑnÐnä#¨GÈÑgÐgrY   rW   ©rU   r*   )rU   r¹   )
rý   zOutputSpec[OutputDataT]rÞ   ú
str | Nonerß   r	  rà   úbool | NonerU   zOutputSchema[OutputDataT]©NNN)
rí   ú+Sequence[OutputTypeOrFunction[OutputDataT]]rÞ   r	  rß   r	  rà   r
  rU   ú&BaseObjectOutputProcessor[OutputDataT])rÈ   rÉ   rÊ   rË   rÌ   rÓ   rÕ   r‰   r�   rŒ   Úpropertyr‡   r‹   Úclassmethodrô   Ústaticmethodrï   rÍ   rW   rY   rJ   rÐ   rÐ   ½  s  ‡ àÓØ>B€NÐ;ÓBØ)-€GÐ&Ó-Ø04€JÐ-Ó4Ø"'Ð˜4Ó'Ø€L�$Óàó$ó ð$ð ó/ó ð/ð ð
  Ø"&Ø"ñ]Fà,ð]Fð ð	]Fð
  ð]Fð ð]Fð 
#ô]Fó ð]Fð~ ð  Ø"&Ø"ð	
hØ<ð
hàð
hð  ð
hð ð	
hð
 
0ô
hó ó
hrY   rÐ   r·   c                  ó`   ^ • \ rS rSr% S\S'             SU 4S jjr\SS j5       rSrU =r	$ )	rú   i|  r  rH   c           	     óJ   >• [         TU ]  UUR                  UUUUS9  Xl        g )N)rÕ   r‰   rÓ   r�   rŒ   rÑ   )ÚsuperÚ__init__r‰   rH   )rÂ   rH   rÕ   r�   rŒ   rÑ   Ú	__class__s         €rJ   r  ÚAutoOutputSchema.__init__€  s6   ø€ ô 	‰ÑØØ ×+Ñ+Ø$Ø"7Ø%Ø#ð 	ñ 	
ð #�rY   c                ó   • g)NÚautorW   rÁ   s    rJ   r‡   ÚAutoOutputSchema.mode•  ó   € àrY   )rH   )
rH   r  rÕ   rÔ   r�   r¹   rŒ   r¹   rÑ   r¹   r  )
rÈ   rÉ   rÊ   rË   rÌ   r  r  r‡   rÍ   Ú__classcell__©r  s   @rJ   rú   rú   |  sR   ø‡ à5Ó5ð#à9ð#ð +ð#ð  $ð	#ð
 ð#ð ÷#ð* óó örY   rú   c                  óP   ^ • \ rS rSr        SU 4S jjr\SS j5       rSrU =r$ )rù   iš  c               ó&   >• [         TU ]  UUUUS9  g )Nrê   ©r  r  )rÂ   rÓ   r�   rŒ   rÑ   r  s        €rJ   r  ÚTextOutputSchema.__init__œ  s#   ø€ ô 	‰ÑØ)Ø"7Ø%Ø#ð	 	ò 	
rY   c                ó   • g)Nr…   rW   rÁ   s    rJ   r‡   ÚTextOutputSchema.mode«  r  rY   rW   )rÓ   z TextOutputProcessor[OutputDataT]r�   r¹   rŒ   r¹   rÑ   r¹   r  ©	rÈ   rÉ   rÊ   rË   r  r  r‡   rÍ   r  r  s   @rJ   rù   rù   š  sD   ø† ð
ð 9ð
ð  $ð	
ð
 ð
ð ÷
ð óó örY   rù   c                  ó@   ^ • \ rS rSrSU 4S jjr\SS j5       rSrU =r$ )rû   i°  c               ó$   >• [         TU ]  USUS9  g )NT)r�   rŒ   rÑ   r  )rÂ   r�   rÑ   r  s      €rJ   r  ÚImageOutputSchema.__init__±  s   ø€ Ü‰ÑÐ/DÐSWÐepÐÒqrY   c                ó   • g)Nrœ   rW   rÁ   s    rJ   r‡   ÚImageOutputSchema.mode´  s   € àrY   rW   )r�   r¹   rÑ   r¹   r  r#  r  s   @rJ   rû   rû   °  s   ø† ÷rð óó örY   rû   c                  óp   ^ • \ rS rSr% S\S'   S\S'   SS.         SU 4S jjjr\SS	 j5       rS
rU =r	$ )ÚStructuredTextOutputSchemai¹  r  rH   ústr | Literal[False] | Nonerè   N)rè   c               óT   >• [         TU ]  UUR                  UUUS9  X l        Xl        g )N)rÓ   r‰   r�   rŒ   rÑ   )r  r  r‰   rH   rè   )rÂ   rè   rH   r�   rŒ   rÑ   r  s         €rJ   r  Ú#StructuredTextOutputSchema.__init__¾  s8   ø€ ô 	‰ÑØ$Ø ×+Ñ+Ø"7Ø%Ø#ð 	ñ 	
ð #ŒØ �rY   c                ó.  • UR                   R                  5       nUR                  (       a  UR                  US'   UR                  (       a  UR                  US'   SU;  a  SR	                  US/5      nUR                  [        R                  " U5      S9$ )z<Build instructions from a template and an object definition.Útitlerß   z{schema}z

)r™   )Újson_schemaÚcopyrÞ   rß   ÚjoinÚformatÚjsonÚdumps)rü   rè   r‰   r™   s       rJ   Úbuild_instructionsÚ-StructuredTextOutputSchema.build_instructionsÑ  sz   € ð ×'Ñ'×,Ñ,Ó.ˆØ�?�?Ø(Ÿo™oˆF�7‰OØ×!×!Ø$.×$:Ñ$:ˆF�=Ñ!à˜XÓ%Ø—{‘{ H¨jÐ#9Ó:ˆHà�‰¤d§j¢j°Ó&8ˆÐ9Ð9rY   )rH   rè   )
rè   r+  rH   r  r�   r¹   rŒ   r¹   rÑ   r¹   )rè   rñ   r‰   r+   rU   rñ   )
rÈ   rÉ   rÊ   rË   rÌ   r  r  r6  rÍ   r  r  s   @rJ   r*  r*  ¹  sd   ø‡ à5Ó5Ø)Ó)ð
 15ñ!ð .ð!ð :ð	!ð
  $ð!ð ð!ð ÷!ð !ð& ó:ó ö:rY   r*  c                  ó(   • \ rS rSr\SS j5       rSrg)rî   ià  c                ó   • g)NÚnativerW   rÁ   s    rJ   r‡   ÚNativeOutputSchema.modeá  s   € àrY   rW   Nr  ©rÈ   rÉ   rÊ   rË   r  r‡   rÍ   rW   rY   rJ   rî   rî   à  s   † Øóó órY   rî   c                  ó(   • \ rS rSr\SS j5       rSrg)rð   iæ  c                ó   • g)NÚpromptedrW   rÁ   s    rJ   r‡   ÚPromptedOutputSchema.modeè  s   € àrY   rW   Nr  r<  rW   rY   rJ   rð   rð   æ  s   † àóó órY   rð   c                  óZ   ^ • \ rS rSrSS.         SU 4S jjjr\SS j5       rSrU =r$ )	rø   ií  NrÛ   c               ó(   >• [         TU ]  UUUUUS9  g )N)rÕ   r�   rÓ   rŒ   rÑ   r  )rÂ   rÕ   rÓ   r�   rŒ   rÑ   r  s         €rJ   r  ÚToolOutputSchema.__init__ï  s&   ø€ ô 	‰ÑØØ"7Ø)Ø%Ø#ð 	ò 	
rY   c                ó   • g)NÚtoolrW   rÁ   s    rJ   r‡   ÚToolOutputSchema.mode   r  rY   rW   )
rÕ   rÔ   rÓ   rÒ   r�   r¹   rŒ   r¹   rÑ   r¹   r  r#  r  s   @rJ   rø   rø   í  s[   ø† ð CGñ	
ð +ð
ð @ð	
ð
  $ð
ð ð
ð ÷
ð 
ð" óó örY   rø   c                  óÌ   • \ rS rSrSSS.       SS jjrSS.       SS jjrSS	.       SS
 jjrSS.         SS jjr\SSSS.         SS jj5       r	Sr
g)ÚBaseOutputProcessori  FN©rD   Úvalidation_contextc               ó   • U$ )zBValidate/parse raw output. Default: identity (returns data as-is).rW   )rÂ   rF   rD   rJ  s       rJ   r‘   ÚBaseOutputProcessor.validate  s	   € ð ˆrY   Trz   c             ƒ  ó   #   • U$ 7f)zVExecute output function on validated output. Default: identity (returns output as-is).rW   )rÂ   rR   rC   rP   s       rJ   r©   ÚBaseOutputProcessor.call  s   é € ð ˆùó   ‚©rD   c               ó>   • U R                  XUR                  S9nUS4$ )u¿  Validate raw data and return `(semantic_value, state)`.

`semantic_value` is what output hooks see â€” the logical value the model was asked to
produce (e.g., `MyModel(...)`, `42`, the input to a single-arg output function).
`state` is opaque per-invocation data that `hook_execute` needs to complete processing
(e.g., the resolved union member), or `None` if unused.

Default: runs `self.validate()` and returns the result as the semantic value.
rI  N)r‘   rJ  )rÂ   rF   rC   rD   rw   s        rJ   rE   Ú!BaseOutputProcessor.hook_validate  s'   € ð  —M‘M $ÐXc×XvÑXv�MÐwˆ	Ø˜$ˆÐrY   c             ƒ  ó>   #   • U R                  XUS9I Sh  v•N $  N7f)zÏExecute the post-validation stage on a (possibly hook-modified) semantic value.

`state` is the second element of the tuple returned by `hook_validate`.
Default: calls `self.call()` with the semantic value.
rO   N)r©   )rÂ   rG   rI   rC   rP   s        rJ   rQ   Ú BaseOutputProcessor.hook_execute-  s!   é € ð —Y‘Y˜xÐYo�YÐp×pÐpÑpùs   ‚–—©r‡   Ú	tool_callÚtool_defc               ó   • [        5       e)a=  Return context information about this processor for output hooks.

`schema` provides the run-wide output configuration (what the schema accepts).
`mode` overrides the reported mode for the current dispatch path (e.g. `'tool'`
when validating an output tool call within an `'auto'` schema); defaults to
`schema.mode`.
r×   ©rÂ   r™   r‡   rV  rW  s        rJ   r¥   Ú&BaseOutputProcessor.get_output_context<  s   € ô  "Ó#Ð#rY   rW   )rF   ústr | dict[str, Any] | NonerD   r¹   rJ  ú
Any | NonerU   r   ©rR   r   rC   rÇ   rP   r¹   rU   r   ©rF   r[  rC   rÇ   rD   r¹   rU   ztuple[Any, Any]©
rG   r   rI   r   rC   rÇ   rP   r¹   rU   r   ©
r™   úOutputSchema[Any]r‡   zOutputMode | NonerV  z_messages.ToolCallPart | NonerW  zToolDefinition | NonerU   r(   )rÈ   rÉ   rÊ   rË   r‘   r©   rE   rQ   r   r¥   rÍ   rW   rY   rJ   rH  rH    s$  † ð
 $Ø)-ñà)ðð ð	ð
 'ðð 
õð (,ñàðð ,ð	ð
 !%ðð 
õð $ñà)ðð ,ð	ð
 ðð 
õð2 (,ñqàðqð ðqð
 ,ðqð !%ðqð 
õqð ð
 #'Ø37Ø*.ñ$à!ð$ð  ð	$ð
 1ð$ð (ð$ð 
ô$ó ó$rY   rH  c                ó6   • U [         L d  U c  g[        U SS5      $ )a+  What to call an output type where its name is shown to the model.

`NoneType` is Python's name for the type of `None`; `None` is what the user wrote. A model offered
`final_result_NoneType` has to know a Python implementation detail to read it as "no answer", so the
route is named for the value instead. Both spellings arrive here: `int | None` resolves to the type,
while `ToolOutput(None)` and a bare `None` in a list of output types are unwrapped to the value, which
has no `__name__` at all and would otherwise leave its route named `final_result_`.
NÚNonerÈ   )r   Úgetattr©rR   s    rJ   Ú_output_type_namerf  O  s"   € ð ”Ò˜V™^ØÜ�6˜: tÓ,Ð,rY   c                  ó    • \ rS rSr% S\S'   Srg)r¦   i]  r+   r‰   rW   N©rÈ   rÉ   rÊ   rË   rÌ   rÍ   rW   rY   rJ   r¦   r¦   ]  s   ‡ à&Ö&rY   r¦   c                  óP  ^ • \ rS rSr% SrS\S'    SrS\S'   S\S'   SrS	\S
'   SrS\S'    SSSS.       SU 4S jjjr	SSS.       SS jjr
SS.       SS jjr\SS j5       rSS.       S S jjrSS.         S!S jjrSSSS.         S"S jjrSrU =r$ )#r  ib  Nztype[Any] | Nonerˆ   r	  Úouter_typed_dict_keyr   r“   z&_function_schema.FunctionSchema | Noner   zMapping[str, Any] | NoneÚ_choice_valuesrÝ   c          	     ó`  >• S U l         [        R                  " U5      =nb  UR                  U l        UR
                  n[        R                  " U5      (       d  [        R                  " U5      (       aÇ  [        R                  " U[        5      U l	        U R                  R                  U l        U R                  R                  nU R                  R                  US'   [        R                   " U5      nUR#                  5        H1  u  p‰US:w  d  M  [        R$                  " U	5      (       a  M*  X�l           GO
   GO['        [(        [*           U5      U l         [        R,                  " U5      (       a  [/        U5      =p«OZSU l        ['        [(        [2           U5      n[5        SSU05      n[/        U5      n
[5        SSU[6        U   -  05      n[/        U5      n['        [8        UR                  5      U l        [        R:                  " U
R                  [        S95      nU R0                  (       a  UR=                  S5        Uc  UR?                  SS 5      =n(       a  UnUR=                  SS 5      =n(       a  Uc  UnOU SU 3n[@        TU ]…  [E        U=(       d    [G        U5      UUUS	9S
9  g )Nrß   rU   ÚresponseÚresponse_data_typed_dictÚresponse_validation_typed_dict)Úschema_generatorr/  z. )rÞ   rß   r0  rà   ©r‰   )$rˆ   r2   ÚofÚvaluesrk  Ú	keys_typer¾   Ú
isfunctionÚismethodr   rª   r5   r“   r0  rß   r    r   ÚitemsÚis_call_ctxr   r˜   r   Úis_model_liker   rj  r)   r   r   r   Úcheck_object_json_schemaÚpopÚgetr  r  r+   rf  )rÂ   rR   rÞ   rß   rà   Úchoicesr0  Ú
type_hintsÚ	hint_nameÚ	hint_typeÚjson_schema_type_adapterÚvalidation_type_adapterrˆ   rn  ro  Újson_schema_titleÚjson_schema_descriptionr  s                    €rJ   r  ÚObjectOutputProcessor.__init__n  ss  ø€ ð  ˆÔä&×)Ò)¨&Ó1Ð1ˆGÑ>ð
 #*§.¡.ˆDÔØ×&Ñ&ˆFä×Ò˜f×%Ñ%¬×)9Ò)9¸&×)AÑ)AÜ$4×$DÒ$DÀVÔMcÓ$dˆDÔ!Ø!×2Ñ2×<Ñ<ˆDŒNØ×/Ñ/×;Ñ;ˆKØ)-×)>Ñ)>×)JÑ)JˆK˜Ñ&ô  ×7Ò7¸Ó?ˆJØ(2×(8Ñ(8Ö(:Ñ$�	Ø Õ(Ô1A×1MÒ1MÈi×1XÓ1XØ'0Ô$Úó );ô
  $¤D¬¡I¨vÓ6ˆDÔô ×#Ò# F×+Ñ+ÜEPÐQWÓEXÐXÐ(Ð+Bà,6�Ô)Ü15´d¼;Ñ6GÈÓ1P�ä+4Ø.Ø Ð-ó,Ð(ô ,7Ð7OÓ+PÐ(ô
 2;Ø4Ø ¬t°KÑ/@Ñ!@ÐAó2Ð.ô +6Ð6TÓ*UÐ'ô "¤/Ð3J×3TÑ3TÓUˆDŒNÜ ×9Ò9Ø(×4Ñ4ÔF\Ð4Ð]óˆKð ×(×(à—‘ Ô(à‰<°+·/±/À'È4Ó2PÐPÐ.ÕPØ$ˆDà&1§o¡o°mÀTÓ&JÐJÐ"ÕJØÑ"Ø5‘à!, ¨RÐ0GÐ/HÐI�ä‰ÑÜ-Ø×6Ô.¨vÓ6Ø'Ø'Øñ	ð 	ò 	
rY   FrI  c               ó$  • [        U[        5      (       a  [        R                  " U5      nU(       a  SOSn[        U[        5      (       a#  U R                  R                  U=(       d    SXCS9$ U R                  R                  U=(       d    0 XCS9$ )Nztrailing-stringsÚoffz{})rD   Úcontext)r[   rñ   r    Ústrip_markdown_fencesr“   Úvalidate_jsonÚvalidate_python)rÂ   rF   rD   rJ  Úpyd_allow_partials        rJ   r‘   ÚObjectOutputProcessor.validateÁ  sˆ   € ô �dœC× Ñ Ü×/Ò/°Ó5ˆDÞVcÑ@RÐinÐÜ�dœC× Ñ Ø—>‘>×/Ñ/Ø—˜Ð,=ð 0ð ð ð —>‘>×1Ñ1Ø—
˜Ð*;ð 2ð ð rY   Trz   c             ƒ  óf  #   • U R                   =n(       a  X   nU R                  (       a   [        U R                  UUUS9I S h  v•N nU$ U R                  bS  UR                  (       dB  U R                  [        [        U5         n[        U5      (       a  [        U5      I S h  v•N OUnU$  Nh N
7f)N©rC   r«   rP   )	rj  r   r­   rk  Úpartial_outputr   rñ   Úcallabler³   )rÂ   rR   rC   rP   Úkr]   s         rJ   r©   ÚObjectOutputProcessor.callÔ  s¨   é € ð ×)Ñ)Ð)ˆ1Õ)Ø‘YˆFà× × Ü2Ø×%Ñ%Ø'ØØ'=ñ	÷ ˆFð ˆð × Ñ Ñ,°[×5O×5Oà×'Ñ'¬¬S°&Ó(9Ñ:ˆEÜ;CÀE¿?¹?Ô0°Ó7×7Ð7ÐPUˆFàˆññ 8ùs%   ‚AB1ÁB-ÁAB1Â$B/Â%	B1Â/B1c                ó|   • U R                   b  U R                   $ U R                  b  U R                  R                  $ g)u  The internal envelope key around a single semantic value, or `None`.

Output hooks see the **semantic value** the model was asked to produce (e.g. a
`MyModel` instance, `42`, or the dict the user is producing as `dict[str, str]`).
Pydantic validation works in dict-shape (`{'response': 42}`, `{'data': my_dict}`)
for primitive and function-arg cases, so this property returns the key to peel off
at the hook boundary and re-add when calling the inner processor.

- `outer_typed_dict_key` â€” set when wrapping a bare primitive (`output_type=int`,
  `output_type=dict[str, str]`, etc.) so the model produces `{'response': value}`.
  The wrapper key is purely a transport detail; the value's own structure is
  unchanged.
- `FunctionSchema.single_field_name` â€” set when the output function takes exactly
  one value-carrying arg (`def f(x: SomeType)`). The wrapper key is the arg name.

Returns `None` for bare `BaseModel` outputs and multi-arg output functions, where
the validated value is the semantic value as-is (no envelope to peel).
N)rj  r   Úsingle_field_namerÁ   s    rJ   Úhook_unwrap_keyÚ%ObjectOutputProcessor.hook_unwrap_keyì  s=   € ð( ×$Ñ$Ñ0Ø×,Ñ,Ð,Ø× Ñ Ñ,Ø×(Ñ(×:Ñ:Ð:ØrY   rP  c               óh   • U R                  XUR                  S9nU R                  =nc  US 4$ XE   S 4$ ©NrI  )r‘   rJ  r–  )rÂ   rF   rC   rD   rw   r’  s         rJ   rE   Ú#ObjectOutputProcessor.hook_validate  sE   € ð —M‘M $ÐXc×XvÑXv�MÐwˆ	Ø×%Ñ%Ð%ˆAÑ.Ø˜d�?Ð"Ø‰|˜TÐ!Ð!rY   c             ƒ  ób   #   • U R                   =nb  XQ0nU R                  XUS9I S h  v•N $  N7frN   )r–  r©   )rÂ   rG   rI   rC   rP   r’  s         rJ   rQ   Ú"ObjectOutputProcessor.hook_execute  s9   é € ð ×%Ñ%Ð%ˆAÑ2Ø�}ˆHØ—Y‘Y˜xÐYo�YÐp×pÐpÑpùs   ‚&/¨-©/rU  c               ó$  • [        Ub  UOUR                  U R                  U R                  U R                  S LU R                  (       a!  [        U R                  R                  SS 5      OS UUUR                  UR                  UR                  S9
$ )NrÈ   ©
r‡   rˆ   r‰   rŠ   Úfunction_namerV  rW  r‹   rŒ   r�   )
r(   r‡   rˆ   r‰   r   rd  r¶   r‹   rŒ   r�   rY  s        rJ   r¥   Ú(ObjectOutputProcessor.get_output_context!  s�   € ô ØÑ)‘¨v¯{©{Ø×(Ñ(Ø—‘Ø×.Ñ.°dÐ:ØW[×Wl×Wlœ' $×"7Ñ"7×"@Ñ"@À*ÈdÔSÐrvØØØ×*Ñ*Ø×,Ñ,Ø"(×">Ñ">ñ
ð 	
rY   )rk  r   rj  rˆ   r“   )rR   z!OutputTypeOrFunction[OutputDataT]rÞ   r	  rß   r	  rà   r
  )rF   r[  rD   r¹   rJ  r\  rU   údict[str, Any])rR   r¡  rC   rÇ   rP   r¹   rU   r   ©rU   r	  r^  r_  r`  )rÈ   rÉ   rÊ   rË   rˆ   rÌ   rj  r   rk  r  r‘   r©   r  r–  rE   rQ   r¥   rÍ   r  r  s   @rJ   r  r  b  s¯  ø‡ à$(€KÐ!Ó(ðIð (,Ð˜*Ó+ØÓØ?CÐÐ<ÓCØ/3€NÐ,Ó3Øað  Ø"&Ø"ñQ
à1ðQ
ð ð	Q
ð
  ðQ
ð ÷Q
ð Q
ðn $Ø)-ñà)ðð ð	ð
 'ðð 
õð0 (,ñàðð ,ð	ð
 !%ðð 
õð0 óó ðð< $ñ
"à)ð
"ð ,ð	
"ð
 ð
"ð 
õ
"ð$ (,ñqàðqð ðqð
 ,ðqð !%ðqð 
õqð& #'Ø37Ø*.ñ
à!ð
ð  ð	
ð
 1ð
ð (ð
ð 
÷
ó 
rY   r  c                  ó.   • \ rS rSr% SrS\S'   S\S'   Srg)	Ú_UnionValidatedOutputi7  u>  Internal wrapper returned by `UnionOutputProcessor.validate()`.

Holds the resolved union member's kind key and the **semantic value** already
unwrapped by the inner processor (e.g. a `MyModel` instance or an `int`, not a
`{'response': ...}` dict). `UnionOutputProcessor.call()` uses `kind` to find the
right inner processor and rewraps `data` back into that processor's internal dict
shape before delegating.

This keeps `self._processors` lookup internal to the union processor â€” callers
(validate hooks, `hook_validate`) get clean semantic data without private access.
rñ   Úkindr   rF   rW   N)rÈ   rÉ   rÊ   rË   Ú__doc__rÌ   rÍ   rW   rY   rJ   r¤  r¤  7  s   ‡ ñ
ð ƒIØ
†IrY   r¤  c                  ó*   • \ rS rSr% S\S'   S\S'   Srg)ÚUnionOutputResultiI  rñ   r¥  r6   rF   rW   Nrh  rW   rY   rJ   r¨  r¨  I  s   ‡ Ø
ƒIØ
ÖrY   r¨  c                  ó    • \ rS rSr% S\S'   Srg)ÚUnionOutputModeliN  r¨  r�   rW   Nrh  rW   rY   rJ   rª  rª  N  s   ‡ ØÖrY   rª  c                  ó(  ^ • \ rS rSr% S\S'   S\S'   SSSS.       SU 4S jjjrS	SS
.       SS jjrSS.       SS jjrS	S.       SS jjrSS.         SS jjr	\
SS j5       rSS jrSSSS.         SS jjrSrU =r$ )r  iR  z'ObjectOutputProcessor[UnionOutputModel]Ú_union_processorz-dict[str, ObjectOutputProcessor[OutputDataT]]Ú_processorsNrÝ   c          	     ó6  >• / n0 U l         U HÒ  n[        XdS9nUR                  nUR                  =(       d    UR                  n	Sn
U	nX�R                   ;   a  U
S-  n
U SU
 3n	X�R                   ;   a  M  XpR                   U	'   UR
                  nUR                  (       a  UR                  US'   UR                  (       a  UR                  US'   UR                  U5        MÔ     [        [        R                  [        [        [        U R                   5         S4S9n[        [        R                  [        US4S9n[        US	9U l        [        R                  " U5      u  p_/ n[!        U R                   R#                  5       U5       Ha  u  pœUR%                  SS 5      nUR%                  SS 5      nS
SU	S.US.SS/SS.nU(       a  UUS'   U(       a  UUS'   UR                  U5        Mc     S
SSU00S/SS.nU(       a  XüS'   [&        TU ]Q  [+        UUUUS9S9  g )N)rR   rà   r   Ú_r/  rß   .)Ú__base__r¥  )r°  r�   re  ÚobjectÚstring)r˜   Úconst©r¥  rF   r¥  rF   F)r˜   Ú
propertiesÚrequiredÚadditionalPropertiesr�   ÚanyOfz$defs)r0  rà   rÞ   rß   rq  )r­  r  r‰   rÞ   rÈ   r0  rß   rò   r   r¨  r   Útuplerª  r¬  r    Úmerge_json_schema_defsÚzipÚkeysr{  r  r  r+   )rÂ   rí   rÞ   rß   rà   Újson_schemasrR   rH   r‰   Ú
object_keyÚiÚoriginal_keyr0  Úconstrained_resultÚunion_modelÚall_defsÚdiscriminated_json_schemasr/  r„  Údiscriminated_json_schemar  s                       €rJ   r  ÚUnionOutputProcessor.__init__W  sT  ø€ ð 02ˆØˆÔÛˆFÜ-°VÑKˆIØ"×-Ñ-ˆJà#Ÿ™×;¨F¯O©OˆJØˆAØ%ˆLØ× 0Ñ 0Ó0Ø�Q‘�Ø ,˜~¨Q¨q¨cÐ2�
ð × 0Ñ 0Õ0ð ,5×Ñ˜ZÑ(à$×0Ñ0ˆKØ��Ø'1§¡�˜GÑ$Ø×%×%Ø-7×-CÑ-C�˜MÑ*à×Ñ Ö,ñ' ô0 *Ü×&Ñ&Ô1BÌ'ÔRWÐX\×XhÑXhÓRiÑJjÐloÐIpñ
Ðô #Ü×%Ñ%Ô0@ÐJ\Ð^aÐIbñ
ˆô !6¸[Ñ IˆÔä!'×!>Ò!>¸|Ó!LÑˆà=?Ð"Ü'*¨4×+;Ñ+;×+@Ñ+@Ó+BÀLÖ'QÑ#ˆJØ—O‘O G¨TÓ2ˆEð '2§o¡o°mÀTÓ&JÐ#ð !ð !)Ø!+ñð (ñð $ VÐ,Ø(-ñ)Ð%ö Ø5:Ð)¨'Ñ2Þ&Ø;RÐ)¨-Ñ8à&×-Ñ-Ð.GÖHñ/ (Rð4 àØÐ7ððð
 "˜
Ø$)ñ	
ˆö Ø#+˜Ñ ä‰ÑÜ-Ø'ØØØ'ñ	ð 	ò 	
rY   FrI  c               óô   • U R                   R                  XUS9nUR                  nUR                  nUR                  nU R
                  U   nUR                  XrUS9n	UR                  =n
b  Xš   n	[        XiS9$ )a   Validate the union envelope, resolve the kind, and return the inner semantic value.

The returned wrapper holds the kind key and the unwrapped semantic value (not the
inner processor's dict form). `call()` rewraps before delegating to the inner
processor.
rI  r´  )r¬  r‘   r�   r¥  rF   r­  r–  r¤  )rÂ   rF   rD   rJ  Úunion_validatedr�   r¥  Ú
inner_dataÚinnerÚinner_validatedr’  s              rJ   r‘   ÚUnionOutputProcessor.validate³  s�   € ð -1×,AÑ,A×,JÑ,JØÐBTð -Kð -
ˆð !×'Ñ'ˆØ—K‘KˆØ%+§[¡[ˆ
ð × Ñ  Ñ&ˆØŸ.™.¨Ðew˜.Ðxˆð ×&Ñ&Ð&ˆAÑ3Ø-Ñ0ˆOÜ$¨$ÑEÐErY   Trz   c             ƒ  ó¬   #   • U R                   UR                     nUR                  nUR                  =nb  Xe0nUR	                  XRUS9I Sh  v•N $  N7f)zÂDelegate to the inner processor resolved by the kind key in the wrapper.

Rewraps the semantic `data` into the inner processor's dict shape before calling,
inverting the unwrap in `validate()`.
NrO   )r­  r¥  rF   r–  r©   )rÂ   rR   rC   rP   rÊ  Ú
inner_argsr’  s          rJ   r©   ÚUnionOutputProcessor.callÑ  sV   é € ð × Ñ  §¡Ñ-ˆØ Ÿ+™+ˆ
Ø×&Ñ&Ð&ˆAÑ3Ø˜ˆJØ—Z‘Z 
Ð\r�ZÐs×sÐsÑsùs   ‚AAÁAÁArP  c               óf   • U R                  XUR                  S9nUR                  UR                  4$ r™  )r‘   rJ  rF   r¥  )rÂ   rF   rC   rD   rÈ  s        rJ   rE   Ú"UnionOutputProcessor.hook_validateã  s;   € ð Ÿ-™-ØÀ+×B`ÑB`ð (ð 
ˆð ×#Ñ# _×%9Ñ%9Ð9Ð9rY   c             ƒ  ó  #   • UnUbE  U R                   U   nU R                  Xa5      (       a   U R                  [        XQS9UUS9I Sh  v•N $ U R	                  U5      nUb  U R                  XsUS9I Sh  v•N $ U$  N2 N7f)uª  Dispatch the (possibly hook-modified) semantic value to the right inner processor.

If `state` (the resolved kind from `hook_validate`) is set and the semantic value's
type still matches that inner's `output_type`, use that kind. Otherwise â€” hook swapped
the value for a different union member, or we're on the error-recovery path with no
kind â€” resolve by `isinstance` so the output function still runs for the new type.
Nr´  rO   )r­  Ú_semantic_matches_innerr©   r¤  Ú_resolve_inner_for_value)rÂ   rG   rI   rC   rP   r¥  rÊ  Úmatchs           rJ   rQ   Ú!UnionOutputProcessor.hook_executeð  s�   é € ð !ˆØÑØ×$Ñ$ TÑ*ˆEØ×+Ñ+¨E×<Ñ<Ø!ŸY™YÜ)¨tÑCØ +Ø+Að 'ð ÷ ð ð ×-Ñ-¨hÓ7ˆØÑØŸ™ 5ÐZp˜Ðq×qÐqð ˆññ rùs$   ‚AA?ÁA;Á	+A?Á4A=Á5A?Á=A?c                ó    • U R                   nUb  UR                  c  [        U[        5      $ U R                  c  g[        XR                  5      $ )aå  Check whether `semantic` matches the shape `inner` expects to receive.

- **Multi-arg output function** (`def f(x: int, y: str) -> Foo`): no unwrap key, so
  `semantic` is the validated dict of args. `inner.output_type` is the first arg's
  type, which can't be compared against the dict, so just check `isinstance(dict)`.
- **Single-value cases** (BaseModel, single-arg function, primitives): `semantic`
  is the unwrapped value, so isinstance against `inner.output_type` is correct.
F)r   r•  r[   Údictrˆ   r`   )rÊ  rG   Ú	fn_schemas      rJ   rÓ  Ú,UnionOutputProcessor._semantic_matches_inner  sM   € ð ×*Ñ*ˆ	ØÑ  Y×%@Ñ%@Ñ%HÜ˜h¬Ó-Ð-Ø×ÑÑ$ØÜ(¨×3DÑ3DÓEÐErY   c                óî   • U R                   R                  5        HW  u  p#UR                  c  M  UR                  nUb  UR                  c  M2  [        XR                  5      (       d  MN  [        X!S9s  $    g)aî  Find the inner processor whose `output_type` matches `value`.

Used on the error-recovery and type-mismatch paths in `hook_execute`. Returns a
`_UnionValidatedOutput` ready for `call()`, or `None` if no inner type matches.

Multi-arg output function inners are skipped: their `output_type` is the first
arg's type, not the dict shape `value` would have, so isinstance can't pick
them out unambiguously. The kind-trust path in `hook_execute` already handles
the normal multi-arg case (no swap).
Nr´  )r­  rw  rˆ   r   r•  r`   r¤  )rÂ   r]   r¥  rÊ  rÙ  s        rJ   rÔ  Ú-UnionOutputProcessor._resolve_inner_for_value$  sn   € ð  ×+Ñ+×1Ñ1Ö3‰KˆDØ× Ñ Ñ(ÙØ×.Ñ.ˆIØÑ$¨×)DÑ)DÑ)LÙÜ(¨×0AÑ0A×BÓBÜ,°$ÑCÒCñ 4ð rY   rU  c               óâ   • [        Ub  UOUR                  S U R                  [        S U R                  R                  5        5       5      UUUR                  UR                  UR                  S9	$ )Nc              3  ó<   #   • U  H  oR                   S Lv •  M     g 7fr�   )r   )rä   Úps     rJ   rå   Ú:UnionOutputProcessor.get_output_context.<locals>.<genexpr>E  s   é € Ð_ÒE^À×/Ñ/°tÕ;ÒE^ùs   ‚©	r‡   rˆ   r‰   rŠ   rV  rW  r‹   rŒ   r�   )	r(   r‡   r‰   Úanyr­  rs  r‹   rŒ   r�   rY  s        rJ   r¥   Ú'UnionOutputProcessor.get_output_context9  sg   € ô ØÑ)‘¨v¯{©{ØØ—‘ÜÑ_ÀT×EUÑEU×E\ÑE\ÔE^Ó_Ó_ØØØ×*Ñ*Ø×,Ñ,Ø"(×">Ñ">ñ

ð 
	
rY   )r­  r¬  )rí   r  rÞ   r	  rß   r	  rà   r
  )rF   r[  rD   r¹   rJ  r\  rU   r¤  )rR   r¤  rC   rÇ   rP   r¹   rU   r   r^  r_  )rÊ  zObjectOutputProcessor[Any]rG   r   rU   r¹   )r]   r   rU   z_UnionValidatedOutput | Noner`  )rÈ   rÉ   rÊ   rË   rÌ   r  r‘   r©   rE   rQ   r  rÓ  rÔ  r¥   rÍ   r  r  s   @rJ   r  r  R  sŠ  ø‡ à=Ó=Ø>Ó>ð  Ø"&Ø"ñZ
à<ðZ
ð ð	Z
ð
  ðZ
ð ÷Z
ð Z
ð@ $Ø)-ñFà)ðFð ð	Fð
 'ðFð 
õFðF (,ñtà%ðtð ,ð	tð
 !%ðtð 
õtð. $ñ:à)ð:ð ,ð	:ð
 ð:ð 
õ:ð& (,ñàðð ðð
 ,ðð !%ðð 
õðB óFó ðFô$ð2 #'Ø37Ø*.ñ
à!ð
ð  ð	
ð
 1ð
ð (ð
ð 
÷
ó 
rY   r  c                  ó<   • \ rS rSrSSSS.         SS jjrSrg)r÷   iN  NrU  c               ó†   • [        Ub  UOUR                  [        S SUUUR                  UR                  UR
                  S9	$ )NFrá  )r(   r‡   rñ   r‹   rŒ   r�   rY  s        rJ   r¥   Ú&TextOutputProcessor.get_output_contextO  sI   € ô ØÑ)‘¨v¯{©{ÜØØØØØ×*Ñ*Ø×,Ñ,Ø"(×">Ñ">ñ

ð 
	
rY   rW   r`  )rÈ   rÉ   rÊ   rË   r¥   rÍ   rW   rY   rJ   r÷   r÷   N  sG   † ð
 #'Ø37Ø*.ñ
à!ð
ð  ð	
ð
 1ð
ð (ð
ð 
÷
ð 
rY   r÷   c                  ó€   • \ rS rSr% S\S'   S\S'     SS jrSS.       SS	 jjrS
S
S
S.         SS jjrSrg
)rõ   id  ú_function_schema.FunctionSchemar   rñ   Ú_str_argument_namec                ó|  • [         R                  " U[        5      U l         U R                   R                  R	                  S0 5      =n(       a^  [        U5      S:w  dO  [        [        UR                  5       5      S 5      =n(       a%  UR	                  U0 5      R	                  S5      S:w  a  [        S5      eX0l
        g )Nrµ  r   r˜   r²  z>TextOutput must take a function taking a single `str` argument)r   rª   r5   r0  r|  r½   rì   Úiterr¼  r&   ré  )rÂ   rö   Úarguments_schemaÚargument_names       rJ   r  Ú$TextFunctionOutputProcessor.__init__i  s£   € ô !1× @Ò @ÀÔRhÓ iˆÔð &*×%:Ñ%:×%FÑ%F×%JÑ%JÈ<ÐY[Ó%\Ð\Ð!Õ\ÜÐ#Ó$¨Ó)Ü%)¬$Ð/?×/DÑ/DÓ/FÓ*GÈÓ%NÐN�MÕNØ×#Ñ# M°2Ó6×:Ñ:¸6ÓBÀhÓNäÐ\Ó]Ð]à"/ÕrY   Trz   c             ƒ  ód   #   • U R                   U0n[        U R                  X$US9I Sh  v•N $  N7f)z!Execute the text output function.r�  N)ré  r­   r   )rÂ   rR   rC   rP   r«   s        rJ   r©   Ú TextFunctionOutputProcessor.cally  s<   é € ð ×'Ñ'¨Ð0ˆÜ,Ø×!Ñ!¨{Ð^tñ
÷ 
ð 	
ñ 
ùs   ‚'0©.ª0NrU  c               óÆ   • [        Ub  UOUR                  [        S S[        U R                  R
                  SS 5      UUUR                  UR                  UR                  S9
$ )NTrÈ   rž  )	r(   r‡   rñ   rd  r   r¶   r‹   rŒ   r�   rY  s        rJ   r¥   Ú.TextFunctionOutputProcessor.get_output_context†  sa   € ô ØÑ)‘¨v¯{©{ÜØØÜ! $×"7Ñ"7×"@Ñ"@À*ÈdÓSØØØ×*Ñ*Ø×,Ñ,Ø"(×">Ñ">ñ
ð 	
rY   )r   ré  )rö   zTextOutputFunc[OutputDataT]r]  r`  )	rÈ   rÉ   rÊ   rË   rÌ   r  r©   r¥   rÍ   rW   rY   rJ   rõ   rõ   d  s�   ‡ à5Ó5ØÓð0à4ô0ð* (,ñ
àð
ð ,ð	
ð
 !%ð
ð 
õ
ð" #'Ø37Ø*.ñ
à!ð
ð  ð	
ð
 1ð
ð (ð
ð 
÷
ð 
rY   rõ   c                  ó  • \ rS rSr% SrS\S'    S\S'    S\S'    S	\S
'    S\S'   \   S         SS jj5       r   S         SS jjr\	SS j5       r
\	SS j5       rSS jrSS jr          SS jrSrg)ró   iœ  z<A toolset that contains output tools for agent output types.úlist[ToolDefinition]Ú
_tool_defsú%dict[str, ObjectOutputProcessor[Any]]Ú
processorsú
int | NoneÚmax_retrieszdict[str, int]Ú_max_retries_overridesz&list[OutputValidator[AgentDepsT, Any]]rƒ   Nc                ól  • [        U5      S:X  a  g 0 n/ nU=(       d    [        nUnUn	0 n
S n[        U5      S:„  nU GHn  nS nS nS nSn[        U[        5      (       aH  UR                  nUR
                  nUR                  nUR                  nUR                  nUR                  nU=(       d    UnUc  U	n[        XÓUS9nUR                  nUcD  UnU(       a;  [        R                  R                  SUR                  =(       d    S5      nUSU 3-  nSnUnX%;   a  US-  nU SU 3nX%;   a  M  UR
                  nU(       d  [        nU(       a  UR                   SU 3n[!        UUUR"                  UR                  UR$                  SUS	9nXõU'   UR'                  U5        Ub  XºU'   S nGMq     U " XVU
S
9$ )Nr   r   F)rR   rß   rà   Ú r¯  z: rR   )rÞ   rß   Úparameters_json_schemarà   rj  r¥  Ú
sequential)r÷  Ú	tool_defsÚmax_retries_overrides)r½   ÚDEFAULT_OUTPUT_TOOL_NAMEr[   r1   rÞ   rß   rà   rù  rþ  rR   r  r‰   r    ÚTOOL_NAME_SANITIZERÚsubÚDEFAULT_OUTPUT_TOOL_DESCRIPTIONr7   r0  rj  rò   )rü   rí   rÞ   rß   rà   r÷  rÿ  Údefault_nameÚdefault_descriptionÚdefault_strictr   Útool_max_retriesÚmultiplerR   rþ  rH   r‰   Ú	safe_namer¿  Úoriginal_namerW  s                        rJ   rô   ÚOutputToolset.buildª  sî  € ô ˆw‹<˜1ÓØà<>ˆ
Ø*,ˆ	à×7Ô7ˆØ)ÐØˆà02ÐØ'+Ðä�w“< !Ñ#ˆÜˆFØˆDØˆKØˆFØˆJÜ˜&¤*×-Ñ-à—{‘{�Ø$×0Ñ0�ØŸ™�Ø#)×#5Ñ#5Ð Ø#×.Ñ.�
àŸ™�à%×<Ð)<ˆKØ‰~Ø'�ä-°VÐ]cÑdˆIØ"×-Ñ-ˆJà‰|Ø#�Þä &× :Ñ :× >Ñ >¸rÀ:Ç?Á?×CXÐVXÓ Y�IØ˜a 	˜{˜OÑ+�DàˆAØ ˆMØÓ$Ø�Q‘�Ø'˜¨¨!¨Ð-�ð Õ$ð %×0Ñ0ˆKÞÜ=�ÞØ%/§_¡_Ð$5°R¸°}Ð"E�Kä%ØØ'Ø'1×'=Ñ'=Ø!×(Ñ(Ø%.×%CÑ%CØØ%ñˆHð  )�tÑØ×Ñ˜XÔ&ØÑ+Ø.> dÑ+Ø#Óñm ñp ˜jÐUjÑkÐkrY   c                óh   • X l         Xl        X0l        U=(       d    0 U l        U=(       d    / U l        g r�   )r÷  rõ  rù  rú  rƒ   )rÂ   rÿ  r÷  rù  r   rƒ   s         rJ   r  ÚOutputToolset.__init__ú  s.   € ð %ŒØ#ŒØ&ÔØ&;×&A¸rˆÔ#Ø!2×!8°bˆÕrY   c                ó   • [         $ r�   )r8   rÁ   s    rJ   ÚidÚOutputToolset.id  s   € ä Ð rY   c                ó   • g)Nzthe agent's output toolsrW   rÁ   s    rJ   ÚlabelÚOutputToolset.label  s   € à)rY   c              ƒ  ó   #   • U $ 7fr�   rW   )rÂ   Úctxs     rJ   Úfor_run_stepÚOutputToolset.for_run_step  s
   é € ØˆùrO  c              ƒ  óB  #   • U R                   c   S5       eU R                   nU R                   Vs0 s H_  nUR                  [        U UU R                  R                  UR                  U5      U R                  UR                     R                  S9_Ma     sn$ s  snf 7f)Nz7Agent must set OutputToolset.max_retries before the run)rÕ   rW  rù  Úargs_validator)rù  rõ  rÞ   r:   rú  r|  r÷  r“   )rÂ   r  rù  rW  s       rJ   Ú	get_toolsÚOutputToolset.get_tools  s�   é € Ø×ÑÑ+ÐfÐ-fÓfÐ+Ø×&Ñ&ˆð !ŸOšOó
ò ,�ð �M‰Mœ;ØØ!Ø ×7Ñ7×;Ñ;¸H¿M¹MÈ;ÓWØ#Ÿ™¨x¯}©}Ñ=×GÑGñ	ò ñ ,ñ
ð 	
ùò 
ùs   ‚/B±A&BÂBc              ƒ  ó    #   • [        S5      e7f)NzCOutput tools use validate_output_tool_call/execute_output_tool_callr×   )rÂ   rÞ   Ú	tool_argsr  rE  s        rJ   Ú	call_toolÚOutputToolset.call_tool   s   é € ô
 "Ð"gÓhÐhùs   ‚)rú  rõ  rù  rƒ   r÷  r  )
rí   zAlist[OutputTypeOrFunction[OutputDataT] | ToolOutput[OutputDataT]]rÞ   r	  rß   r	  rà   r
  rU   zSelf | None)
rÿ  rô  r÷  rö  rù  rø  r   zdict[str, int] | Nonerƒ   z-list[OutputValidator[AgentDepsT, Any]] | Noner¢  )rU   rñ   )r  rÇ   rU   zAbstractToolset[AgentDepsT])r  rÇ   rU   z"dict[str, ToolsetTool[AgentDepsT]])
rÞ   rñ   r  r¡  r  rÇ   rE  zToolsetTool[AgentDepsT]rU   r   )rÈ   rÉ   rÊ   rË   r¦  rÌ   r  rô   r  r  r  r  r  r  r  rÍ   rW   rY   rJ   ró   ró   œ  s4  ‡ áFà$Ó$ØDØ5Ó5Ø>ØÓð BØ*Ó*ØJØ=Ó=àð  Ø"&Ø"ðMlàRðMlð ðMlð  ð	Mlð
 ðMlð 
ôMló ðMlðf #'Ø7;ØKOð9à'ð9ð :ð9ð  ð	9ð
  5ð9ð Iõ9ð ó!ó ð!ð ó*ó ð*ôô
ðiØðiØ$2ðiØ9OðiØWnðià	÷irY   ró   c                ó   • g r�   rW   ©rý   s    rJ   rë   rë   (  s   € ð ),rY   c                ó   • g r�   rW   r"  s    rJ   rë   rë   .  s   € ØVYrY   c           	     óŠ  • [        U [        5      (       a  U nOU 4n/ nU HŸ  n[        U[        5      (       a1  UR                  [        [	        [
        [           U5      5      5        MI  [        R                  " U5      =n(       a  UR                  U5        My  UR                  [	        [        [           U5      5        M¡     U$ r�   )r[   r	   Úextendrë   r   r,   r=   r    Úget_union_argsrò   r3   )rý   rí   Úoutputs_flatrR   Úunion_typess        rJ   rë   rë   2  sœ   € ä�+œx×(Ñ(Ø‰à�.ˆà-/€LÛˆÜ�fœh×'Ñ'Ø×ÑÔ 4´T¼*ÄQ¹-ÈÓ5PÓ QÖRÜ"×1Ò1°&Ó9Ð9ˆ[Õ9Ø×Ñ Ö,à×Ñ¤¤_´QÑ%7¸Ó @ÖAñ ð ÐrY   c                óX  • [        U [        5      (       a  U nOU 4n/ nU GH  n[        U[        5      (       a&  UR                  [	        UR
                  5      5        M?  [        U[        5      (       a&  UR                  [	        UR
                  5      5        Mz  [        U[        5      (       a  UR                  [        5        M¦  [        U[        5      (       a&  UR                  [	        UR                  5      5        Má  [        R                  " U5      =n(       a  UR                  U5        GM  [        R                  " U5      (       d  [        R                   " U5      (       aY  [#        U5      nUR%                  SS 5      =n(       a  UR                  [	        U5      5        GM‰  UR                  [        5        GM¡  [&        R(                  " U5      =nb,  UR                  [+        [,        UR.                  5      5        GMæ  UR                  [+        [,        U5      5        GM     U$ )NrU   )r[   r	   r'   r%  Útypes_from_output_specrí   r.   r/   rò   rñ   r1   rR   r    r&  r¾   ru  rv  r   r|  r2   rr  r   r=   rt  )rý   rí   r'  rR   r(  r~  Úreturn_annotationr}  s           rJ   r*  r*  D  sŒ  € ä�+œx×(Ñ(Ø‰à�.ˆà(*€LÜˆÜ�fœl×+Ñ+Ø×ÑÔ 6°v·~±~Ó FÖGÜ˜¤×/Ñ/Ø×ÑÔ 6°v·~±~Ó FÖGÜ˜¤
×+Ñ+Ø×Ñ¤Ö$Ü˜¤
×+Ñ+Ø×ÑÔ 6°v·}±}Ó EÖFÜ"×1Ò1°&Ó9Ð9ˆ[Õ9Ø×Ñ ×,Ü×Ò ×'Ñ'¬7×+;Ò+;¸F×+CÑ+CÜ0°Ó8ˆJØ$.§N¡N°8¸TÓ$BÐBÐ ÕBØ×#Ñ#Ô$:Ð;LÓ$M×Nà×#Ñ#¤C×(Ü(×+Ò+¨FÓ3Ð3ˆgÑ@ð ×Ñ¤¤Q¨×(9Ñ(9Ó :×;à×Ñ¤¤Q¨£×0ñ- ð0 ÐrY   )
rH   ú BaseOutputProcessor[OutputDataT]rC   rÇ   rD   r¹   rP   r¹   rU   zMtuple[Callable[[RawOutput], Awaitable[Any]], Callable[[Any], Awaitable[Any]]])r]   r   r^   z	type[Any]rU   r¹   )rh   zValidationError | ModelRetryrC   zRunContext[Any]rU   r%   )rv   úAbstractCapability[AgentDepsT]rC   rÇ   rm   r(   rR   r<   rK   z%Callable[[RawOutput], Awaitable[Any]]rD   r¹   rP   r¹   rU   r   )rv   r-  rC   rÇ   rm   r(   rR   r   rS   zCallable[[Any], Awaitable[Any]]rP   r¹   rU   r   )rv   r-  rC   rÇ   r™   ra  rP   r¹   rƒ   ú*Sequence[OutputValidator[AgentDepsT, Any]]rU   r   )rœ   z_messages.BinaryImagerv   r-  rC   rÇ   r™   ra  rP   r¹   rƒ   r.  rU   r   )rH   r,  r…   rñ   rC   rÇ   rv   r-  r™   ra  rD   r¹   rP   r¹   rƒ   r.  rU   r)   )
rª   rè  rC   rÇ   r«   r¡  rP   r¹   rU   r   )r²   zCallable[[], Any]rU   r   )rR   r   rU   r	  )rý   z;OutputTypeOrFunction[T] | Sequence[OutputTypeOrFunction[T]]rU   z!Sequence[OutputTypeOrFunction[T]])rý   úOutputSpec[T]rU   zSequence[_OutputSpecItem[T]])rý   r/  rU   zSequence[T | type[str]])tÚ
__future__r   Ú_annotationsr¾   r4  Úabcr   r   Úcollections.abcr   r   r   r	   Údataclassesr
   r   Útypesr   Útypingr   r   r   r   r   r   r   Úpydanticr   r   r   r   r   Úpydantic_corer   Útyping_extensionsr   r   r   Úpydantic_ai._utilsr   rü  r   r    r!   re   Ú_run_contextr"   r#   Ú
exceptionsr$   r%   r&   rR   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   Útoolsr4   r5   r6   r7   Útoolsets.abstractr8   r9   r:   Úcapabilities.abstractr;   r<   r=   rñ   r>   ÚOutputValidatorFuncr  r  rX   r`   rj   ry   r‚   rš   r    r§   r­   r³   rµ   rÐ   rú   rù   rû   r*  rî   rð   rø   rH  rf  r¦   r  r¤  r¨  rª  r  r÷   rõ   ró   rë   r*  rW   rY   rJ   Ú<module>rA     så  ðÝ 2ã Û ß #ß BÓ Bß (Ý ß S× SÑ Sç PÕ PÝ )ß 6Ñ 6å 6ç =Ñ =ß 0ß =Ñ =÷÷ ÷ õ ÷ bÓ aß NÑ NæßDáˆCƒL€Ø ÙÐ+°SÑ9€ð
ð ˆj˜Ñ$ oÐ6¸ÐGÑHØ�
˜:Ñ&¨Ð8¸)ÀOÑ:TÐTÑUñVà�Ð  /Ð1Ñ2ñ3ð �Ð  )¨OÑ"<Ð<Ñ=ñ>ð ðð *Ð Ø"SÐ ð#Ø/ð#ð (ð#ð ð	#ð
 !ð#ðô#ô@@ôð  Ø#'ñ/Ø.ð/ð (ð/ð "ð	/ð
 ð/ð 7ð/ð ð/ð !ð/ð 	õ/ðr $(ñ,Ø.ð,ð (ð,ð "ð	,ð
 ð,ð 0ð,ð !ð,ð 	õ,ðh $(ØDFñ#à.ð#ð (ð#ð ð	#ð
 !ð#ð Bð#ð 	õ#ðX $(ØDFñ$Ø ð$ð /ð$ð (ð	$ð
 ð$ð !ð$ð Bð$ð 	õ$ð\  Ø#'ØDFñ9%Ø/ð9%ð ð9%ð (ð	9%ð
 /ð9%ð ð9%ð ð9%ð !ð9%ð Bð9%ð õ9%ðB $(ñ#Ø4ð#ð (ð#ð ð	#ð
 !ð#ð 	õ#ôL	Jð ôW�g˜j¨/Ð9Ñ:ó Wó ðWñB �4Ñô{h�3˜ Ñ,ó {hó ð{hñ| �Ñô�| KÑ0ó ó ðñ: �Ñô�| KÑ0ó ó ðô*˜ [Ñ1ô ñ �Ñô#: ¨kÑ!:¸Có #:ó ð#:ôLÐ3°KÑ@ô ñ �ÑôÐ5°kÑBó ó ðñ �Ñô�| KÑ0ó ó ðô.G$˜#˜w {Ñ3ô G$ôT-ñ �4Ñô'Ð 3°KÑ @ó 'ó ð'ñ �ÑôQ
Ð5°kÑBó Q
ó ðQ
ðh ÷ð ó ðô"˜	ô ô
�yô ñ �Ñôx
Ð4°[ÑAó x
ó ðx
ôv
Ð-¨kÑ:ô 
ñ, �Ñô4
Ð"5°kÑ"Bó 4
ó ð4
ñn �ÑôHi�O JÑ/ó Hió ðHiðV 
ð,ØLð,à&ó,ó 
ð,ð
 
Û Yó 
Ø Yôõ$ rY   