Ë
    ³ŒjÖY  ã                  ó�  — d dl mZ d dlmZmZ d dlmZ d dlmZ ddlm	Z	m
Z
 ddlmZ ddlmZmZmZmZmZmZmZmZ dd	lmZmZmZmZ dd
lmZ ddlmZmZ ddl m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0 ddgZ1 G d„ de«      Z2 G d„ de«      Z3 G d„ d«      Z4 G d„ d«      Z5 G d„ d«      Z6 G d„ d«      Z7y)é    )Úannotations)ÚListÚUnion)Údatetime)ÚLiteralé   )Útrace_query_paramsÚtrace_list_runs_params)Úhttpx)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚSequenceNotStrÚomitÚ	not_given)Úpath_templateÚmaybe_transformÚstrip_not_givenÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_raw_response_wrapperÚto_streamed_response_wrapperÚasync_to_raw_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncItemsCursorPostPaginationÚAsyncItemsCursorPostPagination)ÚTrace)ÚAsyncPaginatorÚmake_request_options)ÚRunSelectField)ÚTraceListRunsResponseÚTracesResourceÚAsyncTracesResourcec                  óØ   — e Zd Zedd„«       Zed	d„«       Zeeeeedddedœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
d„Zeeeeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	y)r&   c                ó   — t        | «      S ©z™
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.
        )ÚTracesResourceWithRawResponse©Úselfs    út/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langsmith/_openapi_client/resources/traces.pyÚwith_raw_responsez TracesResource.with_raw_response   s   € ô -¨TÓ2Ð2ó    c                ó   — t        | «      S ©ze
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.
        )Ú#TracesResourceWithStreamingResponser,   s    r.   Úwith_streaming_responsez&TracesResource.with_streaming_response'   s   € ô
 3°4Ó8Ð8r0   N©	ÚfilterÚmax_start_timeÚmin_start_timeÚselectsÚacceptÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc       
        óê   — |st        d|›�«      ‚i t        d|i«      ¥|xs i ¥}| j                  t        d|¬«      t	        ||	|
|t        |||||dœt        j                  «      ¬«      t        ¬«      S )á$  Returns runs for a trace ID within min/max start time.

        Optional `filter`;
        repeatable `selects` to select fields to return.

        Self-hosted deployments require LangSmith `v0.16` or later.

        Args:
          project_id: `project_id` is the UUID of the tracing project that owns the trace.

          filter: `filter` narrows which runs within this trace are returned, using a LangSmith
              filter expression evaluated against each run. For example: `eq(run_type, "llm")`
              for LLM runs only, or `eq(status, "error")` for failed runs. See
              https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
              for syntax.

          max_start_time: `max_start_time` is the optional inclusive upper bound for run `start_time`
              (RFC3339 date-time). Required together with `min_start_time`.

          min_start_time: `min_start_time` is the optional inclusive lower bound for run `start_time`
              (RFC3339 date-time). Required together with `max_start_time`.

          selects: `selects` lists which properties to include on each returned run (repeatable
              query parameter). Accepts any value of the `RunSelectField` enum. If omitted,
              only `id` is returned.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ú7Expected a non-empty value for `trace_id` but received ÚAcceptú/api/v2/traces/{trace_id}/runs©Útrace_id©Ú
project_idr6   r7   r8   r9   ©r;   r<   r=   r>   Úquery©ÚoptionsÚcast_to)	Ú
ValueErrorr   Ú_getr   r#   r   r
   ÚTraceListRunsParamsr%   ©r-   rE   rG   r6   r7   r8   r9   r:   r;   r<   r=   r>   s               r.   Ú	list_runszTracesResource.list_runs.   s�   € ñH ÜÐVÐW_ÐVbÐcÓdÐdØXœ?¨H°fÐ+=Ó>ÐXÀ=ÒCVÐTVÐXˆØ�y‰yÜÐ:ÀXÔNÜ(Ø+Ø'Ø%ØÜ%à&0Ø"(Ø*8Ø*8Ø#*ñô +×>Ñ>ó	ôô  *ð% ó 
ð 	
r0   ©Úcursorr7   r8   Ú	page_sizerG   r9   Útrace_filterÚ	trace_idsÚtree_filterr;   r<   r=   r>   c               ó¬   — | j                  dt        t           t        |||||||||	dœ	t        j
                  «      t        |
|||¬«      t        d¬«      S ©ua  
        Returns a paginated list of traces (root runs) for a single tracing project.
        Each item carries the trace's root run plus optional trace-wide aggregates
        (`total_tokens`, `total_cost`, `first_token_time`) under `trace_aggregates`, so
        clients never have to merge by `trace_id`.

        Traces are scanned within a `start_time` window: `min_start_time` defaults to 24
        hours before the request, `max_start_time` defaults to the request time. Set
        either explicitly to widen or narrow the window.

        Supports filters (`trace_filter`, `tree_filter`), cursor pagination (`cursor`),
        and field projection (`selects`).

        Self-hosted deployments require LangSmith `v0.16` or later.

        Args:
          cursor: `cursor` is the opaque string returned in a previous response's `next_cursor`.

          max_start_time: `max_start_time` is the exclusive upper bound for the root-run start time scan
              (RFC3339). Defaults to the request time when omitted.

          min_start_time: `min_start_time` is the inclusive lower bound for the root-run start time scan
              (RFC3339). Defaults to 24 hours before the request when omitted.

          page_size: `page_size` is the maximum number of traces to return per page. Defaults to 20;
              must be between 1 and 100 when set.

          project_id: `project_id` is the UUID of the tracing project that owns the traces. Required.

          selects: `selects` lists which properties to include on each returned trace. Properties
              listed here are routed to the appropriate sub-object on each item:
              `total_tokens`, `total_cost`, and `first_token_time` appear under
              `trace_aggregates`; everything else appears under `root_run`. If omitted, only
              `id` is returned on `root_run`.

          trace_filter: `trace_filter` narrows results to traces whose root run matches this LangSmith
              filter expression. This filter targets root runs only â€” `is_root = true` is
              implied. See
              https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
              for syntax.

          trace_ids: `trace_ids` is an optional fast-path restriction to a known set of trace UUIDs.
              Equivalent in result to including each UUID in a `trace_filter`, but more
              efficient at scale.

          tree_filter: `tree_filter` narrows results to traces containing at least one run anywhere in
              the run tree (root or descendant) that matches this LangSmith filter expression.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        z/api/v2/traces/query)	rS   r7   r8   rT   rG   r9   rU   rV   rW   )r;   r<   r=   r>   Úpost)ÚpageÚbodyrK   ÚmodelÚmethod)Ú_get_api_listr   r!   r   r	   ÚTraceQueryParamsr#   ©r-   rS   r7   r8   rT   rG   r9   rU   rV   rW   r;   r<   r=   r>   s                 r.   rI   zTracesResource.queryª   sx   € ðV ×!Ñ!Ø"Ü.¬uÑ5Ü à$Ø&4Ø&4Ø!*Ø",Ø&Ø$0Ø!*Ø#.ñ
ô #×3Ñ3óô )Ø+¸ÐQ[Ðelôô Øð+ "ó 
ð 	
r0   )Úreturnr+   )rb   r3   ©rE   ÚstrrG   rd   r6   ú
str | Omitr7   úUnion[str, datetime] | Omitr8   rf   r9   aÙ  List[Literal['ID', 'NAME', 'RUN_TYPE', 'STATUS', 'START_TIME', 'END_TIME', 'LATENCY_SECONDS', 'FIRST_TOKEN_TIME', 'ERROR', 'ERROR_PREVIEW', 'EXTRA', 'METADATA', 'EVENTS', 'INPUTS', 'INPUTS_PREVIEW', 'OUTPUTS', 'OUTPUTS_PREVIEW', 'MANIFEST', 'PARENT_RUN_IDS', 'PROJECT_ID', 'TRACE_ID', 'THREAD_ID', 'DOTTED_ORDER', 'IS_ROOT', 'REFERENCE_EXAMPLE_ID', 'REFERENCE_DATASET_ID', 'TOTAL_TOKENS', 'PROMPT_TOKENS', 'COMPLETION_TOKENS', 'TOTAL_COST', 'PROMPT_COST', 'COMPLETION_COST', 'PROMPT_TOKEN_DETAILS', 'COMPLETION_TOKEN_DETAILS', 'PROMPT_COST_DETAILS', 'COMPLETION_COST_DETAILS', 'PRICE_MODEL_ID', 'TAGS', 'APP_PATH', 'ATTACHMENTS', 'THREAD_EVALUATION_TIME', 'IS_IN_DATASET', 'LAST_QUEUED_AT', 'SHARE_URL', 'FEEDBACK_STATS']] | Omitr:   re   r;   úHeaders | Noner<   úQuery | Noner=   úBody | Noner>   ú'float | httpx.Timeout | None | NotGivenrb   r%   )rS   re   r7   rf   r8   rf   rT   ú
int | OmitrG   re   r9   úList[RunSelectField] | OmitrU   re   rV   úSequenceNotStr[str] | OmitrW   re   r;   rg   r<   rh   r=   ri   r>   rj   rb   z$SyncItemsCursorPostPagination[Trace]©
Ú__name__Ú
__module__Ú__qualname__r   r/   r4   r   r   rQ   rI   © r0   r.   r&   r&      s«  „ Øò3ó ð3ð ò9ó ð9ð "Ø6:Ø6:ðd Ø!ð )-Ø$(Ø"&Ø;DñAz
àðz
ð ð	z
ð
 ðz
ð 4ðz
ð 4ðz
ð1ðz
ðt ðuz
ðz &ð{z
ð| "ð}z
ð~  ðz
ð@ 9ðAz
ðB 
óCz
ð~ "Ø6:Ø6:Ø $Ø!%Ø/3Ø#'Ø04Ø"&ð )-Ø$(Ø"&Ø;Dñ#a
ð ða
ð 4ð	a
ð
 4ða
ð ða
ð ða
ð -ða
ð !ða
ð .ða
ð  ða
ð &ða
ð "ða
ð   ð!a
ð" 9ð#a
ð$ 
.ô%a
r0   c                  óØ   — e Zd Zedd„«       Zed	d„«       Zeeeeedddedœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
d„Zeeeeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	y)r'   c                ó   — t        | «      S r*   )Ú"AsyncTracesResourceWithRawResponser,   s    r.   r/   z%AsyncTracesResource.with_raw_response  s   € ô 2°$Ó7Ð7r0   c                ó   — t        | «      S r2   )Ú(AsyncTracesResourceWithStreamingResponser,   s    r.   r4   z+AsyncTracesResource.with_streaming_response  s   € ô
 8¸Ó=Ð=r0   Nr5   c       
      ƒ  ó  K  — |st        d|›�«      ‚i t        d|i«      ¥|xs i ¥}| j                  t        d|¬«      t	        ||	|
|t        |||||dœt        j                  «      ƒ d{  –—† ¬«      t        ¬«      ƒ d{  –—† S 7 Œ7 Œ­w)	r@   rA   rB   rC   rD   rF   NrH   rJ   )	rM   r   rN   r   r#   r   r
   rO   r%   rP   s               r.   rQ   zAsyncTracesResource.list_runs  s¶   è ø€ ñH ÜÐVÐW_ÐVbÐcÓdÐdØXœ?¨H°fÐ+=Ó>ÐXÀ=ÒCVÐTVÐXˆØ—Y‘YÜÐ:ÀXÔNÜ(Ø+Ø'Ø%ØÜ1à&0Ø"(Ø*8Ø*8Ø#*ñô +×>Ñ>ó	÷ 	ôô  *ð% ó 
÷ 
ð 	
ð	øð
ús$   ‚A)BÁ+BÁ,BÂB	ÂBÂ	BrR   c               ó¬   — | j                  dt        t           t        |||||||||	dœ	t        j
                  «      t        |
|||¬«      t        d¬«      S rY   )r_   r    r!   r   r	   r`   r#   ra   s                 r.   rI   zAsyncTracesResource.queryš  sx   € ðV ×!Ñ!Ø"Ü/´Ñ6Ü à$Ø&4Ø&4Ø!*Ø",Ø&Ø$0Ø!*Ø#.ñ
ô #×3Ñ3óô )Ø+¸ÐQ[Ðelôô Øð+ "ó 
ð 	
r0   )rb   ru   )rb   rw   rc   )rS   re   r7   rf   r8   rf   rT   rk   rG   re   r9   rl   rU   re   rV   rm   rW   re   r;   rg   r<   rh   r=   ri   r>   rj   rb   z<AsyncPaginator[Trace, AsyncItemsCursorPostPagination[Trace]]rn   rr   r0   r.   r'   r'     s¬  „ Øò8ó ð8ð ò>ó ð>ð "Ø6:Ø6:ðd Ø!ð )-Ø$(Ø"&Ø;DñAz
àðz
ð ð	z
ð
 ðz
ð 4ðz
ð 4ðz
ð1ðz
ðt ðuz
ðz &ð{z
ð| "ð}z
ð~  ðz
ð@ 9ðAz
ðB 
óCz
ð~ "Ø6:Ø6:Ø $Ø!%Ø/3Ø#'Ø04Ø"&ð )-Ø$(Ø"&Ø;Dñ#a
ð ða
ð 4ð	a
ð
 4ða
ð ða
ð ða
ð -ða
ð !ða
ð .ða
ð  ða
ð &ða
ð "ða
ð   ð!a
ð" 9ð#a
ð$ 
Fô%a
r0   c                  ó   — e Zd Zdd„Zy)r+   c                óz   — || _         t        |j                  «      | _        t        |j                  «      | _        y ©N)Ú_tracesr   rQ   rI   ©r-   Útracess     r.   Ú__init__z&TracesResourceWithRawResponse.__init__ÿ  s3   € ØˆŒä0Ø×Ñó
ˆŒô -Ø�L‰Ló
ˆ�
r0   N©r   r&   rb   ÚNone©ro   rp   rq   r€   rr   r0   r.   r+   r+   þ  ó   „ ô
r0   r+   c                  ó   — e Zd Zdd„Zy)ru   c                óz   — || _         t        |j                  «      | _        t        |j                  «      | _        y r|   )r}   r   rQ   rI   r~   s     r.   r€   z+AsyncTracesResourceWithRawResponse.__init__  s3   € ØˆŒä6Ø×Ñó
ˆŒô 3Ø�L‰Ló
ˆ�
r0   N©r   r'   rb   r‚   rƒ   rr   r0   r.   ru   ru   
  r„   r0   ru   c                  ó   — e Zd Zdd„Zy)r3   c                óz   — || _         t        |j                  «      | _        t        |j                  «      | _        y r|   )r}   r   rQ   rI   r~   s     r.   r€   z,TracesResourceWithStreamingResponse.__init__  s3   € ØˆŒä5Ø×Ñó
ˆŒô 2Ø�L‰Ló
ˆ�
r0   Nr�   rƒ   rr   r0   r.   r3   r3     r„   r0   r3   c                  ó   — e Zd Zdd„Zy)rw   c                óz   — || _         t        |j                  «      | _        t        |j                  «      | _        y r|   )r}   r   rQ   rI   r~   s     r.   r€   z1AsyncTracesResourceWithStreamingResponse.__init__#  s3   € ØˆŒä;Ø×Ñó
ˆŒô 8Ø�L‰Ló
ˆ�
r0   Nr‡   rƒ   rr   r0   r.   rw   rw   "  r„   r0   rw   N)8Ú
__future__r   Útypingr   r   r   Útyping_extensionsr   Útypesr	   r
   Ú_httpxr   Ú_typesr   r   r   r   r   r   r   r   Ú_utilsr   r   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   r   r   Ú
paginationr   r    Útypes.tracer!   Ú_base_clientr"   r#   Útypes.run_select_fieldr$   Útypes.trace_list_runs_responser%   Ú__all__r&   r'   r+   ru   r3   rw   rr   r0   r.   Ú<module>rœ      sœ   ðõ #ç Ý Ý %ç >Ý ß Z× ZÓ Zß [Ó [Ý %ß 9÷ó ÷ WÝ ß ?Ý 3Ý BàÐ2Ð
3€ôm
�_ô m
ô`m
Ð*ô m
÷`	
ñ 	
÷	
ñ 	
÷	
ñ 	
÷	
ò 	
r0   