+
    Uim                       ^ RI Ht ^ RIt^ RIHtHtHtHtHt ^ RI	t	^ RI
Ht ^RIHtHt ^RIHtHtHtHtHtHtHt ^RIHtHt ^RIHt ^R	IHtHt ^R
IH t H!t!H"t"H#t# ^RI$H%t% ^RI&H't' ^RI(H)t) ^RI*H+t+H,t,H-t- ^RI.H/t/ ^RI0H1t1 ^RI2H3t4H5t6H7t7 ^RI8H9t9 RR.t: ! R R]4      t; ! R R]4      t< ! R R4      t= ! R R4      t> ! R R4      t? ! R R4      t@R# )    )annotationsN)DictTypeUnionOptionaloverload)prepare_timeout_float)task_run_create_paramstask_run_result_params)BodyOmitQueryHeadersNotGivenomit	not_given)maybe_transform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)make_request_options)TaskRun)TaskRunResult)OutputTOutputSchemaTaskSpecParam)build_task_spec_param)ParsedTaskRunResult)wait_for_resultwait_for_result_asynctask_run_result_parser)SourcePolicyTaskRunResourceAsyncTaskRunResourcec                  b   ] tR t^'tRt]R R l4       t]R R l4       tR]R]R]R	]R
RRRRRR]	/R R llt
R
RRRRRR]	/R R lltR]R
RRRRRR]	/R R lltR]R
RRRRR/R R llt]R]R]R
RRRRRR]	/R R ll4       t]R]R
RRRRRR]	/R R ll4       tR]R]R
RRRRRR]	/R R lltRtR# ) r(     The Task API executes web research and extraction tasks.

Clients submit a natural-language objective with an optional input schema; the service plans retrieval, fetches relevant URLs, and returns outputs that conform to a provided or inferred JSON schema. Supports deep research style queries and can return rich structured JSON outputs. Processors trade-off between cost, latency, and quality. Each processor supports calibrated confidences.
- Output metadata: citations, excerpts, reasoning, and confidence per field
c                   V ^8  d   QhRR/# )   returnTaskRunResourceWithRawResponse )formats   "Z/home/ubuntu/hermes-agent/venv/lib/python3.14/site-packages/parallel/resources/task_run.py__annotate__TaskRunResource.__annotate__/   s     4 4#A 4    c                    \        V 4      # 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.

For more information, see https://www.github.com/parallel-web/parallel-sdk-python#accessing-raw-response-data-eg-headers
)r/   selfs   &r2   with_raw_response!TaskRunResource.with_raw_response.   s     .d33r5   c                   V ^8  d   QhRR/# )r-   r.   $TaskRunResourceWithStreamingResponser0   )r1   s   "r2   r3   r4   9   s     : :)M :r5   c                    \        V 4      # z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/parallel-web/parallel-sdk-python#with_streaming_response
)r=   r8   s   &r2   with_streaming_response'TaskRunResource.with_streaming_response8   s     4D99r5   metadataprevious_interaction_idsource_policy	task_specextra_headersNextra_query
extra_bodytimeoutc               D    V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRR/# r-   inputUnion[str, Dict[str, object]]	processorstrrB   3Optional[Dict[str, Union[str, float, bool]]] | OmitrC   zOptional[str] | OmitrD   zOptional[SourcePolicy] | OmitrE   zOptional[TaskSpecParam] | OmitrF   Headers | NonerG   Query | NonerH   Body | NonerI   'float | httpx.Timeout | None | NotGivenr.   r   r0   )r1   s   "r2   r3   r4   A        E
 E
 -E
 	E

 FE
 "6E
 5E
 2E
 &E
 "E
  E
 9E
 
E
r5   c       
            V P                  R\        RVRVRVRVRVRV/\        P                  4      \	        WxWR7      \
        R	7      # )
  
Initiates a task run.

Returns immediately with a run object in status 'queued'.

Beta features can be enabled by setting the 'parallel-beta' header.

Args:
  input: Input to the task, either text or a JSON object.

  processor: Processor to use for the task.

  metadata: User-provided metadata stored with the run. Keys and values must be strings with
      a maximum length of 16 and 512 characters respectively.

  previous_interaction_id: Interaction ID to use as context for this request.

  source_policy: Source policy for web search results.

      This policy governs which sources are allowed/disallowed in results.

  task_spec: Specification for a task.

      Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
      Not specifying a TaskSpec is the same as setting an auto output schema.

      For convenience bare strings are also accepted as input or output schemas.

  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
/v1/tasks/runsrL   rN   rB   rC   rD   rE   rF   rG   rH   rI   bodyoptionscast_to)_postr   r
   TaskRunCreateParamsr   r   r9   rL   rN   rB   rC   rD   rE   rF   rG   rH   rI   s   &$$$$$$$$$$r2   createTaskRunResource.createA   sj    h zz U-/F#] '::
 )+Q[ !  
 	
r5   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# r-   run_idrO   rF   rQ   rG   rR   rH   rS   rI   rT   r.   r   r0   )r1   s   "r2   r3   r4      F     !
 !
!
 &!
 "!
  !
 9!
 
!
r5   c          
     |    V'       g   \        RV: 24      hV P                  RV 2\        W#WER7      \        R7      # )U  
Retrieves run status by run_id.

The run result is available from the `/result` endpoint.

Args:
  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
5Expected a non-empty value for `run_id` but received /v1/tasks/runs/rY   r\   r]   
ValueError_getr   r   r9   re   rF   rG   rH   rI   s   &&$$$$r2   retrieveTaskRunResource.retrieve   sO    2 TU[T^_``yyfX&(+Q[   
 	
r5   api_timeoutc               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# r-   re   rO   rr   z
int | OmitrF   rQ   rG   rR   rH   rS   rI   rT   r.   r   r0   )r1   s   "r2   r3   r4      sP     $
 $
$
  	$
 &$
 "$
  $
 9$
 
$
r5   c                   V'       g   \        RV: 24      hV P                  RV R2\        VVVV\        RV/\        P
                  4      R7      \        R7      # )B  
Retrieves a run result by run_id, blocking until the run is completed.

Args:
  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
ri   rj   /resultrr   rF   rG   rH   rI   queryrk   )rm   rn   r   r   r   TaskRunResultParamsr   r9   re   rr   rF   rG   rH   rI   s   &&$$$$$r2   resultTaskRunResource.result   sm    0 TU[T^_``yyfXW-(+'%%}k&BDZDnDno "  

 
	
r5   outputc               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# r-   re   rO   deadlinefloatr~   -Optional[OutputSchema] | Type[OutputT] | OmitrF   rQ   rG   rR   rH   rS   r.   ,TaskRunResult | ParsedTaskRunResult[OutputT]r0   )r1   s   "r2   r3   r4      s[     U U U 	U
 >U &U "U  U 
6Ur5   c               @   a aaaa R VVVVV 3R llp\        WVR7      # )9Wait for a task run to complete within the given timeout.c               $    V ^8  d   QhRRRRRR/# r-   re   rO   r   r   r.   r   r0   )r1   s   "r2   r3   6TaskRunResource._wait_for_result.<locals>.__annotate__   s'     		C 		CS 		CE 		C6b 		Cr5   c                   < V\         P                  ! 4       ,
          pSP                  V SSSVR 7      p\        VS4      # )rY   time	monotonicr|   r&   	re   r   rI   task_run_resultrH   rF   rG   r~   r9   s	   &&  r2   _fetcher2TaskRunResource._wait_for_result.<locals>._fetcher   sE    !11G"kk+'% * O */6BBr5   re   r   callable)_wait_for_resultr9   re   r   r~   rF   rG   rH   r   s   f$$dddd r2   r    TaskRunResource._wait_for_result   s    		C 		C  v8TTr5   c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# r-   rL   rM   rN   rO   rB   rP   r~   zOptional[OutputSchema] | OmitrF   rQ   rG   rR   rH   rS   rI   rT   r.   r   r0   )r1   s   "r2   r3   r4      sg       - 	
 F . & "   9 
r5   c               	    R # Nr0   	r9   rL   rN   rB   r~   rF   rG   rH   rI   s	   &$$$$$$$$r2   executeTaskRunResource.execute   s     r5   c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# r-   rL   rM   rN   rO   rB   rP   r~   zType[OutputT]rF   rQ   rG   rR   rH   rS   rI   rT   r.   zParsedTaskRunResult[OutputT]r0   )r1   s   "r2   r3   r4      sg     + + -+ 	+
 F+ + &+ "+  + 9+ 
&+r5   c               	    R # r   r0   r   s	   &$$$$$$$$r2   r   r      s     (+r5   c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# r-   rL   rM   rN   rO   rB   rP   r~   r   rF   rQ   rG   rR   rH   rS   rI   rT   r.   r   r0   )r1   s   "r2   r3   r4   
  r     E
 E
 -E
 	E

 FE
 >E
 &E
 "E
  E
 9E
 
6E
r5   c                   RR/T;'       g    / Cp\        V4      p\        P                  ! 4       V,           p	V P                  VVV\	        WA4      VVVVR7      p
V P                  V
P                  V	VVVVR7      # )  
Convenience method to create and execute a task run in a single call.

Awaits run completion. If the run is successful, a `ParsedTaskRunResult`
is returned when a pydantic was specified in `output`. Otherwise, a
`TaskRunResult` is returned.

Possible errors:
- `TimeoutError`: If the run does not finish within the specified timeout.
- `APIStatusError`: If the API returns a non-200-range status code.
- `APIConnectionError`: If the connection to the API fails.

Args:
  input: Input to the task, either text or a JSON object.

  processor: Processor to use for the task.

  metadata: User-provided metadata stored with the run. Keys and values must be strings with
    a maximum length of 16 and 512 characters respectively.

  output: Optional output schema or pydantic type. If pydantic is provided,
    the response will have a parsed field.

  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.
    If the result is not available within the timeout, a `TimeoutError` is raised.
X-Stainless-Poll-HelpertruerL   rN   rB   rE   rF   rG   rH   rI   re   r   r~   rF   rG   rH   r	   r   r   ra   r"   r   re   r9   rL   rN   rB   r~   rF   rG   rH   rI   r   task_runs   &$$$$$$$$  r2   r   r   
  s    \ 3FT}?R?RPRT'0>>#g-;;+F:'#!  	
 $$??'#! % 
 	
r5   r0   __name__
__module____qualname____firstlineno____doc__r   r:   r@   r   r   ra   rp   r|   r   r   r   __static_attributes__r0   r5   r2   r(   r(   '   s    4 4 : :E

 IME
 9=E
 8<E
 59E
 )-E
 %)E
 #'E
 <EE
N!
 )-!
 %)!
 #'!
 <E!
F$
 #'	$
 )-$
 %)$
 #'$
 <E$
LU
 AEU )-U %)U #'U6 
 IM 15 )- %) #' <E  +
 IM+ )-+ %)+ #'+ <E+ +E

 IME
 AEE
 )-E
 %)E
 #'E
 <EE
 E
r5   c                  b   ] tR tRtRt]R R l4       t]R R l4       tR]R]R	]R
]RRRRRRR]	/R R llt
RRRRRRR]	/R R lltR]RRRRRRR]	/R R lltR]RRRRRR/R R llt]R]R]RRRRRRR]	/R R ll4       t]R]RRRRRRR]	/R R ll4       tR]R]RRRRRRR]	/R R lltR tR# )!r)   iR  r+   c                   V ^8  d   QhRR/# )r-   r.   #AsyncTaskRunResourceWithRawResponser0   )r1   s   "r2   r3   !AsyncTaskRunResource.__annotate__Z  s     9 9#F 9r5   c                    \        V 4      # r7   )r   r8   s   &r2   r:   &AsyncTaskRunResource.with_raw_responseY  s     3488r5   c                   V ^8  d   QhRR/# )r-   r.   )AsyncTaskRunResourceWithStreamingResponser0   )r1   s   "r2   r3   r   d  s     ? ?)R ?r5   c                    \        V 4      # r?   )r   r8   s   &r2   r@   ,AsyncTaskRunResource.with_streaming_responsec  s     9>>r5   rB   rC   rD   rE   rF   NrG   rH   rI   c               D    V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRR/# rK   r0   )r1   s   "r2   r3   r   l  rU   r5   c       
           "   T P                  R\        RVRVRVRVRVRV/\        P                  4      G Rj  xL
 \	        WxWR	7      \
        R
7      G Rj  xL
 #  L" L5i)rW   rX   rL   rN   rB   rC   rD   rE   NrY   rZ   )r^   r   r
   r_   r   r   r`   s   &$$$$$$$$$$r2   ra   AsyncTaskRunResource.createl  s     h ZZ,U-/F#] '::
 
 )+Q[ !   
 
 	


s!   6AA
AAAAc               0    V ^8  d   QhRRRRRRRRR	R
RR/# rd   r0   )r1   s   "r2   r3   r     rf   r5   c          
        "   V'       g   \        RV: 24      hV P                  RV 2\        W#WER7      \        R7      G Rj  xL
 #  L5i)rh   ri   rj   rY   rk   Nrl   ro   s   &&$$$$r2   rp   AsyncTaskRunResource.retrieve  s\     2 TU[T^_``YYfX&(+Q[   
 
 	
 
s   AA
AA
rr   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# rt   r0   )r1   s   "r2   r3   r     sP     &
 &
&
  	&
 &&
 "&
  &
 9&
 
&
r5   c                  "   V'       g   \        RV: 24      hT P                  RV R2\        TTTT\        RV/\        P
                  4      G Rj  xL
 R7      \        R7      G Rj  xL
 #  L L5i)rv   ri   rj   rw   rr   Nrx   rk   )rm   rn   r   r   r   rz   r   r{   s   &&$$$$$r2   r|   AsyncTaskRunResource.result  s     0 TU[T^_``YYfXW-(+'%1"K02H2\2\  "  
 
 	

s$   AA2A.A2)A0*A20A2r~   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# r   r0   )r1   s   "r2   r3   r     s[     a a a 	a
 >a &a "a  a 
6ar5   c               \   a aaaa"   R VVVVV 3R llp\        WVR7      G Rj  xL
 #  L5i)r   c               $    V ^8  d   QhRRRRRR/# r   r0   )r1   s   "r2   r3   ;AsyncTaskRunResource._wait_for_result.<locals>.__annotate__  s'     		C 		C3 		C% 		C<h 		Cr5   c                   <"   V\         P                  ! 4       ,
          pSP                  V SSSVR 7      G Rj  xL
 p\        VS4      #  L5i)rY   Nr   r   s	   &&  r2   r   7AsyncTaskRunResource._wait_for_result.<locals>._fetcher  sR     !11G$(KK+'% %0 % O */6BBs   6AA
Ar   N)_wait_for_result_asyncr   s   f$$dddd r2   r   %AsyncTaskRunResource._wait_for_result  s(     		C 		C ,6W_````s   ,*,c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# r   r0   )r1   s   "r2   r3   r     sg       - 	
 F . & "   9 
r5   c               	   "   R # 5ir   r0   r   s	   &$$$$$$$$r2   r   AsyncTaskRunResource.execute  s
         c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# r   r0   )r1   s   "r2   r3   r   '  sg     + + -+ 	+
 F+ + &+ "+  + 9+ 
&+r5   c               	   "   R # 5ir   r0   r   s	   &$$$$$$$$r2   r   r   &  s
      (+r   c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# r   r0   )r1   s   "r2   r3   r   3  r   r5   c               &  "   RR/T;'       g    / Cp\        V4      p\        P                  ! 4       V,           p	V P                  VVV\	        WA4      VVVVR7      G Rj  xL
 p
V P                  V
P                  V	VVVVR7      G Rj  xL
 #  L- L5i)r   r   r   r   Nr   r   r   s   &$$$$$$$$  r2   r   r   3  s     \ 3FT}?R?RPRT'0>>#g-+F:'#! % 	
 	
 **??'#! + 
 
 	
	

s$   ABB (BB	BBr0   r   r0   r5   r2   r)   r)   R  s    9 9 ? ?E

 IME
 9=E
 8<E
 59E
 )-E
 %)E
 #'E
 <EE
N!
 )-!
 %)!
 #'!
 <E!
F&
 #'	&
 )-&
 %)&
 #'&
 <E&
Pa
 AEa )-a %)a #'a6 
 IM 15 )- %) #' <E  +
 IM+ )-+ %)+ #'+ <E+ +E

 IME
 AEE
 )-E
 %)E
 #'E
 <EE
 E
r5   c                  "    ] tR tRtR R ltRtR# )r/   i{  c                    V ^8  d   QhRRRR/# r-   r   r(   r.   Noner0   )r1   s   "r2   r3   +TaskRunResourceWithRawResponse.__annotate__|       
 
 
T 
r5   c                	    Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        R # r   )	_task_runr   ra   rp   r|   r9   r   s   &&r2   __init__'TaskRunResourceWithRawResponse.__init__|  sF    !-OO
 0
 .OO
r5   r   ra   r|   rp   Nr   r   r   r   r   r   r0   r5   r2   r/   r/   {      
 
r5   r/   c                  "    ] tR tRtR R ltRtR# )r   i  c                    V ^8  d   QhRRRR/# r-   r   r)   r.   r   r0   )r1   s   "r2   r3   0AsyncTaskRunResourceWithRawResponse.__annotate__       
 
!5 
$ 
r5   c                	    Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        R # r   )r   r   ra   rp   r|   r   s   &&r2   r   ,AsyncTaskRunResourceWithRawResponse.__init__  sF    !3OO
 6
 4OO
r5   r   Nr   r0   r5   r2   r   r     r   r5   r   c                  "    ] tR tRtR R ltRtR# )r=   i  c                    V ^8  d   QhRRRR/# r   r0   )r1   s   "r2   r3   1TaskRunResourceWithStreamingResponse.__annotate__  r   r5   c                	    Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        R # r   )r   r   ra   rp   r|   r   s   &&r2   r   -TaskRunResourceWithStreamingResponse.__init__  sF    !2OO
 5
 3OO
r5   r   Nr   r0   r5   r2   r=   r=     r   r5   r=   c                  "    ] tR tRtR R ltRtR# )r   i  c                    V ^8  d   QhRRRR/# r   r0   )r1   s   "r2   r3   6AsyncTaskRunResourceWithStreamingResponse.__annotate__  r   r5   c                	    Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        R # r   )r   r   ra   rp   r|   r   s   &&r2   r   2AsyncTaskRunResourceWithStreamingResponse.__init__  sF    !8OO
 ;
 9OO
r5   r   Nr   r0   r5   r2   r   r     r   r5   r   )A
__future__r   r   typingr   r   r   r   r   httpxparallel.lib._timer	   typesr
   r   _typesr   r   r   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   _base_clientr   types.task_runr   types.task_run_resultr   types.task_spec_paramr   r    r!   lib._parsing._task_specr"   types.parsed_task_run_resultr#   lib._parsing._task_run_resultr$   r   r%   r   r&   !types.shared_params.source_policyr'   __all__r(   r)   r/   r   r=   r   r0   r5   r2   <module>r	     s    #  8 8  4 B J J J ; % 9  0 $ 1 H H ; > 
 =4
5h
o h
V	f
+ f
R	
 

 

 

 
r5   