
    b6iU                         d dl Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	m
Z
  e j                  e j                  d      Z G d	 d
      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)AgentWorkflowRequestModel   )AsyncRawDraftsClientRawDraftsClient.c                   t   e Zd ZdefdZedefd       Zeddde	de	d	e
j                  e	e
j                  f   d
e
j                  e	e
j                  f   dede	de
j                  e
j                  e	      de
j                  e   de
j                  fdZddde	de	de
j                  e   de
j                  fdZy)DraftsClientclient_wrapperc                &    t        |      | _        y N)r   )r
   _raw_clientselfr   s     |/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/conversational_ai/agents/drafts/client.py__init__zDraftsClient.__init__   s    *.I    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawDraftsClient
        r   r   s    r   with_raw_responsezDraftsClient.with_raw_response        r   Ntagsrequest_optionsagent_id	branch_idconversation_configplatform_settingsworkflownamer   r   c          
      `    | j                   j                  ||||||||      }	|	j                  S )a  
        Create a new draft for an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        branch_id : str
            The ID of the agent branch to use

        conversation_config : typing.Dict[str, typing.Any]
            Conversation config for the draft

        platform_settings : typing.Dict[str, typing.Any]
            Platform settings for the draft

        workflow : AgentWorkflowRequestModel
            Workflow for the draft

        name : str
            Name for the draft

        tags : typing.Optional[typing.Sequence[str]]
            Tags to help classify and filter the agent

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import (
            AgentWorkflowRequestModel,
            AgentWorkflowRequestModelNodesValue_End,
            AstAndOperatorNodeInputChildrenItem_BooleanLiteral,
            ElevenLabs,
            WorkflowEdgeModelInput,
            WorkflowEdgeModelInputForwardCondition_Expression,
            WorkflowExpressionConditionModelInputExpression_AndOperator,
        )

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.agents.drafts.create(
            agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
            branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj",
            conversation_config={"key": "value"},
            platform_settings={"key": "value"},
            workflow=AgentWorkflowRequestModel(
                edges={
                    "entry_to_tool_a": WorkflowEdgeModelInput(
                        source="entry_node",
                        target="tool_node_a",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "start_to_entry": WorkflowEdgeModelInput(
                        source="start_node",
                        target="entry_node",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "tool_a_to_failure": WorkflowEdgeModelInput(
                        source="tool_node_a",
                        target="failure_node",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "tool_a_to_tool_b": WorkflowEdgeModelInput(
                        source="tool_node_a",
                        target="tool_node_b",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "tool_b_to_agent_transfer": WorkflowEdgeModelInput(
                        source="tool_node_b",
                        target="success_transfer",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "tool_b_to_conversation": WorkflowEdgeModelInput(
                        source="tool_node_b",
                        target="success_conversation",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "tool_b_to_end": WorkflowEdgeModelInput(
                        source="tool_node_b",
                        target="success_end",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                    "tool_b_to_phone": WorkflowEdgeModelInput(
                        source="tool_node_b",
                        target="success_phone",
                        forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                            expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                children=[
                                    AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                        value=True,
                                    )
                                ],
                            ),
                        ),
                    ),
                },
                nodes={
                    "entry_node": AgentWorkflowRequestModelNodesValue_End(),
                    "failure_node": AgentWorkflowRequestModelNodesValue_End(),
                    "start_node": AgentWorkflowRequestModelNodesValue_End(),
                    "success_conversation": AgentWorkflowRequestModelNodesValue_End(),
                    "success_end": AgentWorkflowRequestModelNodesValue_End(),
                    "success_phone": AgentWorkflowRequestModelNodesValue_End(),
                    "success_transfer": AgentWorkflowRequestModelNodesValue_End(),
                    "tool_node_a": AgentWorkflowRequestModelNodesValue_End(),
                    "tool_node_b": AgentWorkflowRequestModelNodesValue_End(),
                },
            ),
            name="name",
        )
        r    r!   r"   r#   r$   r   r   r   createdata
r   r   r    r!   r"   r#   r$   r   r   	_responses
             r   r(   zDraftsClient.create   sD    x $$++ 3/+ , 	
	 ~~r   r   c                V    | j                   j                  |||      }|j                  S )a  
        Delete a draft for an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        branch_id : str
            The ID of the agent branch to use

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.agents.drafts.delete(
            agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
            branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj",
        )
        r    r   r   deleter)   r   r   r    r   r+   s        r   r0   zDraftsClient.delete   s-    D $$++H	[j+k	~~r   )__name__
__module____qualname__r   r   propertyr
   r   OMITstrtypingDictAnyr   OptionalSequencer   r(   r0    r   r   r   r      s   J*; J  ?    & 7;;?FF 	F
 $[[fjj9F ";;sFJJ7F ,F F oofooc23F  8F 
FR dh##+.#AGQ_A`#	#r   r   c                   t   e Zd ZdefdZedefd       Zeddde	de	d	e
j                  e	e
j                  f   d
e
j                  e	e
j                  f   dede	de
j                  e
j                  e	      de
j                  e   de
j                  fdZddde	de	de
j                  e   de
j                  fdZy)AsyncDraftsClientr   c                &    t        |      | _        y r   )r	   r   r   s     r   r   zAsyncDraftsClient.__init__  s    /~Nr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawDraftsClient
        r   r   s    r   r   z#AsyncDraftsClient.with_raw_response  r   r   Nr   r   r    r!   r"   r#   r$   r   r   c          
      |   K   | j                   j                  ||||||||       d{   }	|	j                  S 7 w)a!  
        Create a new draft for an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        branch_id : str
            The ID of the agent branch to use

        conversation_config : typing.Dict[str, typing.Any]
            Conversation config for the draft

        platform_settings : typing.Dict[str, typing.Any]
            Platform settings for the draft

        workflow : AgentWorkflowRequestModel
            Workflow for the draft

        name : str
            Name for the draft

        tags : typing.Optional[typing.Sequence[str]]
            Tags to help classify and filter the agent

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import (
            AgentWorkflowRequestModel,
            AgentWorkflowRequestModelNodesValue_End,
            AstAndOperatorNodeInputChildrenItem_BooleanLiteral,
            AsyncElevenLabs,
            WorkflowEdgeModelInput,
            WorkflowEdgeModelInputForwardCondition_Expression,
            WorkflowExpressionConditionModelInputExpression_AndOperator,
        )

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.agents.drafts.create(
                agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
                branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj",
                conversation_config={"key": "value"},
                platform_settings={"key": "value"},
                workflow=AgentWorkflowRequestModel(
                    edges={
                        "entry_to_tool_a": WorkflowEdgeModelInput(
                            source="entry_node",
                            target="tool_node_a",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "start_to_entry": WorkflowEdgeModelInput(
                            source="start_node",
                            target="entry_node",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "tool_a_to_failure": WorkflowEdgeModelInput(
                            source="tool_node_a",
                            target="failure_node",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "tool_a_to_tool_b": WorkflowEdgeModelInput(
                            source="tool_node_a",
                            target="tool_node_b",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "tool_b_to_agent_transfer": WorkflowEdgeModelInput(
                            source="tool_node_b",
                            target="success_transfer",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "tool_b_to_conversation": WorkflowEdgeModelInput(
                            source="tool_node_b",
                            target="success_conversation",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "tool_b_to_end": WorkflowEdgeModelInput(
                            source="tool_node_b",
                            target="success_end",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                        "tool_b_to_phone": WorkflowEdgeModelInput(
                            source="tool_node_b",
                            target="success_phone",
                            forward_condition=WorkflowEdgeModelInputForwardCondition_Expression(
                                expression=WorkflowExpressionConditionModelInputExpression_AndOperator(
                                    children=[
                                        AstAndOperatorNodeInputChildrenItem_BooleanLiteral(
                                            value=True,
                                        )
                                    ],
                                ),
                            ),
                        ),
                    },
                    nodes={
                        "entry_node": AgentWorkflowRequestModelNodesValue_End(),
                        "failure_node": AgentWorkflowRequestModelNodesValue_End(),
                        "start_node": AgentWorkflowRequestModelNodesValue_End(),
                        "success_conversation": AgentWorkflowRequestModelNodesValue_End(),
                        "success_end": AgentWorkflowRequestModelNodesValue_End(),
                        "success_phone": AgentWorkflowRequestModelNodesValue_End(),
                        "success_transfer": AgentWorkflowRequestModelNodesValue_End(),
                        "tool_node_a": AgentWorkflowRequestModelNodesValue_End(),
                        "tool_node_b": AgentWorkflowRequestModelNodesValue_End(),
                    },
                ),
                name="name",
            )


        asyncio.run(main())
        r&   Nr'   r*   s
             r   r(   zAsyncDraftsClient.create  sR     H **11 3/+ 2 	
 	
	 ~~	
s   '<:<r,   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a~  
        Delete a draft for an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        branch_id : str
            The ID of the agent branch to use

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.agents.drafts.delete(
                agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
                branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj",
            )


        asyncio.run(main())
        r.   Nr/   r1   s        r   r0   zAsyncDraftsClient.delete  s:     T **11(iap1qq	~~ rs   "757)r2   r3   r4   r   r   r5   r	   r   r6   r7   r8   r9   r:   r   r;   r<   r   r(   r0   r=   r   r   r?   r?     s   O*< O  #7    & 7;;?NN 	N
 $[[fjj9N ";;sFJJ7N ,N N oofooc23N  8N 
Nb dh+++.+AGQ_A`+	+r   r?   )r8   core.client_wrapperr   r   core.request_optionsr   "types.agent_workflow_request_modelr   
raw_clientr	   r
   castr:   r6   r   r?   r=   r   r   <module>rI      sG     I 3 L = v{{6::s#z zzJ Jr   