o
    Yi                     @  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dSddZedTddZedeeeeeeeeeeddded	dUd*d+Z	edeeeeeeeeeddded,dVd/d+Z	edeeeeeeeeeeddded0dWd5d+Z	edeeeeeeeeeddded6dXd7d+Z	edeeeeeeeeeddded,dYd:d+Z	e
ddgg d;d1dgg d<deeeeeeeeeeeeeddded=dZdAd+Z	ddddedBd[dFdGZddddedBd\dHdIZedeeedddedJd]dMdNZedeedddedOd^dPdNZedeedddedOd_dQdNZdeeedddedJd`dRdNZdS )ar$   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-   k/home/kim/smarthome/.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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=   r>   Literal[False] | Omitr?   r@   Iterable[ToolParam] | OmitrA   Headers | NonerB   Query | NonerC   Body | NonerD   '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).

          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   rF   rH   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   r-   r-   r.   createC      =zInteractionsResource.creater6   r7   r8   r9   r:   r;   r<   r=   r?   r@   rA   rB   rC   rD   Literal[True]Stream[InteractionSSEEvent]c                C  rT   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).

          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   rF   rH   r>   r7   r8   r9   r:   r;   r<   r=   r?   r@   rA   rB   rC   rD   r-   r-   r.   rW      rX   r6   agent_configr7   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   agent8Union[str, Literal['deep-research-pro-preview-12-2025']]r_   ,interaction_create_params.AgentConfig | Omitc                C  rT   am  
        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).

          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   r`   rF   r_   r7   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   r-   r-   r.   rW      rX   r6   r_   r7   r9   r:   r;   r<   r=   r?   r@   rA   rB   rC   rD   c                C  rT   am  
        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).

          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   r`   rF   r>   r_   r7   r9   r:   r;   r<   r=   r?   r@   rA   rB   rC   rD   r-   r-   r.   rW      rX   bool)Interaction | Stream[InteractionSSEEvent]c                C  rT   r\   r-   r]   r-   r-   r.   rW   ?  rX   rF   rH   r>   r`   rF   r>   r6   rH   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   r`   r_   rA   rB   rC   rD   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|rItjntj	t
||||dt|pWd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)rF   rH   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   r`   r_   rA   rB   rC   rD   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   rF   rH   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   r`   r_   rA   rB   rC   rD   r-   r-   r.   rW   ~  sJ   
r6   rA   rB   rC   rD   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
        Nrq   1Expected a non-empty value for `id` but received interactions/rs   ru   rw   rx   rz   r{   r|   _deleter~   r   r   r,   r   r6   rA   rB   rC   rD   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
        Nrq   r   r   z/cancelrs   ru   r   rz   r{   r|   r}   r~   r   r    r   r-   r-   r.   cancel  s   
zInteractionsResource.cancelr6   include_inputlast_event_idr>   rA   rB   rC   rD   r   r   c          
      C  rT   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>   rA   rB   rC   rD   r-   r-   r.   get     "zInteractionsResource.getr6   r   r   rA   rB   rC   rD   c          
      C  rT   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   rA   rB   rC   rD   r-   r-   r.   r   0  r   c          
      C  rT   r   r-   r   r-   r-   r.   r   T  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 	Nrq   r   r   rs   )r   r   r>   )rA   rB   rC   rD   queryF)rw   rx   r>   ry   )rz   r{   r|   _getr~   r   r   r	   InteractionGetParamsr    r   r"   r   r-   r-   r.   r   x  s2   
)r'   r(   )r'   r1   $r6   rE   rF   rG   rH   r!   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r>   rN   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r    )$r6   rE   rF   rG   rH   r!   r>   rZ   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r[   $r6   rE   r`   ra   rF   rG   r_   rb   r7   rI   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r>   rN   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r    )$r6   rE   r`   ra   rF   rG   r>   rZ   r_   rb   r7   rI   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r[   )$r6   rE   rF   rG   rH   r!   r>   rh   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   ri   )(r6   rE   rF   rG   rH   rm   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r>   rn   r?   rK   r@   rO   r`   ro   r_   rb   rA   rP   rB   rQ   rC   rR   rD   rS   r'   ri   r   r   r6   rE   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   r   r   r6   rE   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r    r   r   r6   rE   r   rI   r   rK   r>   rN   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r    )r   r   r6   rE   r>   rZ   r   rI   r   rK   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r[   )r   r   r6   rE   r>   rh   r   rI   r   rK   rA   rP   rB   rQ   rC   rR   rD   rS   r'   ri   )r   r   r6   rE   r   rI   r   rK   r>   rn   rA   rP   rB   rQ   rC   rR   rD   rS   r'   ri   __name__
__module____qualname__r   r/   r3   r   r   r   rW   r   r   r   r   r-   r-   r-   r.   r$   /   8   	>>>>>D*'##'c                   @  r&   )ar%   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   rE   rF   rG   rH   r!   r7   rI   r8   rJ   r9   rK   r:   rL   r;   r<   rM   r=   r>   rN   r?   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r    c                     dS rU   r-   rV   r-   r-   r.   rW        =z AsyncInteractionsResource.createrY   rZ    AsyncStream[InteractionSSEEvent]c                  r   r\   r-   r]   r-   r-   r.   rW     r   r^   r`   ra   r_   rb   c                  r   rc   r-   rd   r-   r-   r.   rW   5  r   re   c                  r   rf   r-   rg   r-   r-   r.   rW   t  r   rh   .Interaction | AsyncStream[InteractionSSEEvent]c                  r   r\   r-   r]   r-   r-   r.   rW     r   rj   rk   rl   rm   rn   ro   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	I d H t
||||dt|p[dtt d	I d H S rp   )rz   r{   r|   r   r}   r~   r   r
   r   r   r   r    r   r"   r   r-   r-   r.   rW     sL   
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   3  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   Y  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   )rz   r{   r|   r   r~   r   r   r	   r   r    r   r"   r   r-   r-   r.   r     s4   
)r'   r   )r'   r   r   )$r6   rE   rF   rG   rH   r!   r>   rZ   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   r   )$r6   rE   r`   ra   rF   rG   r>   rZ   r_   rb   r7   rI   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   )$r6   rE   rF   rG   rH   r!   r>   rh   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r?   rK   r@   rO   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   )(r6   rE   rF   rG   rH   rm   r7   rI   r8   rJ   r9   rK   r:   rL   r;   rK   r<   rM   r=   rI   r>   rn   r?   rK   r@   rO   r`   ro   r_   rb   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   r   r   r   )r   r   r6   rE   r>   rZ   r   rI   r   rK   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   )r   r   r6   rE   r>   rh   r   rI   r   rK   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   )r   r   r6   rE   r   rI   r   rK   r>   rn   rA   rP   rB   rQ   rC   rR   rD   rS   r'   r   r   r-   r-   r-   r.   r%     r   c                   @     e Zd ZdddZdS )	r(   rr   r$   r'   Nonec                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S N)_interactionsr   rW   r   r   r   r,   rr   r-   r-   r.   __init__     
z,InteractionsResourceWithRawResponse.__init__Nrr   r$   r'   r   r   r   r   r   r-   r-   r-   r.   r(         r(   c                   @  r   )	r   rr   r%   r'   r   c                 C  r   r   )r   r   rW   r   r   r   r   r-   r-   r.   r   *  r   z1AsyncInteractionsResourceWithRawResponse.__init__Nrr   r%   r'   r   r   r-   r-   r-   r.   r   )  r   r   c                   @  r   )	r1   rr   r$   r'   r   c                 C  r   r   )r   r   rW   r   r   r   r   r-   r-   r.   r   <  r   z2InteractionsResourceWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r1   ;  r   r1   c                   @  r   )	r   rr   r%   r'   r   c                 C  r   r   )r   r   rW   r   r   r   r   r-   r-   r.   r   N  r   z7AsyncInteractionsResourceWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r   M  r   r   )9
__future__r   typingr   r   r   Ztyping_extensionsr   r   Zhttpxtypesr	   r
   _typesr   r   r   r   r   r   r   Z_utilsr   r   r   _compatr   Z	_resourcer   r   	_responser   r   r   r   Z
_streamingr   r   Z_base_clientr   Ztypes.tool_paramr   Ztypes.interactionr    Ztypes.model_paramr!   Ztypes.interaction_sse_eventr"   Ztypes.generation_config_paramr#   __all__r$   r%   r(   r   r1   r   r-   r-   r-   r.   <module>   s@   $    x    x