o
    i3                     @  sp  d dl mZ d dlmZmZmZ d dlmZmZ d dl	Z	ddl
mZmZ ddlmZmZmZmZmZmZmZ ddl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) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddgZ2G dd deZ3G dd deZ4G dd dZ5G dd dZ6G dd dZ7G dd dZ8dS )    )annotations)ListUnionIterable)LiteraloverloadN   )interaction_get_paramsinteraction_create_params)BodyOmitQueryHeadersNotGivenomit	not_given)required_args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)StreamAsyncStream)make_request_options)	ToolParam)Interaction)
ModelParam)InteractionSSEEvent)GenerationConfigParamInteractionsResourceAsyncInteractionsResourcec                   @    e Zd ZedUddZedVddZedeeeeeeeeeeeddded	dWd,d-Z	edeeeeeeeeeeddded.dXd1d-Z	edeeeeeeeeeeeddded2dYd7d-Z	edeeeeeeeeeeddded8dZd9d-Z	edeeeeeeeeeeddded.d[d<d-Z	e
ddgg d=d3dgg d>deeeeeeeeeeeeeeddded?d\dCd-Z	ddddedDd]dHdIZddddedDd^dJdKZedeeedddedLd_dOdPZedeedddedQd`dRdPZedeedddedQdadSdPZdeeedddedLdbdTdPZdS )cr$   return#InteractionsResourceWithRawResponsec                 C     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/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers
        )r(   self r-   i/home/livre-enfant/venv/lib/python3.10/site-packages/google/genai/_interactions/resources/interactions.pywith_raw_response0      z&InteractionsResource.with_raw_response)InteractionsResourceWithStreamingResponsec                 C  r)   z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response
        )r1   r+   r-   r-   r.   with_streaming_response:      z,InteractionsResource.with_streaming_responseNapi_version
backgroundgeneration_configprevious_interaction_idresponse_formatresponse_mime_typeresponse_modalitiesservice_tierstorestreamsystem_instructiontoolsextra_headersextra_query
extra_bodytimeoutr6   
str | Noneinputinteraction_create_params.Inputmodelr!   r7   bool | Omitr8   GenerationConfigParam | Omitr9   
str | Omitr:   object | Omitr;   r<   .List[Literal['text', 'image', 'audio']] | Omitr=   .Literal['flex', 'standard', 'priority'] | Omitr>   r?   Literal[False] | Omitr@   rA   Iterable[ToolParam] | OmitrB   Headers | NonerC   Query | NonerD   Body | NonerE   'float | httpx.Timeout | None | NotGivenr    c                C     dS a  
        Creates a new interaction.

        Args:
          input: The input for the interaction.

          model: The name of the `Model` used for generating the interaction.

          background: Input only. Whether to run the model interaction in the background.

          generation_config: Input only. Configuration parameters for the model interaction.

          previous_interaction_id: The ID of the previous interaction, if any.

          response_format: Enforces that the generated response is a JSON object that complies with
              the JSON schema specified in this field.

          response_mime_type: The mime type of the response. This is required if response_format is set.

          response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO).

          service_tier: The service tier for the interaction.

          store: Input only. Whether to store the response and request for later retrieval.

          stream: Input only. Whether the interaction will be streamed.

          system_instruction: System instruction for the interaction.

          tools: A list of tool declarations the model may call during interaction.

          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
        Nr-   r,   r6   rG   rI   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   r-   r-   r.   createC      @zInteractionsResource.creater6   r7   r8   r9   r:   r;   r<   r=   r>   r@   rA   rB   rC   rD   rE   Literal[True]Stream[InteractionSSEEvent]c                C  rV   a  
        Creates a new interaction.

        Args:
          input: The input for the interaction.

          model: The name of the `Model` used for generating the interaction.

          stream: Input only. Whether the interaction will be streamed.

          background: Input only. Whether to run the model interaction in the background.

          generation_config: Input only. Configuration parameters for the model interaction.

          previous_interaction_id: The ID of the previous interaction, if any.

          response_format: Enforces that the generated response is a JSON object that complies with
              the JSON schema specified in this field.

          response_mime_type: The mime type of the response. This is required if response_format is set.

          response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO).

          service_tier: The service tier for the interaction.

          store: Input only. Whether to store the response and request for later retrieval.

          system_instruction: System instruction for the interaction.

          tools: A list of tool declarations the model may call during interaction.

          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
        Nr-   r,   r6   rG   rI   r?   r7   r8   r9   r:   r;   r<   r=   r>   r@   rA   rB   rC   rD   rE   r-   r-   r.   rY      rZ   r6   agent_configr7   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   agent8Union[str, Literal['deep-research-pro-preview-12-2025']]ra   ,interaction_create_params.AgentConfig | Omitc                C  rV   a  
        Creates a new interaction.

        Args:
          agent: The name of the `Agent` used for generating the interaction.

          input: The input for the interaction.

          agent_config: Configuration parameters for the agent interaction.

          background: Input only. Whether to run the model interaction in the background.

          previous_interaction_id: The ID of the previous interaction, if any.

          response_format: Enforces that the generated response is a JSON object that complies with
              the JSON schema specified in this field.

          response_mime_type: The mime type of the response. This is required if response_format is set.

          response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO).

          service_tier: The service tier for the interaction.

          store: Input only. Whether to store the response and request for later retrieval.

          stream: Input only. Whether the interaction will be streamed.

          system_instruction: System instruction for the interaction.

          tools: A list of tool declarations the model may call during interaction.

          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
        Nr-   r,   r6   rb   rG   ra   r7   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   r-   r-   r.   rY      rZ   r6   ra   r7   r9   r:   r;   r<   r=   r>   r@   rA   rB   rC   rD   rE   c                C  rV   a  
        Creates a new interaction.

        Args:
          agent: The name of the `Agent` used for generating the interaction.

          input: The input for the interaction.

          stream: Input only. Whether the interaction will be streamed.

          agent_config: Configuration parameters for the agent interaction.

          background: Input only. Whether to run the model interaction in the background.

          previous_interaction_id: The ID of the previous interaction, if any.

          response_format: Enforces that the generated response is a JSON object that complies with
              the JSON schema specified in this field.

          response_mime_type: The mime type of the response. This is required if response_format is set.

          response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO).

          service_tier: The service tier for the interaction.

          store: Input only. Whether to store the response and request for later retrieval.

          system_instruction: System instruction for the interaction.

          tools: A list of tool declarations the model may call during interaction.

          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
        Nr-   r,   r6   rb   rG   r?   ra   r7   r9   r:   r;   r<   r=   r>   r@   rA   rB   rC   rD   rE   r-   r-   r.   rY   	  rZ   bool)Interaction | Stream[InteractionSSEEvent]c                C  rV   r^   r-   r_   r-   r-   r.   rY   K  rZ   rG   rI   r?   rb   rG   r?   r6   rI   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rb   ra   rB   rC   rD   rE   ModelParam | Omit%Literal[False] | Literal[True] | Omit?Union[str, Literal['deep-research-pro-preview-12-2025']] | Omitc                C  s   |d u r	| j  }|std||tur|turtd|tur*|tur*td| j| j j|ddt||||||||	|
||||||d|rJtjntj	t
||||dt|pXdtt d	S 
N:Expected a non-empty value for `api_version` but received zfInvalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.zfInvalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.interactionsr6   path)rG   rI   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rb   ra   rB   rC   rD   rE   F)bodyoptionscast_tor?   
stream_cls)_client_get_api_version_path_param
ValueErrorr   _post_build_maybe_vertex_pathr   r
   %CreateModelInteractionParamsStreaming(CreateModelInteractionParamsNonStreamingr   r    r   r"   r,   r6   rG   rI   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rb   ra   rB   rC   rD   rE   r-   r-   r.   rY     sL   
r6   rB   rC   rD   rE   idstrobjectc                C  sd   |du r	| j  }|std||std|| j| j j|d| dt||||dtdS aR  
        Deletes the interaction by id.

        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
        Nrs   1Expected a non-empty value for `id` but received interactions/ru   rw   ry   rz   r|   r}   r~   _deleter   r   r   r,   r   r6   rB   rC   rD   rE   r-   r-   r.   delete  s   
zInteractionsResource.deletec                C  sf   |du r	| j  }|std||std|| j| j j|d| ddt||||dtdS 	a  Cancels an interaction by id.

        This only applies to background interactions that are still running.

        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
        Nrs   r   r   z/cancelru   rw   r   r|   r}   r~   r   r   r   r    r   r-   r-   r.   cancel  s   
zInteractionsResource.cancelr6   include_inputlast_event_idr?   rB   rC   rD   rE   r   r   c          
      C  rV   a  
        Retrieves the full details of a single interaction based on its `Interaction.id`.

        Args:
          include_input: If set to true, includes the input in the response.

          last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.

          stream: If set to true, the generated content will be streamed incrementally.

          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
        Nr-   
r,   r   r6   r   r   r?   rB   rC   rD   rE   r-   r-   r.   get     "zInteractionsResource.getr6   r   r   rB   rC   rD   rE   c          
      C  rV   a  
        Retrieves the full details of a single interaction based on its `Interaction.id`.

        Args:
          stream: If set to true, the generated content will be streamed incrementally.

          include_input: If set to true, includes the input in the response.

          last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.

          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
        Nr-   
r,   r   r6   r?   r   r   rB   rC   rD   rE   r-   r-   r.   r   A  r   c          
      C  rV   r   r-   r   r-   r-   r.   r   e  r   c          
      C  s   |d u r	| j  }|std||std|| j| j j|d| dt||||	t|||dtjdt	|p;dt
t dS 	Nrs   r   r   ru   )r   r   r?   )rB   rC   rD   rE   queryF)ry   rz   r?   r{   )r|   r}   r~   _getr   r   r   r	   InteractionGetParamsr    r   r"   r   r-   r-   r.   r     s2   
)r'   r(   )r'   r1   &r6   rF   rG   rH   rI   r!   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r?   rP   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r    )&r6   rF   rG   rH   rI   r!   r?   r\   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r]   &r6   rF   rb   rc   rG   rH   ra   rd   r7   rJ   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r?   rP   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r    )&r6   rF   rb   rc   rG   rH   r?   r\   ra   rd   r7   rJ   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r]   )&r6   rF   rG   rH   rI   r!   r?   rj   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   rk   )*r6   rF   rG   rH   rI   ro   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r?   rp   r@   rL   rA   rQ   rb   rq   ra   rd   rB   rR   rC   rS   rD   rT   rE   rU   r'   rk   r   r   r6   rF   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   r   r   r6   rF   rB   rR   rC   rS   rD   rT   rE   rU   r'   r    r   r   r6   rF   r   rJ   r   rL   r?   rP   rB   rR   rC   rS   rD   rT   rE   rU   r'   r    )r   r   r6   rF   r?   r\   r   rJ   r   rL   rB   rR   rC   rS   rD   rT   rE   rU   r'   r]   )r   r   r6   rF   r?   rj   r   rJ   r   rL   rB   rR   rC   rS   rD   rT   rE   rU   r'   rk   )r   r   r6   rF   r   rJ   r   rL   r?   rp   rB   rR   rC   rS   rD   rT   rE   rU   r'   rk   __name__
__module____qualname__r   r/   r3   r   r   r   rY   r   r   r   r   r-   r-   r-   r.   r$   /   D   	AAAAAF*'##'c                   @  r&   )cr%   r'   (AsyncInteractionsResourceWithRawResponsec                 C  r)   r*   )r   r+   r-   r-   r.   r/     r0   z+AsyncInteractionsResource.with_raw_response.AsyncInteractionsResourceWithStreamingResponsec                 C  r)   r2   )r   r+   r-   r-   r.   r3     r4   z1AsyncInteractionsResource.with_streaming_responseNr5   r6   rF   rG   rH   rI   r!   r7   rJ   r8   rK   r9   rL   r:   rM   r;   r<   rN   r=   rO   r>   r?   rP   r@   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r    c                     dS rW   r-   rX   r-   r-   r.   rY        @z AsyncInteractionsResource.creater[   r\    AsyncStream[InteractionSSEEvent]c                  r   r^   r-   r_   r-   r-   r.   rY   
  r   r`   rb   rc   ra   rd   c                  r   re   r-   rf   r-   r-   r.   rY   L  r   rg   c                  r   rh   r-   ri   r-   r-   r.   rY     r   rj   .Interaction | AsyncStream[InteractionSSEEvent]c                  r   r^   r-   r_   r-   r-   r.   rY     r   rl   rm   rn   ro   rp   rq   c                  s   |d u r
| j  }|std||tur|turtd|tur+|tur+td| j| j j|ddt||||||||	|
||||||d|rKtjntj	I d H t
||||dt|p\dtt d	I d H S rr   )r|   r}   r~   r   r   r   r   r
   r   r   r   r    r   r"   r   r-   r-   r.   rY     sN   
r   r   r   r   c                  sl   |du r
| j  }|std||std|| j| j j|d| dt||||dtdI dH S r   r   r   r-   r-   r.   r   U  s   
z AsyncInteractionsResource.deletec                  sn   |du r
| j  }|std||std|| j| j j|d| ddt||||dtdI dH S r   r   r   r-   r-   r.   r   {  s   
z AsyncInteractionsResource.cancelr   r   r   c          
        r   r   r-   r   r-   r-   r.   r        "zAsyncInteractionsResource.getr   c          
        r   r   r-   r   r-   r-   r.   r     r   c          
        r   r   r-   r   r-   r-   r.   r     r   c          
        s   |d u r
| j  }|std||std|| j| j j|d| dt||||	t|||dtjI d H dt	|p?dt
t dI d H S r   )r|   r}   r~   r   r   r   r   r	   r   r    r   r"   r   r-   r-   r.   r     s4   
)r'   r   )r'   r   r   )&r6   rF   rG   rH   rI   r!   r?   r\   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   r   )&r6   rF   rb   rc   rG   rH   r?   r\   ra   rd   r7   rJ   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   )&r6   rF   rG   rH   rI   r!   r?   rj   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r@   rL   rA   rQ   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   )*r6   rF   rG   rH   rI   ro   r7   rJ   r8   rK   r9   rL   r:   rM   r;   rL   r<   rN   r=   rO   r>   rJ   r?   rp   r@   rL   rA   rQ   rb   rq   ra   rd   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   r   r   r   )r   r   r6   rF   r?   r\   r   rJ   r   rL   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   )r   r   r6   rF   r?   rj   r   rJ   r   rL   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   )r   r   r6   rF   r   rJ   r   rL   r?   rp   rB   rR   rC   rS   rD   rT   rE   rU   r'   r   r   r-   r-   r-   r.   r%     r   c                   @     e Zd ZdddZdS )	r(   rt   r$   r'   Nonec                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S N)_interactionsr   rY   r   r   r   r,   rt   r-   r-   r.   __init__:     
z,InteractionsResourceWithRawResponse.__init__Nrt   r$   r'   r   r   r   r   r   r-   r-   r-   r.   r(   9      r(   c                   @  r   )	r   rt   r%   r'   r   c                 C  r   r   )r   r   rY   r   r   r   r   r-   r-   r.   r   L  r   z1AsyncInteractionsResourceWithRawResponse.__init__Nrt   r%   r'   r   r   r-   r-   r-   r.   r   K  r   r   c                   @  r   )	r1   rt   r$   r'   r   c                 C  r   r   )r   r   rY   r   r   r   r   r-   r-   r.   r   ^  r   z2InteractionsResourceWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r1   ]  r   r1   c                   @  r   )	r   rt   r%   r'   r   c                 C  r   r   )r   r   rY   r   r   r   r   r-   r-   r.   r   p  r   z7AsyncInteractionsResourceWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r   o  r   r   )9
__future__r   typingr   r   r   typing_extensionsr   r   httpxtypesr	   r
   _typesr   r   r   r   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   r   r   
_streamingr   r   _base_clientr   types.tool_paramr   types.interactionr    types.model_paramr!   types.interaction_sse_eventr"   types.generation_config_paramr#   __all__r$   r%   r(   r   r1   r   r-   r-   r-   r.   <module>   sD   $     
     
