
    0j	}                    "   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	Z	ddl
mZmZmZmZmZ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 m!Z!m"Z"m#Z#m$Z$m%Z% ddl&m'Z' ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z. ddl/m0Z0m1Z1 ddl2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8m9Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZC ddlDmEZE ddlFmGZG ddgZH G d de0          ZI G d de1          ZJ G d d          ZK G d d          ZL G d  d!          ZM G d" d#          ZNdS )$    )annotations)ListOptional)chain)LiteralN   )FindAllResourceAsyncFindAllResourceFindAllResourceWithRawResponse#AsyncFindAllResourceWithRawResponse$FindAllResourceWithStreamingResponse)AsyncFindAllResourceWithStreamingResponse   )BodyOmitQueryHeadersNotGivenSequenceNotStromit	not_given)is_givenmaybe_transformstrip_not_givenasync_maybe_transform)TaskRunResourceAsyncTaskRunResourceTaskRunResourceWithRawResponse#AsyncTaskRunResourceWithRawResponse$TaskRunResourceWithStreamingResponse)AsyncTaskRunResourceWithStreamingResponse)cached_property)TaskGroupResourceAsyncTaskGroupResource TaskGroupResourceWithRawResponse%AsyncTaskGroupResourceWithRawResponse&TaskGroupResourceWithStreamingResponse+AsyncTaskGroupResourceWithStreamingResponse)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapper"async_to_streamed_response_wrapper)beta_search_paramsbeta_extract_params)make_request_options)SearchResult)ExtractResponse)FetchPolicyParam)ParallelBetaParam)ExcerptSettingsParam)SourcePolicyBetaResourceAsyncBetaResourcec                      e Zd Zed3d            Zed4d            Zed5d            Zed6d	            Zed7d            Ze	e	e	e	e	e	ddde
d
d8d%Ze	e	e	e	e	e	e	e	e	e	ddde
d&d9d2ZdS ):r8   returnr   c                *    t          | j                  S a   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
        )r   _clientselfs    d/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/parallel/resources/beta/beta.pytask_runzBetaResource.task_run:   s     t|,,,    r#   c                *    t          | j                  S a  
        The Task Group API is currently in beta and enables batch execution of many independent Task runs with group-level monitoring and failure handling.
         - Submit hundreds or thousands of Tasks as a single group
        - Observe group progress and receive results as they complete
        - Real-time updates via Server-Sent Events (SSE)
        - Add tasks to an existing group while it is running
        - Group-level retry and error aggregation
        Status: beta and subject to change.
        )r#   r>   r?   s    rA   
task_groupzBetaResource.task_groupC   s     !...rC   r	   c                *    t          | j                  S a  
        The FindAll API discovers and evaluates entities that match complex criteria from natural language objectives. Submit a high-level goal and the service automatically generates structured match conditions, discovers relevant candidates, and evaluates each against the criteria. Returns comprehensive results with detailed reasoning, citations, and confidence scores for each match decision. Streaming events and webhooks are supported.
        )r	   r>   r?   s    rA   findallzBetaResource.findallP   s    
 t|,,,rC   BetaResourceWithRawResponsec                     t          |           S a  
        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
        )rJ   r?   s    rA   with_raw_responsezBetaResource.with_raw_responseW   s     +4000rC   !BetaResourceWithStreamingResponsec                     t          |           S 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
        )rN   r?   s    rA   with_streaming_responsez$BetaResource.with_streaming_responsea   s     1666rC   N
excerptsfetch_policyfull_content	objectivesearch_queriesbetasextra_headersextra_query
extra_bodytimeouturlsSequenceNotStr[str]rS   #beta_extract_params.Excerpts | OmitrT   !Optional[FetchPolicyParam] | OmitrU   &beta_extract_params.FullContent | OmitrV   Optional[str] | OmitrW   $Optional[SequenceNotStr[str]] | OmitrX   List[ParallelBetaParam] | OmitrY   Headers | NonerZ   Query | Noner[   Body | Noner\   'float | httpx.Timeout | None | NotGivenr3   c               `   i t          dt          |          r.d                    t          d |D             dg                    nt          i          |pi }ddi|pi }|                     dt          ||||||dt          j                  t          ||	|
|          t                    S )	  
        Extracts relevant content from specific web URLs.

        To access this endpoint, pass the `parallel-beta` header with the value
        `search-extract-2025-10-10`.

        Args:
          excerpts: Include excerpts from each URL relevant to the search objective and queries.
              Note that if neither objective nor search_queries is provided, excerpts are
              redundant with full content.

          fetch_policy: Policy for live fetching web results.

          full_content: Include full content from each URL. Note that if neither objective nor
              search_queries is provided, excerpts are redundant with full content.

          objective: If provided, focuses extracted content on the specified search objective.

          search_queries: If provided, focuses extracted content on the specified keyword search queries.

          betas: Optional header to specify the beta version(s) to enable.

          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
        parallel-beta,c              3  4   K   | ]}t          |          V  d S Nstr.0es     rA   	<genexpr>z'BetaResource.extract.<locals>.<genexpr>   (      4K4KSVV4K4K4K4K4K4KrC   search-extract-2025-10-10/v1beta/extractr]   rS   rT   rU   rV   rW   rY   rZ   r[   r\   bodyoptionscast_to)r   r   joinr   r   _postr   r0   BetaExtractParamsr1   r3   r@   r]   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   s               rA   extractzBetaResource.extractj   s    ^	
#&#SXXe4K4KU4K4K4KNiMj.k.k%l%l%l" 	
 "	
 )*E_-J][]_zz   ($0$0!*&4  $5
 
 )+Q[el   $!  
 
 	
rC   rS   rT   max_chars_per_resultmax_resultsmoderV   	processorrW   source_policyrX   rY   rZ   r[   r\   ExcerptSettingsParam | Omitr   Optional[int] | Omitr   r   7Optional[Literal['one-shot', 'agentic', 'fast']] | Omitr   'Optional[Literal['base', 'pro']] | Omitr   Optional[SourcePolicy] | Omitr2   c               f   i t          dt          |
          r.d                    t          d |
D             dg                    nt          i          |pi }ddi|pi }|                     dt          |||||||||	d	t          j                  t          ||||          t                    S )	i  
        Searches the web.

        Args:
          excerpts: Optional settings to configure excerpt generation.

          fetch_policy: Policy for live fetching web results.

          max_chars_per_result: DEPRECATED: Use `excerpts.max_chars_per_result` instead.

          max_results: Upper bound on the number of results to return. Defaults to 10 if not provided.

          mode: Presets default values for parameters for different use cases.

              - `one-shot` returns more comprehensive results and longer excerpts to answer
                questions from a single response
              - `agentic` returns more concise, token-efficient results for use in an agentic
                loop
              - `fast` trades some quality for lower latency, with best results when used with
                concise and high-quality objective and keyword queries

          objective: Natural-language description of what the web search is trying to find. May
              include guidance about preferred sources or freshness. At least one of objective
              or search_queries must be provided.

          processor: DEPRECATED: use `mode` instead.

          search_queries: Optional list of traditional keyword search queries to guide the search. May
              contain search operators. At least one of objective or search_queries must be
              provided.

          source_policy: Source policy for web search results.

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

          betas: Optional header to specify the beta version(s) to enable.

          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
        rk   rl   c              3  4   K   | ]}t          |          V  d S rn   ro   rq   s     rA   rt   z&BetaResource.search.<locals>.<genexpr>   ru   rC   rv   /v1beta/search	rS   rT   r   r   r   rV   r   rW   r   ry   rz   )r   r   r~   r   r   r   r   r/   BetaSearchParamsr1   r2   r@   rS   rT   r   r   r   rV   r   rW   r   rX   rY   rZ   r[   r\   s                  rA   searchzBetaResource.search   s   B	
#&#SXXe4K4KU4K4K4KNiMj.k.k%l%l%l" 	
 "	
 )*E_-J][]_zz  ($0,@#. !*!*&4%2
 
 #3  )+Q[el   !'  
 
 	
rC   )r;   r   )r;   r#   )r;   r	   )r;   rJ   )r;   rN   r]   r^   rS   r_   rT   r`   rU   ra   rV   rb   rW   rc   rX   rd   rY   re   rZ   rf   r[   rg   r\   rh   r;   r3   rS   r   rT   r`   r   r   r   r   r   r   rV   rb   r   r   rW   rc   r   r   rX   rd   rY   re   rZ   rf   r[   rg   r\   rh   r;   r2   __name__
__module____qualname__r"   rB   rF   rI   rM   rQ   r   r   r   r    rC   rA   r8   r8   9   sM       - - - _- 
/ 
/ 
/ _
/ - - - _- 1 1 1 _1 7 7 7 _7 9=:>?C*.?C04 )-$("&;DK
 K
 K
 K
 K
 K
` 15:>59,0HL*.=A?C7;04 )-$("&;D%`
 `
 `
 `
 `
 `
 `
 `
rC   c                      e Zd Zed3d            Zed4d            Zed5d            Zed6d	            Zed7d            Ze	e	e	e	e	e	ddde
d
d8d%Ze	e	e	e	e	e	e	e	e	e	ddde
d&d9d2ZdS ):r9   r;   r   c                *    t          | j                  S r=   )r   r>   r?   s    rA   rB   zAsyncBetaResource.task_run  s     $DL111rC   r$   c                *    t          | j                  S rE   )r$   r>   r?   s    rA   rF   zAsyncBetaResource.task_group$  s     &dl333rC   r
   c                *    t          | j                  S rH   )r
   r>   r?   s    rA   rI   zAsyncBetaResource.findall1  s    
 $DL111rC    AsyncBetaResourceWithRawResponsec                     t          |           S rL   )r   r?   s    rA   rM   z#AsyncBetaResource.with_raw_response8  s     0555rC   &AsyncBetaResourceWithStreamingResponsec                     t          |           S rP   )r   r?   s    rA   rQ   z)AsyncBetaResource.with_streaming_responseB  s     6d;;;rC   NrR   r]   r^   rS   r_   rT   r`   rU   ra   rV   rb   rW   rc   rX   rd   rY   re   rZ   rf   r[   rg   r\   rh   r3   c               |  K   i t          dt          |          r.d                    t          d |D             dg                    nt          i          |pi }ddi|pi }|                     dt          ||||||dt          j                   d{V t          ||	|
|          t          	           d{V S )
rj   rk   rl   c              3  4   K   | ]}t          |          V  d S rn   ro   rq   s     rA   rt   z,AsyncBetaResource.extract.<locals>.<genexpr>}  ru   rC   rv   rw   rx   Nry   rz   )r   r   r~   r   r   r   r   r0   r   r1   r3   r   s               rA   r   zAsyncBetaResource.extractK  s=     ^	
#&#SXXe4K4KU4K4K4KNiMj.k.k%l%l%l" 	
 "	
 )*E_-J][]_ZZ,  ($0$0!*&4  $5
 
 
 
 
 
 
 
 )+Q[el   $!   
 
 
 
 
 
 
 
 	
rC   r   r   r   r   r   r   r   r   r   r   r   r2   c                 K   i t          dt          |
          r.d                    t          d |
D             dg                    nt          i          |pi }ddi|pi }|                     dt          |||||||||	d	t          j                   d{V t          ||||          t          	           d{V S )
r   rk   rl   c              3  4   K   | ]}t          |          V  d S rn   ro   rq   s     rA   rt   z+AsyncBetaResource.search.<locals>.<genexpr>  ru   rC   rv   r   r   Nry   rz   )r   r   r~   r   r   r   r   r/   r   r1   r2   r   s                  rA   r   zAsyncBetaResource.search  sF     B	
#&#SXXe4K4KU4K4K4KNiMj.k.k%l%l%l" 	
 "	
 )*E_-J][]_ZZ, ($0,@#. !*!*&4%2
 
 #3        )+Q[el   !'   
 
 
 
 
 
 
 
 	
rC   )r;   r   )r;   r$   )r;   r
   )r;   r   )r;   r   r   r   r   r   rC   rA   r9   r9     sM       2 2 2 _2 
4 
4 
4 _
4 2 2 2 _2 6 6 6 _6 < < < _< 9=:>?C*.?C04 )-$("&;DK
 K
 K
 K
 K
 K
` 15:>59,0HL*.=A?C7;04 )-$("&;D%`
 `
 `
 `
 `
 `
 `
 `
rC   c                  ^    e Zd ZddZedd            Zedd	            Zedd            ZdS )rJ   betar8   r;   Nonec                x    || _         t          |j                  | _        t          |j                  | _        d S rn   )_betar+   r   r   r@   r   s     rA   __init__z$BetaResourceWithRawResponse.__init__  s;    
.L
 
 .K
 
rC   r   c                4    t          | j        j                  S r=   )r   r   rB   r?   s    rA   rB   z$BetaResourceWithRawResponse.task_run  s     .dj.ABBBrC   r%   c                4    t          | j        j                  S rE   )r%   r   rF   r?   s    rA   rF   z&BetaResourceWithRawResponse.task_group  s     0
0EFFFrC   r   c                4    t          | j        j                  S rH   )r   r   rI   r?   s    rA   rI   z#BetaResourceWithRawResponse.findall  s    
 .dj.@AAArC   Nr   r8   r;   r   )r;   r   )r;   r%   )r;   r   r   r   r   r   r"   rB   rF   rI   r   rC   rA   rJ   rJ     s        
 
 
 
 C C C _C 
G 
G 
G _
G B B B _B B BrC   rJ   c                  ^    e Zd ZddZedd            Zedd	            Zedd            ZdS )r   r   r9   r;   r   c                x    || _         t          |j                  | _        t          |j                  | _        d S rn   )r   r-   r   r   r   s     rA   r   z)AsyncBetaResourceWithRawResponse.__init__%  s;    
4L
 
 4K
 
rC   r   c                4    t          | j        j                  S r=   )r   r   rB   r?   s    rA   rB   z)AsyncBetaResourceWithRawResponse.task_run/  s     34:3FGGGrC   r&   c                4    t          | j        j                  S rE   )r&   r   rF   r?   s    rA   rF   z+AsyncBetaResourceWithRawResponse.task_group8  s     5TZ5JKKKrC   r   c                4    t          | j        j                  S rH   )r   r   rI   r?   s    rA   rI   z(AsyncBetaResourceWithRawResponse.findallE  s    
 34:3EFFFrC   Nr   r9   r;   r   )r;   r   )r;   r&   )r;   r   r   r   rC   rA   r   r   $  s        
 
 
 
 H H H _H 
L 
L 
L _
L G G G _G G GrC   r   c                  ^    e Zd ZddZedd            Zedd	            Zedd            ZdS )rN   r   r8   r;   r   c                x    || _         t          |j                  | _        t          |j                  | _        d S rn   )r   r,   r   r   r   s     rA   r   z*BetaResourceWithStreamingResponse.__init__N  s;    
3L
 
 3K
 
rC   r    c                4    t          | j        j                  S r=   )r    r   rB   r?   s    rA   rB   z*BetaResourceWithStreamingResponse.task_runX  s     4DJ4GHHHrC   r'   c                4    t          | j        j                  S rE   )r'   r   rF   r?   s    rA   rF   z,BetaResourceWithStreamingResponse.task_groupa  s     6dj6KLLLrC   r   c                4    t          | j        j                  S rH   )r   r   rI   r?   s    rA   rI   z)BetaResourceWithStreamingResponse.findalln  s    
 4DJ4FGGGrC   Nr   )r;   r    )r;   r'   )r;   r   r   r   rC   rA   rN   rN   M  s        
 
 
 
 I I I _I 
M 
M 
M _
M H H H _H H HrC   rN   c                  ^    e Zd ZddZedd            Zedd	            Zedd            ZdS )r   r   r9   r;   r   c                x    || _         t          |j                  | _        t          |j                  | _        d S rn   )r   r.   r   r   r   s     rA   r   z/AsyncBetaResourceWithStreamingResponse.__init__w  s;    
9L
 
 9K
 
rC   r!   c                4    t          | j        j                  S r=   )r!   r   rB   r?   s    rA   rB   z/AsyncBetaResourceWithStreamingResponse.task_run  s     99LMMMrC   r(   c                4    t          | j        j                  S rE   )r(   r   rF   r?   s    rA   rF   z1AsyncBetaResourceWithStreamingResponse.task_group  s     ;4:;PQQQrC   r   c                4    t          | j        j                  S rH   )r   r   rI   r?   s    rA   rI   z.AsyncBetaResourceWithStreamingResponse.findall  s    
 99KLLLrC   Nr   )r;   r!   )r;   r(   )r;   r   r   r   rC   rA   r   r   v  s        
 
 
 
 N N N _N 
R 
R 
R _
R M M M _M M MrC   r   )O
__future__r   typingr   r   	itertoolsr   typing_extensionsr   httpxrI   r	   r
   r   r   r   r   _typesr   r   r   r   r   r   r   r   _utilsr   r   r   r   rB   r   r   r   r   r    r!   _compatr"   rF   r#   r$   r%   r&   r'   r(   	_resourcer)   r*   	_responser+   r,   r-   r.   
types.betar/   r0   _base_clientr1   types.beta.search_resultr2   types.beta.extract_responser3   types.beta.fetch_policy_paramr4   types.beta.parallel_beta_paramr5   !types.beta.excerpt_settings_paramr6   !types.shared_params.source_policyr7   __all__r8   r9   rJ   r   rN   r   r   rC   rA   <module>r      s   # " " " " " ! ! ! ! ! ! ! !       % % % % % %                 \ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ W W W W W W W W W W W W                ' & & & & &                ; : : : : : : :            B A A A A A A A 0 0 0 0 0 0 4 4 4 4 4 4 : : : : : : = = = = = = ? ? ? ? ? ? E E E E E E = = = = = =.
/^
 ^
 ^
 ^
 ^
? ^
 ^
 ^
B^
 ^
 ^
 ^
 ^
( ^
 ^
 ^
B&B &B &B &B &B &B &B &BR&G &G &G &G &G &G &G &GR&H &H &H &H &H &H &H &HR&M &M &M &M &M &M &M &M &M &MrC   