
    .Ui                       d dl mZ d dlZd dl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 ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZ ddlmZmZ ddlmZ eedf   Z	 eedf   Z	 e G d deee                Z y)    )annotationsN)	Awaitable)	dataclassfield)AnyCallableGenericcast)Prompt   )	AgentBase)OutputGuardrail)Handoff)AgentHooksBaseRunHooksBase)logger)RunContextWrapperTContext)MaybeAwaitableRealtimeAgent[TContext]c                      e Zd ZU dZdZded<   	 dZded<   	  ee      Z	ded	<   	  ee      Z
d
ed<   	 dZded<   	 ddZddZy)RealtimeAgenta  A specialized agent instance that is meant to be used within a `RealtimeSession` to build
    voice agents. Due to the nature of this agent, some configuration options are not supported
    that are supported by regular `Agent` instances. For example:
    - `model` choice is not supported, as all RealtimeAgents will be handled by the same model
      within a `RealtimeSession`.
    - `modelSettings` is not supported, as all RealtimeAgents will be handled by the same model
      within a `RealtimeSession`.
    - `outputType` is not supported, as RealtimeAgents do not support structured outputs.
    - `toolUseBehavior` is not supported, as all RealtimeAgents will be handled by the same model
      within a `RealtimeSession`.
    - `voice` can be configured on an `Agent` level; however, it cannot be changed after the first
      agent within a `RealtimeSession` has spoken.

    See `AgentBase` for base parameters that are shared with `Agent`s.
    Nzbstr | Callable[[RunContextWrapper[TContext], RealtimeAgent[TContext]], MaybeAwaitable[str]] | NoneinstructionszPrompt | Noneprompt)default_factoryz@list[RealtimeAgent[Any] | Handoff[TContext, RealtimeAgent[Any]]]handoffszlist[OutputGuardrail[TContext]]output_guardrailszRealtimeAgentHooks | Nonehooksc                .    t        j                  | fi |S )zMake a copy of the agent, with the given arguments changed. For example, you could do:
        ```
        new_agent = agent.clone(instructions="New instructions")
        ```
        )dataclassesreplace)selfkwargss     q/home/jay/workspace/tools/ai-image-gen/jaaz-app/server/venv/lib/python3.12/site-packages/agents/realtime/agent.pyclonezRealtimeAgent.cloneR   s     ""42622    c                  K   t        | j                  t              r| j                  S t        | j                        rnt	        j
                  | j                        r/t        t        t           | j                  ||              d{   S t        t        | j                  ||             S | j                  "t        j                  d| j                          y7 Sw)z$Get the system prompt for the agent.Nz1Instructions must be a string or a function, got )

isinstancer   strcallableinspectiscoroutinefunctionr
   r   r   error)r"   run_contexts     r$   get_system_promptzRealtimeAgent.get_system_promptZ   s     d''-$$$d''(**4+<+<=!)C.$2C2CKQU2VWWWC!2!2;!EFF*LLLTM^M^L_`a Xs   BCCAC)r#   r   returnr   )r.   zRunContextWrapper[TContext]r0   z
str | None)__name__
__module____qualname____doc__r   __annotations__r   r   listr   r   r   r%   r/    r&   r$   r   r      s    . 	 	 !FM  RWRHN 
 :?t9T6T (,E$+3r&   r   )!
__future__r   r    r+   collections.abcr   r   r   typingr   r   r	   r
   agents.promptsr   agentr   	guardrailr   r   r   	lifecycler   r   r   r.   r   r   util._typesr   RealtimeAgentHooksRealtimeRunHooksr   r7   r&   r$   <module>rB      s    "   % ( / / !  '  4  5 (#H.G$GH  '*C CD  % KIwx0 K Kr&   