o
    h                     @  s   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 deee Z dS )    )annotationsN)	Awaitable)	dataclassfield)AnyCallableGenericcast)Prompt   )	AgentBase)OutputGuardrail)Handoff)AgentHooksBaseRunHooksBase)logger)RunContextWrapperTContext)MaybeAwaitableRealtimeAgent[TContext]c                   @  sx   e Zd ZU dZdZded< 	 dZded< 	 eedZ	ded	< 	 eedZ
d
ed< 	 dZded< 	 dddZdddZdS )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hookskwargsr   returnr   c                 K  s   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)selfr    r"   V/var/www/html/openai_agents/venv/lib/python3.10/site-packages/agents/realtime/agent.pycloneR   s   zRealtimeAgent.clonerun_contextRunContextWrapper[TContext]
str | Nonec                   sx   t | jtr
| jS t| jr,t| jr#ttt | || I dH S tt| || S | jdur:t	d| j  dS )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!   r%   r"   r"   r#   get_system_promptZ   s   

zRealtimeAgent.get_system_prompt)r   r   r   r   )r%   r&   r   r'   )__name__
__module____qualname____doc__r   __annotations__r   r   listr   r   r   r$   r.   r"   r"   r"   r#   r      s"   
 

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   r"   r"   r"   r#   <module>   s(    