ó
    À‘´j6  ã                  ó  • S r SSKJr  SSKJr  SSKJrJrJrJ	r	  SSK
JrJrJr  SSKJr   " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r\	\\\\\4   r " S S\5      rg)u‡  The defined return values an answer can take.

A question that names a figure should come back as that figure, not as a
sentence containing it. These models are the shapes an answer is allowed to
have. The caller's `want` picks the shape in `expectation`. Under `auto`
the `fixed` agent picks the payload from the `Payload` union in the same call
that answers.

Every shape carries the ids it was read from. Table cells arrive tagged
(`<td id="t0-15-1">$2.97</td>`), so a scalar can name the exact cell its
value came from, and the value it reports can be checked against the text
printed in that cell â€” a grounding test no prose answer admits.
é    )Úannotations)ÚDecimal)ÚListÚLiteralÚOptionalÚUnion)Ú	BaseModelÚFieldÚcomputed_field)Ú	as_numberc                  ó¼   • \ rS rSr% SrSrS\S'   \" SS9rS\S	'   \" S
SS9r	S\S'   \" S
SS9r
S\S'   \" S
SS9rS\S'   \" S
SS9rS\S'   \\SS j5       5       rSrg
)ÚScalaré   z$One figure, as the source prints it.ÚscalarzLiteral['scalar']Úkindz¸The figure exactly as printed in the source, including its currency sign, separators, and any trailing sign: '$14.47', '4.6x', '92.6%', '(0.02)'. No words, no sentence, no explanation.©ÚdescriptionÚstrÚvalueNzIWhat the number counts: 'USD per share', 'USD thousands', 'percent', 'x'.)Údefaultr   úOptional[str]ÚunitzMThe period or as-of date the figure belongs to, as printed: 'March 31, 2026'.ÚperiodzOThe line item as printed in the source: 'Book Value Per Share of Common Stock'.ÚlabelzbThe id of the single cell or chunk this figure was read from. Must appear verbatim in the context.Ú	source_idc                ó,   • [        U R                  5      $ )aÌ  The figure as a plain number, sign applied and separators removed.

Derived from `value` rather than asked of the model. The conversion is
deterministic, and a model asked for it alongside the figure returns the
figure every time and the number only most of the time: one question put
four times came back with the figure four times and the number three.
A numeric column with unpredictable holes is worse than one computed in
a single place and tested there.
©r   r   ©Úselfs    Ú=/home/mande/repo/quber/src/quber/playground/answers/shapes.pyÚnumberÚScalar.number9   s   € ô ˜Ÿ™Ó$Ð$ó    © ©ÚreturnzOptional[Decimal])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r
   r   r   r   r   r   r   Úpropertyr!   Ú__static_attributes__r$   r#   r    r   r      s¨   ‡ Ù.à&€DÐ
Ó&Ùð?ñ€Eˆ3ó ñ  ØØ_ñ€Dˆ-ó ñ "ØØcñ€FˆMó ñ !ØØeñ€Eˆ=ó ñ  %Øð.ñ €Iˆ}ó ð Øó
%ó ó ó
%r#   r   c                  ór   • \ rS rSr% Sr\" SS9rS\S'   \" SS9rS\S'   S	r	S
\S'   \
\SS j5       5       rSrg	)ÚPointéH   z$One labelled figure inside a series.z4What this point is: a period, a segment, a category.r   r   r   zThe figure as printed.r   Nr   r   c                ó,   • [        U R                  5      $ )zJThe figure as a number, read from `value` on the same terms a scalar's is.r   r   s    r    r!   ÚPoint.numberO   s   € ô ˜Ÿ™Ó$Ð$r#   r$   r%   )r'   r(   r)   r*   r+   r
   r   r,   r   r   r   r-   r!   r.   r$   r#   r    r0   r0   H   sI   ‡ Ù.áÐ#YÑZ€Eˆ3ÓZÙÐ#;Ñ<€Eˆ3Ó<Ø#€Iˆ}Ó#àØó%ó ó ó%r#   r0   c                  ób   • \ rS rSr% SrSrS\S'   \" SS9rS\S	'   S
r	S\S'   \" SS9r
S\S'   Srg
)ÚSerieséV   uA   One measure across several labels â€” periods, segments, buckets.ÚserieszLiteral['series']r   z)What is being measured across the points.r   r   ÚmeasureNr   r   é   )Ú
min_lengthzList[Point]Úpointsr$   )r'   r(   r)   r*   r+   r   r,   r
   r8   r   r;   r.   r$   r#   r    r5   r5   V   s9   ‡ ÙKà&€DÐ
Ó&ÙÐ%PÑQ€GˆSÓQØ€Dˆ-ÓÙ¨1Ñ-€FˆKÖ-r#   r5   c                  óV   • \ rS rSr% SrSrS\S'   S\S'   \" SS	9rS
\S'   Sr	S\S'   Sr
g)ÚGridé_   z@A rectangle of values, when the question asks for a whole table.ÚgridzLiteral['grid']r   ú	List[str]Úcolumnsz1Each row holds one string per column, as printed.r   zList[List[str]]ÚrowsNr   r   r$   )r'   r(   r)   r*   r+   r   r,   r
   rB   r   r.   r$   r#   r    r=   r=   _   s/   ‡ ÙJà"€Dˆ/Ó"ØÓÙ!Ð.aÑb€Dˆ/ÓbØ€Dˆ-Ör#   r=   c                  ó2   • \ rS rSr% SrSrS\S'   S\S'   Srg	)
ÚProseéh   zGFree text, for questions that ask for explanation rather than a figure.ÚprosezLiteral['prose']r   r   Útextr$   N)r'   r(   r)   r*   r+   r   r,   r.   r$   r#   r    rD   rD   h   s   ‡ ÙQà$€DÐ
Ó$Ø
†Ir#   rD   c                  ó>   • \ rS rSr% SrSrS\S'   \" SS9rS\S	'   S
r	g)ÚUnanswerableéo   z±The context does not contain the answer.

A distinct shape rather than an empty scalar: a caller in code must be able
to tell 'not present' from 'zero' without reading English.
ÚunanswerablezLiteral['unanswerable']r   z0One sentence: what was missing from the context.r   r   Úreasonr$   N)
r'   r(   r)   r*   r+   r   r,   r
   rL   r.   r$   r#   r    rI   rI   o   s$   ‡ ñð %3€DÐ
!Ó2ÙÐ$VÑW€FˆCÖWr#   rI   c                  óH   • \ rS rSr% Sr\" SS9rS\S'   \" \SS9r	S	\S
'   Sr
g)ÚAnsweré}   z>The single return value. Always this type; the payload varies.r   )ÚdiscriminatorÚPayloadÚpayloadz7Chunk ids and/or table cell ids supporting the payload.)Údefault_factoryr   r@   Ú	cited_idsr$   N)r'   r(   r)   r*   r+   r
   rR   r,   ÚlistrT   r.   r$   r#   r    rN   rN   }   s+   ‡ ÙHá¨6Ñ2€GˆWÓ2Ù ØØMñ€Iˆyö r#   rN   N)r+   Ú
__future__r   Údecimalr   Útypingr   r   r   r   Úpydanticr	   r
   r   Ú quber.playground.answers.figuresr   r   r0   r5   r=   rD   rI   rQ   rN   r$   r#   r    Ú<module>r[      s�   ðñõ #å ß 1Ó 1ç 5Ñ 5å 6ô,%ˆYô ,%ô^%ˆIô %ô.ˆYô .ôˆ9ô ôˆIô ôX�9ô Xð �˜  e¨\Ð9Ñ
:€ôˆYõ r#   