§
    $Âi0¦  ã                   ó  — U d Z ddlZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZ ddlZddlZddlZddl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
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l"m#Z# ddl$m%Z% ej&        Z&	 ddl'm(Z( ddl'm)Z* n# e+$ r ddl,m(Z( ddl,m)Z* Y nw xY w	 ddl-m.Z. n# e/$ r dZ.Y nw xY wej0        rddl1m2Z3 ddl4m5Z6 ddl7m8Z8 ddlm9Z9 nQeZ3ej:        e;d<   eZ6ej:        e;d<   eZ8ej:        e;d<   	 ddl1m2Z3 ddl4m5Z6 ddl7m8Z8 ddlm9Z9 n# e/$ r dZ3dZ6dZ8dZ9Y nw xY w ej<        d¦  «        Z=dZ> G d„ d¦  «        Z? G d„ d ej@        ¦  «        ZAd!ed"e	ejB                 d#ejC        fd$„ZDdS )%z[Preview] Live API client.é    N)ÚAnyÚAsyncIteratorÚOptionalÚSequenceÚUnionÚget_argsé   )Ú_api_module)Ú_common)Ú_live_converters)Ú
_mcp_utils)Ú_transformers)Úerrors)Útypes)ÚBaseApiClient)Úget_value_by_path)Úset_value_by_path)ÚAsyncLiveMusic©Ú_Content_to_mldev)ÚClientConnection)Úconnect)Úrequests)ÚClientSession)ÚTool)ÚMcpToGenAiToolAdapter)Úmcp_to_gemini_toolÚMcpClientSessionÚMcpToolr   zgoogle_genai.liveznFunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.c                   ó   — e Zd ZdZ	 d'dededee         fd„Zdddœd	ee	e
j        e
j        e
j        e
j        e
j        e
j        ee
j                 f                  d
ee         ddfd„Zdddœdee	e
j        e
j        ee	e
j        e
j        f                  f                  deddfd„Zddddddddœdee
j                 dee
j                 dee         dee
j                 dee         dee
j                 dee
j                 ddfd„Zde	e
j        ee
j                 f         ddfd„Zdee
j                 fd„Z dee!         dedee
j                 fd „Z"de
j        fd!„Z#d"ee!         ded#e$j%        ddfd$„Z&	 	 d(d	ee	e
j        e
j        e
j        e
j        e
j        e
j        ee
j                 f                  d
ee         de
j'        fd%„Z(d)d&„Z)dS )*ÚAsyncSessionz[Preview] AsyncSession.NÚ
api_clientÚ	websocketÚ
session_idc                 ó0   — || _         || _        || _        d S ©N)Ú_api_clientÚ_wsr$   )Úselfr"   r#   r$   s       ú[/var/www/html/jarvis.com/web/backend/venv/lib/python3.11/site-packages/google/genai/live.pyÚ__init__zAsyncSession.__init__Z   s   € ð "€DÔØ€D„HØ €D„O€O€Oó    F)ÚinputÚend_of_turnr-   r.   Úreturnc             ƒ   óÒ   K  — t          j        dt          d¬¦  «         |                      ||¦  «        }| j                             t          j        |¦  «        ¦  «        ƒ d{V —† dS )a  [Deprecated] Send input to the model.

    > **Warning**: This method is deprecated and will be removed in a future
    version (not before Q3 2025). Please use one of the more specific methods:
    `send_client_content`, `send_realtime_input`, or `send_tool_response`
    instead.

    The method will send the input request to the server.

    Args:
      input: The input request to the model.
      end_of_turn: Whether the input is the last message in a turn.

    Example usage:

    .. code-block:: python

      client = genai.Client(api_key=API_KEY)

      async with client.aio.live.connect(model='...') as session:
        await session.send(input='Hello world!', end_of_turn=True)
        async for message in session.receive():
          print(message)
    záThe `session.send` method is deprecated and will be removed in a future version (not before Q3 2025).
Please use one of the more specific methods: `send_client_content`, `send_realtime_input`, or `send_tool_response` instead.é   ©Ú
stacklevelN)ÚwarningsÚwarnÚDeprecationWarningÚ_parse_client_messager(   ÚsendÚjsonÚdumps)r)   r-   r.   Úclient_messages       r*   r8   zAsyncSession.sendd   s}   è è € õP „Mð	Bõ 	Øðñ ô ð ð ×/Ò/°°{ÑCÔC€NØ
Œ(�-Š-�œ
 >Ñ2Ô2Ñ
3Ô
3Ð3Ð3Ð3Ð3Ð3Ð3Ð3Ð3Ð3r,   T©ÚturnsÚturn_completer=   r>   c             ƒ   ó6  K  — t          j        ||¦  «                             dd¬¦  «        }| j        j        rt          j        |d¬¦  «        }nt          j        |¬¦  «        }| j	         
                    t          j        d|i¦  «        ¦  «        ƒ d{V —† dS )a¶	  Send non-realtime, turn based content to the model.

    There are two ways to send messages to the live API:
    `send_client_content` and `send_realtime_input`.

    `send_client_content` messages are added to the model context **in order**.
    Having a conversation using `send_client_content` messages is roughly
    equivalent to using the `Chat.send_message_stream` method, except that the
    state of the `chat` history is stored on the API server.

    Because of `send_client_content`'s order guarantee, the model cannot
    respond as quickly to `send_client_content` messages as to
    `send_realtime_input` messages. This makes the biggest difference when
    sending objects that have significant preprocessing time (typically images).

    The `send_client_content` message sends a list of `Content` objects,
    which has more options than the `media:Blob` sent by `send_realtime_input`.

    The main use-cases for `send_client_content` over `send_realtime_input` are:

    - Prefilling a conversation context (including sending anything that can't
      be represented as a realtime message), before starting a realtime
      conversation.
    - Conducting a non-realtime conversation, similar to `client.chat`, using
      the live api.

    Caution: Interleaving `send_client_content` and `send_realtime_input`
      in the same conversation is not recommended and can lead to unexpected
      results.

    Args:
      turns: A `Content` object or list of `Content` objects (or equivalent
        dicts).
      turn_complete: if true (the default) the model will reply immediately. If
        false, the model will wait for you to send additional client_content,
        and will not return until you send `turn_complete=True`.

    Example:

    .. code-block:: python

      import google.genai
      from google.genai import types
      import os

      if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
        MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
      else:
        MODEL_NAME = 'gemini-live-2.5-flash-preview';

      client = genai.Client()
      async with client.aio.live.connect(
          model=MODEL_NAME,
          config={"response_modalities": ["TEXT"]}
      ) as session:
        await session.send_client_content(
            turns=types.Content(
                role='user',
                parts=[types.Part(text="Hello world!")]))
        async for msg in session.receive():
          if msg.text:
            print(msg.text)
    r9   T©ÚmodeÚexclude_none©Úconvert_keys©Úfrom_objectÚclient_contentN)ÚtÚt_client_contentÚ
model_dumpr'   Úvertexair   Úconvert_to_dictÚlive_convertersÚ_LiveClientContent_to_mldevr(   r8   r9   r:   )r)   r=   r>   rG   Úclient_content_dicts        r*   Úsend_client_contentz AsyncSession.send_client_content—   sÂ   è è € õV Ô'¨¨}Ñ=Ô=×HÒHØ $ð Iñ ô €Nð ÔÔ ð Ý#Ô3Ø
 tðñ ô ÐÐõ ,ÔGØ$ðñ ô Ðð Œ(�-Š-�œ
Ð$4Ð6IÐ#JÑKÔKÑ
LÔ
LÐLÐLÐLÐLÐLÐLÐLÐLÐLr,   )ÚmediaÚaudioÚaudio_stream_endÚvideoÚtextÚactivity_startÚactivity_endrQ   rR   rS   rT   rU   rV   rW   c          	   ƒ   ó|  K  — i }|�||d<   |�||d<   |�||d<   |�||d<   |�||d<   |�||d<   |�||d<   t          |¦  «        d	k    rAt          d
t          |¦  «        › dt          |                     ¦   «         ¦  «        › �¦  «        ‚t          j                             |¦  «        }	| j        j        rt          j
        |	¬¦  «        }
nt          j        |	¬¦  «        }
t          j        |
¦  «        }
t          j        |
¦  «        }
| j                             t#          j        d|
i¦  «        ¦  «        ƒ d{V —† dS )a²  Send realtime input to the model, only send one argument per call.

    Use `send_realtime_input` for realtime audio chunks and video
    frames(images).

    With `send_realtime_input` the api will respond to audio automatically
    based on voice activity detection (VAD).

    `send_realtime_input` is optimized for responsivness at the expense of
    deterministic ordering. Audio and video tokens are added to the
    context when they become available.

    Args:
      media: A `Blob`-like object, the realtime media to send.

    Example:

    .. code-block:: python

      from pathlib import Path

      from google import genai
      from google.genai import types

      import PIL.Image

      import os

      if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
        MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
      else:
        MODEL_NAME = 'gemini-live-2.5-flash-preview';


      client = genai.Client()

      async with client.aio.live.connect(
          model=MODEL_NAME,
          config={"response_modalities": ["TEXT"]},
      ) as session:
        await session.send_realtime_input(
            media=PIL.Image.open('image.jpg'))

        audio_bytes = Path('audio.pcm').read_bytes()
        await session.send_realtime_input(
            media=types.Blob(data=audio_bytes, mime_type='audio/pcm;rate=16000'))

        async for msg in session.receive():
          if msg.text is not None:
            print(f'{msg.text}')
    NrQ   rR   rS   rT   rU   rV   rW   r	   z"Only one argument can be set, got z: rE   Úrealtime_input)ÚlenÚ
ValueErrorÚlistÚkeysr   ÚLiveSendRealtimeInputParametersÚmodel_validater'   rK   rM   Ú*_LiveSendRealtimeInputParameters_to_vertexÚ)_LiveSendRealtimeInputParameters_to_mldevr   rL   Úencode_unserializable_typesr(   r8   r9   r:   )r)   rQ   rR   rS   rT   rU   rV   rW   ÚkwargsrY   Úrealtime_input_dicts              r*   Úsend_realtime_inputz AsyncSession.send_realtime_inputñ   s¨  è è € ð| "$€FØÐØ€fˆW�oØÐØ€fˆW�oØÐ#Ø#3€fÐÑ ØÐØ€fˆW�oØÐØ€fˆV�nØÐ!Ø!/€fÐÑØÐØ+€fˆ^Ñå
ˆ6�{„{�aÒÐÝð$­s°6©{¬{ð $ð $Ý�6—;’;‘=”=Ñ!Ô!ð$ð $ñô ð õ Ô:×IÒIØñô €Nð ÔÔ ð å
Ô
DØ(ðñ ô ð Ðõ Ô
CØ(ðñ ô ð õ
 "Ô1Ð2EÑFÔFÐÝ!Ô=Øñô Ðð Œ(�-Š-�œ
Ð$4Ð6IÐ#JÑKÔKÑ
LÔ
LÐLÐLÐLÐLÐLÐLÐLÐLÐLr,   Úfunction_responsesc             ƒ   ó�  K  — t          j        |¦  «        }| j        j        rt	          j        |d¬¦  «        }nXt	          j        |d¬¦  «        }|                     dg ¦  «        D ]+}|                     d¦  «        €t          t          ¦  «        ‚Œ,| j	         
                    t          j        d|i¦  «        ¦  «        ƒ d{V —† dS )aF  Send a tool response to the session.

    Use `send_tool_response` to reply to `LiveServerToolCall` messages
    from the server.

    To set the available tools, use the `config.tools` argument
    when you connect to the session (`client.live.connect`).

    Args:
      function_responses: A `FunctionResponse`-like object or list of
        `FunctionResponse`-like objects.

    Example:

    .. code-block:: python

      from google import genai
      from google.genai import types

      import os

      if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
        MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
      else:
        MODEL_NAME = 'gemini-live-2.5-flash-preview';

      client = genai.Client()

      tools = [{'function_declarations': [{'name': 'turn_on_the_lights'}]}]
      config = {
          "tools": tools,
          "response_modalities": ['TEXT']
      }

      async with client.aio.live.connect(
          model='models/gemini-live-2.5-flash-preview',
          config=config
      ) as session:
        prompt = "Turn on the lights please"
        await session.send_client_content(
            turns={"parts": [{'text': prompt}]}
        )

        async for chunk in session.receive():
            if chunk.server_content:
              if chunk.text is not None:
                print(chunk.text)
            elif chunk.tool_call:
              print(chunk.tool_call)
              print('_'*80)
              function_response=types.FunctionResponse(
                      name='turn_on_the_lights',
                      response={'result': 'ok'},
                      id=chunk.tool_call.function_calls[0].id,
                  )
              print(function_response)
              await session.send_tool_response(
                  function_responses=function_response
              )

              print('_'*80)
    TrC   ÚfunctionResponsesÚidNÚtool_response)rH   Út_tool_responser'   rK   r   rL   Úgetr[   Ú_FUNCTION_RESPONSE_REQUIRES_IDr(   r8   r9   r:   )r)   rf   rj   Útool_response_dictÚresponses        r*   Úsend_tool_responsezAsyncSession.send_tool_responseZ  sí   è è € õL Ô%Ð&8Ñ9Ô9€MØÔÔ ð 
;Ý"Ô2Ø
 dðñ ô ÐÐõ #Ô2Ø
 dðñ ô Ðð )×,Ò,Ð-@À"ÑEÔEð ;ð ;ˆ(Ø�<Š<˜ÑÔÐ%ÝÕ9Ñ:Ô:Ð
:ð &ð Œ(�-Š-�œ
 OÐ5GÐ#HÑIÔIÑ
JÔ
JÐJÐJÐJÐJÐJÐJÐJÐJÐJr,   c                ó¼   K  — |                       ¦   «         ƒ d{V —†x}r=|j        r|j        j        r|W V — dS |W V — |                       ¦   «         ƒ d{V —†x}°;dS dS )aŽ  Receive model responses from the server.

    The method will yield the model responses from the server. The returned
    responses will represent a complete model turn. When the returned message
    is function call, user must call `send` with the function response to
    continue the turn.

    Yields:
      The model responses from the server.

    Example usage:

    .. code-block:: python

      client = genai.Client(api_key=API_KEY)

      async with client.aio.live.connect(model='...') as session:
        await session.send(input='Hello world!', end_of_turn=True)
        async for message in session.receive():
          print(message)
    N)Ú_receiveÚserver_contentr>   )r)   Úresults     r*   ÚreceivezAsyncSession.receive¯  sŸ   è è € ð. Ÿ-š-™/œ/Ð)Ð)Ð)Ð)Ð)Ð)Ð
)ˆ&ð Ø	Ô	ð  6Ô#8Ô#Fð ØˆˆˆˆØˆØ€l€l€l€lð	 Ÿ-š-™/œ/Ð)Ð)Ð)Ð)Ð)Ð)Ð
)ˆ&ð ð ð ð ð r,   ÚstreamÚ	mime_typec               ó:  K  — t          j        dt          d¬¦  «         t          j        ¦   «         }t          j        |                      |||¦  «        ¦  «         d}|                     ¦   «         sÝ	 t          j        |                      ¦   «         ¦  «        }t          j	        |t          j        | 	                    ¦   «         ¦  «        gt          j
        ¬¦  «        ƒ d{V —† |                     ¦   «         r1|                     ¦   «         W V — t          j        d¦  «        ƒ d{V —† n# t          $ r Y nw xY w|                     ¦   «         ¯Ý|�I|                     ¦   «         s7|                     ¦   «          	 |ƒ d{V —† dS # t          j        $ r Y dS w xY wdS dS )aÞ  [Deprecated] Start a live session from a data stream.

    > **Warning**: This method is deprecated and will be removed in a future
    version (not before Q2 2025). Please use one of the more specific methods:
    `send_client_content`, `send_realtime_input`, or `send_tool_response`
    instead.

    The interaction terminates when the input stream is complete.
    This method will start two async tasks. One task will be used to send the
    input stream to the model and the other task will be used to receive the
    responses from the model.

    Args:
      stream: An iterator that yields the model response.
      mime_type: The MIME type of the data in the stream.

    Yields:
      The audio bytes received from the model and server response messages.

    Example usage:

    .. code-block:: python

      client = genai.Client(api_key=API_KEY)
      config = {'response_modalities': ['AUDIO']}
      async def audio_stream():
        stream = read_audio()
        for data in stream:
          yield data
      async with client.aio.live.connect(model='...', config=config) as session:
        for audio in session.start_stream(stream = audio_stream(),
        mime_type = 'audio/pcm'):
          play_audio_chunk(audio.data)
    z¶Setting `AsyncSession.start_stream` is deprecated, and will be removed in a future release (not before Q3 2025). Please use the `receive`, and `send_realtime_input`, methods instead.é   r2   N)Úreturn_whençê-�™—q=)r4   r5   r6   ÚasyncioÚEventÚcreate_taskÚ
_send_loopÚis_setrr   ÚwaitÚFIRST_COMPLETEDÚdonert   ÚsleepÚConnectionClosedÚcancelÚCancelledError)r)   rv   rw   Ú
stop_eventÚ	recv_tasks        r*   Ústart_streamzAsyncSession.start_streamÌ  sñ  è è € õJ „Mð	Põ 	Øðñ ô ð õ ”‘”€JåÔ˜Ÿš¨°	¸:ÑFÔFÑGÔGÐGØ€IØ×ÒÑ!Ô!ð ðÝÔ'¨¯ª©¬Ñ8Ô8ˆ	ÝŒlàÝÔ# J§O¢OÑ$5Ô$5Ñ6Ô6ðõ  Ô/ð
ñ 
ô 
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð �>Š>ÑÔð 	'Ø× Ò Ñ"Ô"Ð
"Ð
"Ð
"Ð
"å”˜gÑ&Ô&Ð
&Ð
&Ð
&Ð
&Ð
&Ð
&Ð
&øøÝð ð ð Øˆðøøøð ×ÒÑ!Ô!ð ð  Ð Y§^¢^Ñ%5Ô%5ÐØ×ÒÑÔÐðØˆˆˆˆˆˆˆˆˆøÝÔ#ð ð ð Øˆˆðøøøð ÐÐÐs%   Á2B7D* Ä*
D7Ä6D7Å9F ÆFÆFc              ƒ   óŒ  K  — t          j        ¦   «         }	 | j                             d¬¦  «        ƒ d {V —†}n©# t          $ r" | j                             ¦   «         ƒ d {V —†}Y n~t
          $ rr}|j        r|j        j        }|j        j        }n'd}t          j
        j                             |d¦  «        }t          j                             ||d ¦  «         Y d }~nd }~ww xY w|r@	 t!          j        |¦  «        }n,# t           j        j        $ r t)          d|›�¦  «        ‚w xY wi }| j        j        rt/          j        |¦  «        }nt/          j        |¦  «        }|s6|r4t          j                             |                     d¦  «        |d ¦  «         t           j                             ||                     ¦   «         ¬¦  «        S )NF©Údecodeéî  úAbnormal closure.úFailed to parse response: Úcode©ro   rc   )r   ÚLiveServerMessager(   ÚrecvÚ	TypeErrorr…   Úrcvdr‘   ÚreasonÚ
websocketsÚframesÚCLOSE_CODE_EXPLANATIONSrl   r   ÚAPIErrorÚraise_errorr9   ÚloadsÚdecoderÚJSONDecodeErrorr[   r'   rK   rM   Ú_LiveServerMessage_from_vertexÚ_LiveServerMessage_from_mldevÚ_from_responserJ   )r)   Úparameter_modelÚraw_responseÚer‘   r—   ro   Úresponse_dicts           r*   rr   zAsyncSession._receive  sý  è è € ÝÔ-Ñ/Ô/€Oð6Øœ8Ÿ=š=°˜=Ñ6Ô6Ð6Ð6Ð6Ð6Ð6Ð6€l€løÝð +ð +ð +Øœ8Ÿ=š=™?œ?Ð*Ð*Ð*Ð*Ð*Ð*€l€l€lÝð 6ð 6ð 6Ø	
Œð ZØŒvŒ{ˆØ””ˆˆàˆÝÔ"Ô:×>Ò>¸tÐEXÑYÔYˆÝ„o×!Ò! $¨°Ñ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5øøøøð6øøøð ð ðHÝ”:˜lÑ+Ô+ˆˆøÝŒ\Ô)ð Hð Hð HÝÐF°lÐFÐFÑGÔGÐGðHøøøð €hàÔÔ ð NÝ%ÔDÀXÑNÔN€m€må%ÔCÀHÑMÔM€màð H˜Xð Hå„o×!Ò! (§,¢,¨vÑ"6Ô"6¸À$ÑGÔGÐGÝÔ"×1Ò1Ø ×'AÒ'AÑ'CÔ'Cð 2ñ ô ð s(   —!9 ¹)CÁ$	CÁ-A(CÃCÃ%C: Ã:'D!Údata_streamrˆ   c              ƒ   ó  K  — |2 3 d {V —†}t          j        t          j        ||¬¦  «        g¬¦  «        }|                      |¬¦  «        ƒ d {V —† t	          j        d¦  «        ƒ d {V —† Œh6 |                     ¦   «          d S )N©Údatarw   ©Úmedia_chunks)r-   r{   )r   ÚLiveClientRealtimeInputÚBlobr8   r|   r„   Úset)r)   r§   rw   rˆ   rª   Úmodel_inputs         r*   r   zAsyncSession._send_loop6  sÆ   è è € ð "ð #ð #ð #ð #ð #ð #ð #ˆdÝÔ1Ýœ
¨¸	ÐBÑBÔBÐCðñ ô €kð �IŠI˜KˆIÑ(Ô(Ð(Ð(Ð(Ð(Ð(Ð(Ð(åŒM˜'Ñ"Ô"Ð"Ð"Ð"Ð"Ð"Ð"Ð"Ð"ð "ð ‡N‚NÑÔÐÐÐs   …A-c           	      ón  ‡— |}|st          j        d¦  «         dddiiS t          |t          ¦  «        r|g}�nt          |t          ¦  «        ršd|v r–	 t          j        d&i |¤Ž}n6# t          j        $ r$ t          dt          |¦  «        › d|› d�¦  «        ‚w xY wt          |t
          j        ¦  «        r2t          |j        t          ¦  «        r|                     d	d¬
¦  «        g}nbt          |t
          j        ¦  «        r|g}nDt          |t          ¦  «        r/d|v r+d|v r'| j        j        sd|vrt          t           ¦  «        ‚|g}t          |t"          ¦  «        �rht%          d„ |D ¦   «         ¦  «        �rNg }|D �]}t          |t          ¦  «        �r	 t          j        d&i |¤Ž}n6# t          j        $ r$ t          dt          |¦  «        › d|› d�¦  «        ‚w xY w|j        € | j        j        st          t           ¦  «        ‚|                     dd	¬¦  «        }t          j        |                     d¦  «        |                     d¦  «        ¬¦  «        }	|                     d¦  «        r|                     d¦  «        |	d<   |                     |	¦  «         �Œ t          j        t          j        |¬¦  «        ¬¦  «        }
�nìt          |t"          ¦  «        �rnt%          d„ |D ¦   «         ¦  «        �rTi Šg }|D ]>}t          |t5          t
          j        ¦  «        ¦  «        r|                     |¦  «         Œ?| j        j        rd„ t9          j        |¦  «        D ¦   «         }n ˆfd„t9          j        |¦  «        D ¦   «         }g }|D ]”}	 t          j        d&i |¤Ž}n6# t          j        $ r$ t          dt          |¦  «        › d|› d�¦  «        ‚w xY w|                     t          j        |                     dd	¬¦  «        d         |j         ¬¦  «        ¦  «         Œ•t          j        t          j!        ||¬¦  «        ¬¦  «        }
�nht          |t"          ¦  «        r�t%          d„ |D ¦   «         ¦  «        rnIt%          d„ |D ¦   «         ¦  «        rd„ |D ¦   «         }n#t          dt          |¦  «        › d|› d�¦  «        ‚t          j        t          j"        |¬¦  «        ¬¦  «        }
�nÆt          |t          ¦  «        �r¢d|v sd |v rSd |v r	|d          }n|d         }t          j        t          j!        ||                     d¦  «        ¬¦  «        ¬¦  «        }
�nUd!|v rŽ	 t          j#        d&i |¤Ž}n6# t          j        $ r$ t          dt          |¦  «        › d|› d�¦  «        ‚w xY wt          j        t          j"        |                     dd	¬¦  «        d!         ¬¦  «        ¬¦  «        }
�nÃd"|v rŽ	 t          j$        d&i |¤Ž}n6# t          j        $ r$ t          dt          |¦  «        › d|› d�¦  «        ‚w xY wt          j        t          j        |                     dd	¬¦  «        d"         ¬¦  «        ¬¦  «        }
�n1t          dt          |¦  «        › d|› d�¦  «        ‚t          |t
          j#        ¦  «        �r•|                     dd	¬¦  «        }t          j        t          j"        |                     d!¦  «        ¬¦  «        ¬¦  «        }
|
d#         ��8|
d#         d!         ��)t          |
d#         d!         d$         d         t          ¦  «        rüg }|
d#         d!         D ]à}t          |t          ¦  «        rÉ	 t          j        d&i |¤Ž}n6# t          j        $ r$ t          dt          |¦  «        › d|› d�¦  «        ‚w xY wt          |t
          j        ¦  «        rft          |j        t          ¦  «        rL|j        �E|                     t          j%        tM          j'        |j        ¦  «        |j(        ¬%¦  «        ¦  «         Œá||
d#         d!<   �n^t          |t
          j)        ¦  «        rh|                     dd	¬¦  «        }t          j        t          j!        |                     d ¦  «        |                     d¦  «        ¬¦  «        ¬¦  «        }
�nÜt          |t
          j$        ¦  «        r‹| j        j        s-|j*        �&|j*        d$         j        st          t           ¦  «        ‚t          j        t          j        |                     dd	¬¦  «                             d"¦  «        ¬¦  «        ¬¦  «        }
�n7t          |t
          j        ¦  «        rÒ| j        j        s|j        st          t           ¦  «        ‚|                     dd	¬¦  «        }t          j        |                     d¦  «        |                     d¦  «        ¬¦  «        }	|                     d¦  «        r|                     d¦  «        |	d<   t          j        t          j        |	g¬¦  «        ¬¦  «        }
�nKt          |t"          ¦  «        �rt          |d$         t
          j        ¦  «        rò| j        j        s!|d$         j        st          t           ¦  «        ‚g }|D ]—}|                     dd	¬¦  «        }t          j        |                     d¦  «        |                     d¦  «        ¬¦  «        }	|                     d¦  «        r|                     d¦  «        |	d<   |                     |	¦  «         Œ˜t          j        t          j        |¬¦  «        ¬¦  «        }
n#t          dt          |¦  «        › d|› d�¦  «        ‚|
S )'Nz0No input provided. Assume it is the end of turn.rG   r>   Trª   zUnsupported input type "z" or input content "ú"r9   r@   Únamero   ri   c              3   óP   K  — | ]!}t          |t          ¦  «        od |v od|v V — Œ"dS )r³   ro   N©Ú
isinstanceÚdict©Ú.0Úcs     r*   ú	<genexpr>z5AsyncSession._parse_client_message.<locals>.<genexpr>r  sR   è è € ð 5ð 5àõ 	�1•dÑÔÐ? ¨! Ð?°
¸a°ð5ð 5ð 5ð 5ð 5ð 5r,   ©rB   rA   )r³   ro   )rf   )rj   c              3   ó@   K  — | ]}t          |t          ¦  «        V — Œd S r&   )r¶   Ústrr¸   s     r*   r»   z5AsyncSession._parse_client_message.<locals>.<genexpr>˜  s=   è è € ð 7ð 7Ø �
�1•cÑÔð7ð 7ð 7ð 7ð 7ð 7r,   c                 ó:   — g | ]}t          j        |d ¬¦  «        ‘ŒS )TrC   )r   rL   )r¹   Úitems     r*   ú
<listcomp>z6AsyncSession._parse_client_message.<locals>.<listcomp>¡  s8   € ð 
ð 
ð 
àõ Ô# D°tÐ<Ñ<Ô<ð
ð 
ð 
r,   c                 ó0   •— g | ]}t          |‰¦  «        ‘ŒS © r   )r¹   rÀ   Ú	to_objects     €r*   rÁ   z6AsyncSession._parse_client_message.<locals>.<listcomp>¦  s3   ø€ ð 
ð 
ð 
àõ ˜d IÑ.Ô.ð
ð 
ð 
r,   Úparts)rÅ   Úroler<   )rG   c              3   óH   K  — | ]}t          |t          ¦  «        od |v V — ŒdS )rª   Nrµ   ©r¹   Úbs     r*   r»   z5AsyncSession._parse_client_message.<locals>.<genexpr>Ã  s5   è è € ÐLÐL°q�j˜�DÑ!Ô!Ð1 f° kÐLÐLÐLÐLÐLÐLr,   c              3   óJ   K  — | ]}t          |t          j        ¦  «        V — Œd S r&   )r¶   r   r®   rÈ   s     r*   r»   z5AsyncSession._parse_client_message.<locals>.<genexpr>Å  s.   è è € ÐBÐB¨Q�z˜!�UœZÑ(Ô(ÐBÐBÐBÐBÐBÐBr,   c                 ó<   — g | ]}|                      d d¬¦  «        ‘ŒS )Tr9   r¼   )rJ   rÈ   s     r*   rÁ   z6AsyncSession._parse_client_message.<locals>.<listcomp>Æ  s8   € ð 
ð 
ð 
àð �LŠL d°ˆLÑ8Ô8ð
ð 
ð 
r,   r«   )rY   Úcontentr=   r¬   rf   rY   r   r©   rÃ   )+ÚloggingÚinfor¶   r¾   r·   r   r®   ÚpydanticÚValidationErrorr[   Útyperª   ÚbytesrJ   r'   rK   rm   r   ÚanyÚFunctionResponseri   ÚFunctionResponseDictrl   ÚappendÚLiveClientMessageDictÚLiveClientToolResponseDictr   Ú	PartUnionrH   Ú
t_contentsÚContentÚContentDictrÆ   ÚLiveClientContentDictÚLiveClientRealtimeInputDictr­   ÚLiveClientToolResponseÚBlobDictÚbase64Ú	b64decoderw   ÚLiveClientContentrf   )r)   r-   r.   Úformatted_inputÚ
blob_inputÚfunction_responses_inputrÀ   Úfunction_response_inputÚfunction_response_dictÚfunction_response_typeddictr;   Úcontent_input_partsÚcontentsÚcontent_dict_listÚcontent_inputÚcontent_turnsrY   Útool_response_inputrd   Úformatted_media_chunksrO   Úfunction_response_listrÄ   s                         @r*   r7   z"AsyncSession._parse_client_messageF  s‡  ø€ ð  !€Oàð 9Ý„lÐEÑFÔFÐFØ °$Ð 7Ð8Ð8Ý�%�ÑÔð  Ø˜€o�oÝ	�E�4Ñ	 Ô	 ð   V¨u _ _ð
Ý”ZÐ(Ð( %Ð(Ð(ˆ
ˆ
øÝÔ%ð 
ð 
ð 
ÝØP¥t¨E¡{¤{ÐPÐPÈÐPÐPÐPñ
ô 
ð 	
ð
øøøõ 
�J¥¤
Ñ	+Ô	+ð 
µ
Ø
Œ/�5ñ1ô 1ð 
ð ×!Ò! v¸DÐ!ÑAÔAð
ˆøõ 
�E�5œ:Ñ	&Ô	&ð  Ø˜€o€oÝ	�E�4Ñ	 Ô	 ð   V¨u _ _¸ÀuÐ9LÐ9LàÔÔ'ð 9¨T¸Ð->Ð->ÝÕ7Ñ8Ô8Ð8Ø˜€oå�/¥8Ñ,Ô,ñ ~µð 5ð 5à ð5ñ 5ô 5ñ 2ô 2ñ ~ð
 "$ÐØ!ð Iñ Iˆ$Ý�d�DÑ!Ô!ñ 	IðÝ&+Ô&<Ð&DÐ&D¸tÐ&DÐ&DÐ#Ð#øÝÔ)ð ð ð Ýð­4°©;¬;ð ð Øðð ð ñô ð ðøøøð &Ô(Ð0ØÔ&Ô/ð 1õ Õ;Ñ<Ô<Ð<à%<×%GÒ%GØ!¨ð &Hñ &ô &Ð"õ +0Ô*DØ+×/Ò/°Ñ7Ô7Ø/×3Ò3°JÑ?Ô?ð+ñ +ô +Ð'ð &×)Ò)¨$Ñ/Ô/ð Ø2H×2LÒ2LØñ3ô 3Ð)¨$Ñ/ð %×+Ò+Ð,GÑHÔHÐHùÝÔ2ÝÔ8Ø!9ðñ ô ðñ ô €n�nõ
 
�O¥XÑ	.Ô	.ñ Xµ3ð 7ð 7Ø$3ð7ñ 7ô 7ñ 4ô 4ñ Xð ')€iØ35ÐØ!ð +ð +ˆ$Ý�d�H¥U¤_Ñ5Ô5Ñ6Ô6ð 	+Ø
×
$Ò
$ TÑ
*Ô
*Ð
*øØ	Ô	Ô	"ð 	
ð
ð 
åœÐ%8Ñ9Ô9ð
ñ 
ô 
ˆˆð

ð 
ð 
ð 
åœÐ%8Ñ9Ô9ð
ñ 
ô 
ˆð
 46ÐØð 
ð 
ˆ$ð	Ýœ-Ð/Ð/¨$Ð/Ð/ˆ-ˆ-øÝÔ'ð 	ð 	ð 	Ýð­¨e©¬ð ð Øðð ð ñô ð ð	øøøð
 	× Ò ÝÔØ#×.Ò.¸DÀvÐ.ÑNÔNØôð #Ô'ð	ñ ô ñ	
ô 	
ð 	
ð 	
õ Ô2ÝÔ4Ø%°[ðñ ô ðñ ô €n�nõ
 
�O¥XÑ	.Ô	.ð nÝ	ÐLÐL¸OÐLÑLÔLÑ	LÔ	Lð 

ØÝÐBÐB°/ÐBÑBÔBÑBÔBð 
ð
ð 
à$ð
ñ 
ô 
ˆˆõ
 ØP¥t¨E¡{¤{ÐPÐPÈÐPÐPÐPñ
ô 
ð 	
õ Ô2ÝÔ:Ø*ðñ ô ðñ ô €n�nõ 
�O¥TÑ	*Ô	*ñ [Ø	�oÐ	%Ð	%¨°OÐ)CÐ)Cà�oÐ%Ð%Ø)¨'Ô2ˆ-ˆ-à)¨)Ô4ˆ-ÝÔ4Ý Ô6Ø#Ø-×1Ò1°/ÑBÔBðñ ô ð
ñ 
ô 
ˆ‰ð ˜_Ð,Ð,ð	Ý Ô8ÐKÐK¸?ÐKÐKˆ.ˆ.øÝÔ'ð 	ð 	ð 	Ýð­¨e©¬ð ð Øðð ð ñô ð ð	øøøõ
 Ô4Ý Ô<Ø+×6Ò6Ø!%¨Fð 7ñ ô à ô"ðñ ô ð
ñ 
ô 
ˆ‰ð   ?Ð2Ð2ð	Ý %Ô <Ð OÐ O¸Ð OÐ OÐ
Ð
øÝÔ'ð 	ð 	ð 	Ýð­¨e©¬ð ð Øðð ð ñô ð ð	øøøõ
 Ô4ÝÔ:Ø#6×#AÒ#AØ!%¨Fð $Bñ $ô $à&ô$(ðñ ô ð
ñ 
ô 
ˆ‰õ ØP¥t¨E¡{¤{ÐPÐPÈÐPÐPÐPñ
ô 
ð 	
õ 
�O¥UÔ%BÑ	CÔ	Cñ lØ+×6Ò6Ø &ð 7ñ ô Ðõ Ô2ÝÔ:Ø.×2Ò2°>ÑBÔBðñ ô ðñ ô €nð Ð)Ô
*Ñ
6ØÐ-Ô.¨~Ô>ÑJÝØÐ-Ô.¨~Ô>¸qÔAÀ&ÔIÍ5ñô ð Kð
 8:ÐØ"Ð#3Ô4°^ÔDð 	ð 	ˆDÝ˜�dÑ#Ô#ð ðÝ œ:Ð-Ð-¨Ð-Ð-ˆjˆjøÝÔ+ð ð ð Ýð ­T°%©[¬[ð  ð  Øð ð  ð  ñô ð ðøøøõ ˜:¥u¤zÑ2Ô2ð
å˜zœµÑ6Ô6ð
ð ”OÐ/à$×+Ò+Ý”.Ý!Ô+¨J¬OÑ<Ô<Ø *Ô 4ðñ ô ñô ð øð #ð 	Ð'Ô(Øñ	
ùõ 
�O¥UÔ%<Ñ	=Ô	=ð BØ+×6Ò6Ø &ð 7ñ ô Ðõ Ô2ÝÔ4Ø'×+Ò+¨GÑ4Ô4Ø/×3Ò3°OÑDÔDðñ ô ðñ ô €n�nõ 
�O¥UÔ%AÑ	BÔ	Bð 8ð ÔÔ(ð9àÔ0Ð<Ø"Ô5°aÔ8Ô;ð =õ Õ7Ñ8Ô8Ð8ÝÔ2ÝÔ8Ø!0×!;Ò!;Ø#¨&ð "<ñ "ô "ç’Ð(Ñ)Ô)ðñ ô ðñ ô €n�nõ 
�O¥UÔ%;Ñ	<Ô	<ð )ØÔÔ'ð 9°/Ô2Dð 9ÝÕ7Ñ8Ô8Ð8Ø.×9Ò9Ø &ð  :ñ  ô  Ðõ %*Ô$>Ø%×)Ò)¨&Ñ1Ô1Ø)×-Ò-¨jÑ9Ô9ð%ñ %ô %Ð!ð 
 ×	#Ò	# DÑ	)Ô	)ð MØ,B×,FÒ,FÀtÑ,LÔ,LÐ# DÑ)ÝÔ2ÝÔ8Ø"=Ð!>ðñ ô ðñ ô €n�nõ
 
�O¥XÑ	.Ô	.ñ µ:Ø˜Ô�EÔ2ñ4ô 4ð ð ÔÔ'ð 9°/À!Ô2DÔ2Gð 9ÝÕ7Ñ8Ô8Ð8ØACÐØ!ð Cð Cˆ$Ø!%§¢¸dÈ Ñ!PÔ!PÐÝ&+Ô&@Ø'×+Ò+¨FÑ3Ô3Ø+×/Ò/°
Ñ;Ô;ð'
ñ '
ô '
Ð#ð "×%Ò% dÑ+Ô+ð 	OØ.D×.HÒ.HÈÑ.NÔ.NÐ
% dÑ
+Ø×%Ò%Ð&AÑBÔBÐBÐBÝÔ2ÝÔ8Ø!7ðñ ô ðñ ô €n€nõ Ø
N¥T¨%¡[¤[Ð
NÐ
NÀeÐ
NÐ
NÐ
Nñô ð ð ÐsH   ÁA& Á&3BÆF+Æ+3GÎN"Î"3OÕ%U7 Õ73V*×7X	 Ø	3X<Þ^Þ3_c              ƒ   óH   K  — | j                              ¦   «         ƒ d {V —† d S r&   )r(   Úclose©r)   s    r*   ró   zAsyncSession.closet  s0   è è € à
Œ(�.Š.Ñ
Ô
ÐÐÐÐÐÐÐÐÐr,   r&   )NF)r/   N)*Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r¾   r+   r   r   ÚContentListUnionÚContentListUnionDictÚLiveClientContentOrDictÚLiveClientRealtimeInputOrDictÚLiveClientToolResponseOrDictÚFunctionResponseOrDictr   Úboolr8   rÛ   rÜ   r\   rP   ÚBlobImageUnionDictÚ
BlobOrDictÚActivityStartOrDictÚActivityEndOrDictre   rp   r   r“   ru   rÒ   rŠ   rr   r|   r}   r   r×   r7   ró   rÃ   r,   r*   r!   r!   W   sõ  € € € € € ØÐð #'ð	!ð !àð!ð "ð!ð ˜3”-ð	!ð !ð !ð !ð. Ø$)ð14ð 14ð 14ð Ø
ØÔ$ØÔ(ØÔ+ØÔ1ØÔ0ØÔ*Ø�uÔ3Ô4ð6ôô
ð14ð ˜D”>ð14ð ð14ð 14ð 14ð 14ðx Ø ðXMð XMð XMð Ø
ØŒmØÔØ�5˜œ¨Ô(9Ð9Ô:Ô;ð=ôôðXMð ðXMð ðXMð XMð XMð XMðz 37Ø*.Ø)-Ø26Ø Ø<@Ø8<ðgMð gMð gMð �eÔ.Ô/ðgMð �eÔ&Ô'ð	gMð
 ! œðgMð �eÔ.Ô/ðgMð �SŒMðgMð ˜uÔ8Ô9ðgMð ˜UÔ4Ô5ðgMð ðgMð gMð gMð gMðRSKð  Ø
Ô
&Ø
�5Ô/Ô
0ð2ôðSKð ðSKð SKð SKð SKðj˜]¨5Ô+BÔCð ð ð ð ð:FØ$ UÔ+ðFØ8;ðFà�UÔ,Ô-ðFð Fð Fð FðP ˜eÔ5ð  ð  ð  ð  ðDà  Ô'ðð ðð ”-ð	ð
 ðð ð ð ð8 Ø$)ðlð làØ
ØÔ$ØÔ(ØÔ+ØÔ1ØÔ0ØÔ*Ø�uÔ3Ô4ð6ôô
ðlð ˜D”>ðlð Ô"ðlð lð lð lð\	ð ð ð ð ð r,   r!   c            	       óš   ‡ — e Zd ZdZdefˆ fd„Zedefd„¦   «         Ze	j
        ddœded	eej                 dee         fd
„¦   «         Zˆ xZS )Ú	AsyncLivez[Preview] AsyncLive.r"   c                 ór   •— t          ¦   «                              |¦  «         t          |¦  «        | _        d S r&   )Úsuperr+   r   Ú_music)r)   r"   Ú	__class__s     €r*   r+   zAsyncLive.__init__|  s.   ø€ Ý	�G„G×Ò�ZÑ Ô Ð Ý  Ñ,Ô,€D„K€K€Kr,   r/   c                 ó   — | j         S r&   )r  rô   s    r*   ÚmusiczAsyncLive.music€  s
   € àŒ;Ðr,   N)ÚconfigÚmodelr  c          	     óœ  K  — t          |t          ¦  «        rt          j        d*i |¤Ž}|r|j        rt          d¦  «        ‚| j                             ¦   «         }t          |t          ¦  «        r| 	                    d¦  «        }t          j        | j        |¦  «        }t          | j        |¦  «        ƒ d{V —†}| j        j        �rY| j        j        �sL| j        j        j        }| j        j        }d}| j        j        j        }	|	�|	                     ¦   «         ni }
|                     d¦  «        rPt)          j        dt,          j        ¬¦  «         d}d	|› �|
d
<   |dk    r t)          j        dt,          j        ¬¦  «         |› d|› d|› �}t1          j        t5          j        | j        t          j        ||¬¦  «                             d¬¦  «        ¬¦  «        ¦  «        }|d= t1          j        |¦  «        }t?          |ddg|¦  «         tA          j!        |¦  «        }�n,| j        j        rï| j        j        rã| j        j        }| j        j        j        }|› d|› d�}| j        j        j        }	|	�|	                     ¦   «         ni }
t1          j        t5          j"        | j        t          j        ||¬¦  «                             d¬¦  «        ¬¦  «        ¦  «        }|d= t1          j        |¦  «        }t?          |ddg|¦  «         tA          j!        |¦  «        }�n1| j        j        j        }| j        j#        o| j        j$        }| j        j%        r:|s8| j        j%        }|}| j        j        j        }	|	�|	                     ¦   «         ni }
nÞ|› d|› d�}| j        j&        s%tN          j(         )                    dg¬¦  «        \  }}n| j        j&        }|j*        r|j+        s>tX          €t          d¦  «        ‚tY          j-        ¦   «         }| .                    |¦  «         |j*        }| j        j        j        }	|	�|	                     ¦   «         ni }
|
 /                    d
¦  «        sd|› �|
d
<   | j        j$        }| j        j#        }|                     d¦  «        r|r|rd|› d|› d�|z   }t1          j        t5          j"        | j        t          j        ||¬¦  «                             d¬¦  «        ¬¦  «        ¦  «        }|d= t1          j        |¦  «        }ta          |g d ¢¦  «        	 €t?          |g d ¢d!g¦  «         tA          j!        |¦  «        }|j1        r1te          j3        |j1        ¦  «        r|
€i }
te          j4        |
¦  «         tk          |fd"|
i| j        j6        ¤Ž4 ƒd{V —†	 }| 7                    |¦  «        ƒ d{V —† 	 | 8                    d#¬$¦  «        ƒ d{V —†}n�# tr          $ r | 8                    ¦   «         ƒ d{V —†}Y n[tt          $ rO}|j;        r|j;        j<        }|j;        j=        }nd%}d&}t,          j>         ?                    ||d¦  «         Y d}~nd}~ww xY w|r@	 tA          j@        |¦  «        }n,# t@          jA        jB        $ r t          d'|›�¦  «        ‚w xY wi }| j        j        rt5          jC        |¦  «        }n|}t          jD         E                    ||                     ¦   «         ¬(¦  «        }|jF        r|jF        jG        }nd}t‘          | j        ||¬)¦  «        W V — ddd¦  «        ƒd{V —† dS # 1 ƒd{V —†swxY w Y   dS )+að  [Preview] Connect to the live server.

    Note: the live API is currently in preview.

    Usage:

    .. code-block:: python

      client = genai.Client(api_key=API_KEY)
      config = {}
      async with client.aio.live.connect(model='...', config=config) as session:
        await session.send_client_content(
          turns=types.Content(
            role='user',
            parts=[types.Part(text='hello!')]
          ),
          turn_complete=True
        )
        async for message in session.receive():
          print(message)

    Args:
      model: The model to use for the live session.
      config: The configuration for the live session.
      **kwargs: additional keyword arguments.

    Yields:
      An AsyncSession object.
    z¯google.genai.client.aio.live.connect() does not support http_options at request-level in LiveConnectConfig yet. Please use the client-level http_options configuration instead.zutf-8NÚBidiGenerateContentzauth_tokens/zUThe SDK's ephemeral token support is experimental, and may change in future versions.)ÚmessageÚcategoryÚBidiGenerateContentConstrainedzToken ÚAuthorizationÚv1alphaz»The SDK's ephemeral token support is in v1alpha only.Please use client = genai.Client(api_key=token.name, http_options=types.HttpOptions(api_version="v1alpha")) before session connection.z!/ws/google.ai.generativelanguage.z.GenerativeService.)r  r  T)rB   )r"   rF   r  Úsetupr  z/ws/google.cloud.aiplatform.z#.LlmBidiService/BidiGenerateContentz.https://www.googleapis.com/auth/cloud-platform)Úscopesz{The requests module is required to refresh google-auth credentials. Please install with `pip install google-auth[requests]`zBearer zpublishers/z	projects/z/locations/ú/)r  ÚgenerationConfigÚresponseModalitiesÚAUDIOÚadditional_headersFrŒ   rŽ   r�   r�   r’   )r"   r#   r$   rÃ   )Ir¶   r·   r   ÚLiveConnectConfigÚhttp_optionsr[   r'   Ú_websocket_base_urlrÒ   r�   rH   Út_modelÚ_t_live_connect_configÚapi_keyrK   Ú_http_optionsÚapi_versionÚheadersÚcopyÚ
startswithr4   r5   r   ÚExperimentalWarningr   rL   rM   Ú_LiveConnectParameters_to_mldevÚLiveConnectParametersrJ   rb   Úsetvr9   r:   Ú _LiveConnectParameters_to_vertexÚprojectÚlocationÚcustom_base_urlÚ_credentialsÚgoogleÚauthÚdefaultÚtokenÚvalidr   ÚRequestÚrefreshrl   ÚgetvÚtoolsr   Úhas_mcp_tool_usageÚset_mcp_usage_headerÚ
ws_connectÚ_websocket_ssl_ctxr8   r”   r•   r…   r–   r‘   r—   r›   rœ   r�   rž   rŸ   r    r“   r¢   Úsetup_completer$   r!   )r)   r  r  Úbase_urlÚtransformed_modelr£   Úversionr!  ÚmethodÚoriginal_headersr$  ÚuriÚrequest_dictÚrequestÚhas_sufficient_authÚcredsÚ_Úauth_reqÚbearer_tokenr-  r,  Úwsr¤   r¥   r‘   r—   ro   r¦   Úsetup_responser$   s                                 r*   r   zAsyncLive.connect„  sg	  è è € õJ �&�$ÑÔð 1ÝÔ&Ð0Ð0¨Ð0Ð0€fØð �&Ô%ð ÝðBñô ð ð Ô×3Ò3Ñ5Ô5€HÝ�(�EÑ"Ô"ð *Ø—’ Ñ)Ô)€hÝœ	 $Ô"2°EÑ:Ô:Ðå2°4Ô3CÀVÑLÔLÐLÐLÐLÐLÐLÐL€OàÔÔñ I)¨Ô(8Ô(Añ I)ØÔ Ô.Ô:€gØÔ Ô(€gØ$€fØÔ)Ô7Ô?ÐØ+;Ð+GÐ ×%Ò%Ñ'Ô'Ð'ÈR€gØ	×	Ò	˜NÑ	+Ô	+ð ÝŒð.õ Ô/ð	
ñ 	
ô 	
ð 	
ð 2ˆØ#5¨GÐ#5Ð#5ˆ�Ñ Ø�iÒÐÝ
Œ-ð0õ
 Ô1ðñ ô ð ð Ð^Ð^¸'Ð^Ð^ÐV\Ð^Ð^€cåÔ,Ý
Ô
9ØÔ)ÝÔ5Ø)Ø(ðñ ô ÷ ’
¨�
Ñ-Ô-ðñ ô ñô €lð �xÐ
 ÝÔ8¸ÑFÔF€lÝ
ˆ<˜' 7Ð+Ð->Ñ?Ô?Ð?å”
˜<Ñ(Ô(€g�gØ	Ô	Ô	!ð ^) dÔ&6Ô&?ð ^)àÔ Ô(€gØÔ Ô.Ô:€gØÐaÐa°WÐaÐaÐa€cØÔ)Ô7Ô?ÐØ+;Ð+GÐ ×%Ò%Ñ'Ô'Ð'ÈR€gåÔ,Ý
Ô
:ØÔ)ÝÔ5Ø)Ø(ðñ ô ÷ ’
¨�
Ñ-Ô-ðñ ô ñô €lð �xÐ
 ÝÔ8¸ÑFÔF€lÝ
ˆ<˜' 7Ð+Ð->Ñ?Ô?Ð?å”
˜<Ñ(Ô(€g�gàÔ Ô.Ô:€gà
Ô
Ô
"Ð
@ tÔ'7Ô'@ð ð 
Ô	Ô	)ð $>Ð2Eð $>ð ÔÔ.ˆà!ÐàÔ+Ô9ÔAÐà'7Ð'CÐ×!Ò!Ñ#Ô#Ð#Èð 	ˆð
 ÐcÐc°wÐcÐcÐcˆàÔÔ,ð 	0å”[×(Ò(ØFÐGð )ñ ô ‰(ˆ%��ð Ô"Ô/ˆ%ð ”ð 	" ¤ð 	"ÝÐÝð  [ñ  \ô  \ð  \ÝÔ%Ñ'Ô'ˆ(Ø
�-Š-˜Ñ
!Ô
!Ð
!Ø”{ˆàÔ+Ô9ÔAÐà'7Ð'CÐ×!Ò!Ñ#Ô#Ð#Èð 	ð �{Š{˜?Ñ+Ô+ð 	>Ø%=¨|Ð%=Ð%=ˆ'�/Ñ
"àÔ!Ô*€hØÔ Ô(€gØ	×	%Ò	% mÑ	4Ô	4ð 
¸ð 
ÀXð 
à7˜Ð7Ð7¨HÐ7Ð7Ð7Ð:KÑKð 	õ Ô,Ý
Ô
:ØÔ)ÝÔ5Ø)Ø(ðñ ô ÷ ’
¨�
Ñ-Ô-ðñ ô ñô €lð �xÐ
 ÝÔ8¸ÑFÔF€lå
ØÐOÐOÐOñô ð ðõ
 	ØØ?Ð?Ð?ØˆIñ	
ô 	
ð 	
õ ”
˜<Ñ(Ô(€gàÔð /¥Ô!>ØÔñ"ô "ð /ð 
ˆØˆÝÔ% gÑ.Ô.Ð.åØðð Ø 'ðØ+/Ô+;Ô+Nðð ð )ð )ð )ð )ð )ð )ð )ð )à	Ø�GŠG�GÑÔÐÐÐÐÐÐÐð8àŸWšW¨E˜WÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ˆˆøÝð 'ð 'ð 'ØŸWšW™YœY������ˆˆˆÝð 8ð 8ð 8ØŒ6ð 	'Ø””ˆ$Ø”6”=ˆ&ˆ&àˆ$Ø&ˆ&ÝŒ×#Ò# D¨&°$Ñ7Ô7Ð7Ð7Ð7Ð7Ð7Ð7øøøøð8øøøð 
ð ð	JÝ”Z Ñ-Ô-ˆ(ˆ(øÝŒ|Ô+ð 	Jð 	Jð 	JÝÐH¸ÐHÐHÑIÔIÐ
Ið	Jøøøð ˆà	Ô	Ô	"ð !Ý'ÔFÀxÑPÔPˆˆà ˆåÔ.×=Ò=Ø ¨×)CÒ)CÑ)EÔ)Eð >ñ ô €nð 
Ô	&ð Ø#Ô2Ô=ˆ
ˆ
àˆ
ÝØÔ%ØØðñ ô ð ð ð ð ðK)ð )ð )ñ )ô )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )øøøð )ð )ð )ð )ð )ð )sb   Ö#\;× W×\;×$YØ\;Ø	YØAYÙ\;ÙYÙ\;Ù!Y6Ù5\;Ù6'ZÚB\;Ü;
]Ý])rõ   rö   r÷   rø   r   r+   Úpropertyr   r  Ú
contextlibÚasynccontextmanagerr¾   r   r   ÚLiveConnectConfigOrDictr   r!   r   Ú__classcell__)r	  s   @r*   r  r  y  sÜ   ø€ € € € € ØÐð- ð -ð -ð -ð -ð -ð -ð ð�^ð ð ð ñ „8ðð Ô!ð
 9=ð	oð oð oð ðoð �uÔ4Ô5ð	oð
 �\Ô"ðoð oð oñ "Ô!ðoð oð oð oð or,   r  r"   r  r/   c              ƒ   ó–  K  — |€t          j        ¦   «         }n›t          |t          ¦  «        rPt	          |dg¦  «        �$t          j        t	          |dg¦  «        ¦  «        }nd }t          j        di |¤Ž}||_        n6|j        €d }n#t          j        t	          |dg¦  «        ¦  «        }|}||_        |                     dd i¬¦  «        }|j	        rÓg |_	        |j	        D ]Ä}t          �]t          |t          ¦  «        rHt          ||                     ¦   «         ƒ d {V —†¦  «        }|j	                             |j	        ¦  «         Œft          �=t          |t          ¦  «        r(|j	                             t!          |¦  «        ¦  «         Œª|j	                             |¦  «         ŒÅ|j        �t%          j        dt(          d¬¦  «         |S )NÚsystem_instructionr8  )Úupdatez¶Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025)ry   r2   rÃ   )r   r  r¶   r·   r7  rH   Ú	t_contentrS  Ú
model_copyr8  r   r   Ú
list_toolsÚextendr   rÖ   r   Úgeneration_configr4   r5   r6   )r"   r  r£   Úconverted_system_instructionrS  Úparameter_model_copyÚtoolÚmcp_to_genai_tool_adapters           r*   r   r   w  s  è è € ð
 €^ÝÔ-Ñ/Ô/€O€OÝ�&�$ÑÔð <ÝˆFÐ)Ð*Ñ+Ô+Ð7Ý%&¤[Ý
ˆvÐ,Ð-Ñ
.Ô
.ñ&ô &Ð"Ð"ð &*Ð"ÝÔ-Ð7Ð7°Ð7Ð7€OØ)E€OÔ&Ð&àÔ Ð(ØÐÐåœ;¥t¨FÐ5IÐ4JÑ'KÔ'KÑLÔLÐØ€OØ);€OÔ&ð )×3Ò3¸GÀT¸?Ð3ÑKÔKÐØÔð 0Ø!#ÐÔØÔ%ð 
0ð 
0ˆÝ	Ð	%­*°TÕ;KÑ*LÔ*LÐ	%Ý$9Ø˜ŸšÑ)Ô)Ð)Ð)Ð)Ð)Ð)Ð)ñ%
ô %
Ð!ð 	Ô"×)Ò)Ð*CÔ*IÑJÔJÐJÐJÝÐ¥:¨dµGÑ#<Ô#<ÐØÔ"×)Ò)Õ*<¸TÑ*BÔ*BÑCÔCÐCÐCàÔ"×)Ò)¨$Ñ/Ô/Ð/Ð/àÔ+Ð7Ý„Mð	Cõ 	Øðñ ô ð ð 
Ðr,   )Erø   r|   rá   rN  r9   rÍ   Útypingr   r   r   r   r   r   r4   Úgoogle.authr0  rÏ   r˜   Ú r
   r   r   rM   r   r   rH   r   r   r'   r   r   r7  r   r*  Ú
live_musicr   Úmodelsr   r…   Úwebsockets.asyncio.clientr   r   r;  ÚModuleNotFoundErrorÚwebsockets.clientÚgoogle.auth.transportr   ÚImportErrorÚTYPE_CHECKINGÚmcpr   r   Ú	mcp.typesr   r   Ú	_adaptersr   r   ÚTypeÚ__annotations__Ú	getLoggerÚloggerrm   r!   Ú
BaseModuler  rP  r  r   rÃ   r,   r*   ú<module>rq     s  ðð  !Ð  Ð  à €€€Ø €€€Ø Ð Ð Ð Ø €€€Ø €€€Ø €€€Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JØ €€€à Ð Ð Ð Ø €€€Ø Ð Ð Ð à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø .Ð .Ð .Ð .Ð .Ð .Ø .Ð .Ð .Ð .Ð .Ð .Ø &Ð &Ð &Ð &Ð &Ð &Ø %Ð %Ð %Ð %Ð %Ð %àÔ.Ð ð6Ø8Ð8Ð8Ð8Ð8Ð8Ø=Ð=Ð=Ð=Ð=Ð=Ð=øØð 6ð 6ð 6à0Ð0Ð0Ð0Ð0Ð0Ø5Ð5Ð5Ð5Ð5Ð5Ð5Ð5ð6øøøð
Ø,Ð,Ð,Ð,Ð,Ð,Ð,øØð ð ð Ø€(€(€(ðøøøð 
Ôð Ø3Ð3Ð3Ð3Ð3Ð3Ø'Ð'Ð'Ð'Ð'Ð'Ø.Ð.Ð.Ð.Ð.Ð.Ø,Ð,Ð,Ð,Ð,Ð,Ð,à"%Ð�F”KÐ%Ð%Ñ%Ø€'ˆ6Œ;ÐÐÑØ'*Ð˜œÐ*Ð*Ñ*ð	Ø5Ð5Ð5Ð5Ð5Ð5Ø)Ð)Ð)Ð)Ð)Ð)Ø0Ð0Ð0Ð0Ð0Ð0Ø.Ð.Ð.Ð.Ð.Ð.Ð.øØ	ð ð ð ØÐØ€GØ ÐØÐÐÐð	øøøð 
ˆÔ	Ð.Ñ	/Ô	/€ð<ð ð_ð _ð _ð _ð _ñ _ô _ð _ðD{ð {ð {ð {ð {�Ô&ñ {ô {ð {ð|2Øð2à�UÔ2Ô3ð2ð Ôð2ð 2ð 2ð 2ð 2ð 2s6   ÂB ÂB-Â,B-Â1B8 Â8CÃCÄ
D# Ä#D3Ä2D3