
    b6iDn                     B   d dl Z d dlmZ ddlmZ ddl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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 jJ                  e jL                  d      Z' G d d      Z( G d d      Z)y)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)CreateAgentTestResponseModel)GetTestsPageResponseModel)#GetTestsSummariesByIdsResponseModel)HttpValidationError   )TestsCreateRequestBody)TestsGetResponse)TestsUpdateRequestBody)TestsUpdateResponse.c                      e Zd ZdefdZdddedej                  e   de	e
   fdZddd	edej                  e   de	e   fd
Zddd	ededej                  e   de	e   fdZddd	edej                  e   de	ej$                     fdZdddej(                  e   dej                  e   de	e   fdZddddddej                  e   dej                  e   dej                  e   dej                  e   de	e   f
dZy)RawTestsClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     x/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/conversational_ai/tests/raw_client.py__init__zRawTestsClient.__init__   
    -    Nrequest_optionsrequestr&   returnc                    | j                   j                  j                  ddt        |t        d      ddi|t
              }	 d|j                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t         t        t         |j                         
                  |j                         }t%        |j                  t        |j                        |      # t"        $ r6 t%        |j                  t        |j                        |j&                        w xY w)a_  
        Creates a new agent response test.

        Parameters
        ----------
        request : TestsCreateRequestBody

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

        Returns
        -------
        HttpResponse[CreateAgentTestResponseModel]
            Successful Response
        v1/convai/agent-testing/createPOSTwriteobject_
annotation	directioncontent-typeapplication/jsonmethodjsonheadersr&   omit   ,  type_r.   responsedata  r6   bodystatus_coder6   rA   )r   httpx_clientr'   r   r   OMITrC   typingcastr   r   r5   r	   r   dictr6   r   r   r   textr    r'   r&   	_response_data_response_jsons         r!   createzRawTestsClient.create   sV   $ ((55==,8,Bg  2 , > 
		ti++1c10": ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD> A4D> >?E=test_idc                   | j                   j                  j                  dt        |       d|      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                                     	      |j                         }t!        |j                  t        |j                        |
      # t        $ r6 t!        |j                  t        |j                        |j"                  
      w xY w)a  
        Gets an agent response test by ID.

        Parameters
        ----------
        test_id : str
            The id of a chat response test. This is returned on test creation.

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

        Returns
        -------
        HttpResponse[TestsGetResponse]
            Successful Response
        v1/convai/agent-testing/GETr4   r&   r8   r9   r:   r<   r?   r@   rB   )r   rD   r'   r
   rC   rF   rG   r   r   r5   r	   r   rH   r6   r   r   r   rI   r    rO   r&   rK   rL   rM   s         r!   getzRawTestsClient.getW   sB   & ((55==&'7'@&AB+ > 
	
	ti++1c1$". ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD1 A4D1 1?E0c                   | j                   j                  j                  dt        |       dt	        |t
        d      ddi|t              }	 d|j                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                  dk(  rUt        t        |j                         t        j                  t"        t        t"        |j                         
                  |j                         }t'        |j                  t        |j                         |      # t$        $ r6 t'        |j                  t        |j                         |j(                        w xY w)a  
        Updates an agent response test by ID.

        Parameters
        ----------
        test_id : str
            The id of a chat response test. This is returned on test creation.

        request : TestsUpdateRequestBody

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

        Returns
        -------
        HttpResponse[TestsUpdateResponse]
            Successful Response
        rQ   PUTr,   r-   r1   r2   r3   r8   r9   r:   r<   r?   r@   rB   )r   rD   r'   r
   r   r   rE   rC   rF   rG   r   r   r5   r	   r   rH   r6   r   r   r   rI   r    rO   r'   r&   rK   rL   rM   s          r!   updatezRawTestsClient.update   sd   * ((55==&'7'@&AB8,Bg  2 , > 
		ti++1c1'"1 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AE
 +A4E
 
?F	c                `   | j                   j                  j                  dt        |       d|      }	 ||j                  j                         st        |d      S d|j                  cxk  rdk  r[n nXt        j                  t        j                  t        t        j                  |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t        j                  t         t        t         |j                                     
      |j                         }t%        |j                  t        |j                        |      # t"        $ r6 t%        |j                  t        |j                        |j                        w xY w)a  
        Deletes an agent response test by ID.

        Parameters
        ----------
        test_id : str
            The id of a chat response test. This is returned on test creation.

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

        Returns
        -------
        HttpResponse[typing.Any]
            Successful Response
        rQ   DELETErS   Nr<   r8   r9   r:   r?   r@   rB   )r   rD   r'   r
   rI   stripr	   rC   rF   rG   Anyr   r5   r   rH   r6   r   r   r   rT   s         r!   deletezRawTestsClient.delete   sl   & ((55==&'7'@&AB+ > 
	
	t 	(<(<(>#YTBBi++1c1JJ"$jj ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   (E. A/E. A4E. .?F-test_idsc                   | j                   j                  j                  ddd|iddi|t              }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                         	            }t        ||
      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         	                  |j                         }t!        |j                  t        |j                        |      # t        $ r6 t!        |j                  t        |j                        |j"                        w xY w)a  
        Gets multiple agent response tests by their IDs. Returns a dictionary mapping test IDs to test summaries.

        Parameters
        ----------
        test_ids : typing.Sequence[str]
            List of test IDs to fetch. No duplicates allowed.

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

        Returns
        -------
        HttpResponse[GetTestsSummariesByIdsResponseModel]
            Successful Response
        !v1/convai/agent-testing/summariesr+   r_   r1   r2   r3   r8   r9   r:   r<   r?   r@   rB   )r   rD   r'   rE   rC   rF   rG   r   r   r5   r	   r   rH   r6   r   r   r   rI   r    r_   r&   rK   rL   rM   s         r!   	summarieszRawTestsClient.summaries   sP   & ((55==/H  2 , > 
		ti++1c17"A ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD0 A4D0 0?E/cursor	page_sizesearchr&   re   rf   rg   c                   | j                   j                  j                  dd|||d|      }	 d|j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t	        j
                  t        t        t        |j                                     
      |j                         }t        |j                  t        |j                        |      # t        $ r6 t        |j                  t        |j                        |j                         w xY w)a  
        Lists all agent response tests with pagination support and optional search filtering.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        page_size : typing.Optional[int]
            How many Tests to return at maximum. Can not exceed 100, defaults to 30.

        search : typing.Optional[str]
            Search query to filter tests by name.

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

        Returns
        -------
        HttpResponse[GetTestsPageResponseModel]
            Successful Response
        v1/convai/agent-testingrR   re   rf   rg   r4   paramsr&   r8   r9   r:   r<   r?   r@   rB   )r   rD   r'   rC   rF   rG   r   r   r5   r	   r   rH   r6   r   r   r   rI   r    re   rf   rg   r&   rK   rL   rM   s           r!   listzRawTestsClient.list1  sD   < ((55==% & 
 , > 	
		ti++1c1-"7 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD* A4D* *?E))__name__
__module____qualname__r   r"   r   rF   Optionalr   r	   r   rN   strr   rU   r   r   rY   r]   r^   Sequencer   rc   intr   rn    r$   r!   r   r      s   .*; . fj6p06pCI??SaCb6p	2	36pr SW0p0p060O0p	&	'0pf tx9p9p(>9pQWQ`Q`aoQp9p	)	*9px SW2p2p060O2p	fjj	!2pj ei7p!??3/7pBH//R`Ba7p	9	:7px (,*.'+;?@p $@p ??3'	@p
 $@p  8@p 
/	0@pr$   r   c                      e Zd ZdefdZdddedej                  e   de	e
   fdZddd	edej                  e   de	e   fd
Zddd	ededej                  e   de	e   fdZddd	edej                  e   de	ej$                     fdZdddej(                  e   dej                  e   de	e   fdZddddddej                  e   dej                  e   dej                  e   dej                  e   de	e   f
dZy)AsyncRawTestsClientr   c                    || _         y r   r   r   s     r!   r"   zAsyncRawTestsClient.__init__u  r#   r$   Nr%   r'   r&   r(   c                  K   | j                   j                  j                  ddt        |t        d      ddi|t
               d{   }	 d	|j                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t         t        t         |j                                           |j                         }t%        |j                  t        |j                        |      7 # t"        $ r6 t%        |j                  t        |j                        |j&                        w xY ww)ad  
        Creates a new agent response test.

        Parameters
        ----------
        request : TestsCreateRequestBody

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

        Returns
        -------
        AsyncHttpResponse[CreateAgentTestResponseModel]
            Successful Response
        r*   r+   r,   r-   r1   r2   r3   Nr8   r9   r:   r<   r?   r@   rB   )r   rD   r'   r   r   rE   rC   rF   rG   r   r   r5   r   r   rH   r6   r   r   r   rI   rJ   s         r!   rN   zAsyncRawTestsClient.createx  sf    $ ..;;CC,8,Bg  2 , D 
 
		ti++1c10": ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooI
D  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFEFAE (F)A4E ,F?F

FrO   c                  K   | j                   j                  j                  dt        |       d|       d{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t        j                  t        t        t        |j                                     
      |j                         }t!        |j                  t        |j                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)a  
        Gets an agent response test by ID.

        Parameters
        ----------
        test_id : str
            The id of a chat response test. This is returned on test creation.

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

        Returns
        -------
        AsyncHttpResponse[TestsGetResponse]
            Successful Response
        rQ   rR   rS   Nr8   r9   r:   r<   r?   r@   rB   )r   rD   r'   r
   rC   rF   rG   r   r   r5   r   r   rH   r6   r   r   r   rI   rT   s         r!   rU   zAsyncRawTestsClient.get  sP    & ..;;CC&'7'@&AB+ D 
 
	
	ti++1c1$". ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	ts5   8F D;F  AD> F A4D> ,F >?E==F c                6  K   | j                   j                  j                  dt        |       dt	        |t
        d      ddi|t               d{   }	 d	|j                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t        |j                         t        j                  t"        t        t"        |j                                           |j                         }t'        |j                  t        |j                         |      7 # t$        $ r6 t'        |j                  t        |j                         |j(                        w xY ww)a  
        Updates an agent response test by ID.

        Parameters
        ----------
        test_id : str
            The id of a chat response test. This is returned on test creation.

        request : TestsUpdateRequestBody

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

        Returns
        -------
        AsyncHttpResponse[TestsUpdateResponse]
            Successful Response
        rQ   rW   r,   r-   r1   r2   r3   Nr8   r9   r:   r<   r?   r@   rB   )r   rD   r'   r
   r   r   rE   rC   rF   rG   r   r   r5   r   r   rH   r6   r   r   r   rI   rX   s          r!   rY   zAsyncRawTestsClient.update  st    * ..;;CC&'7'@&AB8,Bg  2 , D 
 
		ti++1c1'"1 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooI
D  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFEFAE 4F5A4E ),F?FFc                ~  K   | j                   j                  j                  dt        |       d|       d{   }	 ||j                  j                         st        |d      S d|j                  cxk  rdk  r[n nXt        j                  t        j                  t        t        j                  |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t        j                  t         t        t         |j                                     
      |j                         }t%        |j                  t        |j                        |      7 ># t"        $ r6 t%        |j                  t        |j                        |j                        w xY ww)a  
        Deletes an agent response test by ID.

        Parameters
        ----------
        test_id : str
            The id of a chat response test. This is returned on test creation.

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

        Returns
        -------
        AsyncHttpResponse[typing.Any]
            Successful Response
        rQ   r[   rS   Nr<   r8   r9   r:   r?   r@   rB   )r   rD   r'   r
   rI   r\   r   rC   rF   rG   r]   r   r5   r   rH   r6   r   r   r   rT   s         r!   r^   zAsyncRawTestsClient.delete  sz    & ..;;CC&'7'@&AB+ D 
 
	
	t 	(<(<(>()$GGi++1c1JJ"$jj ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo?
:  	ty'<'<d9K\K\F]dmdrdrss	tsA   8F=E8F= (E; (F=)A/E; F=A4E; ,F=;?F::F=r_   c                  K   | j                   j                  j                  ddd|iddi|t               d{   }	 d|j                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         
                  |j                         }t!        |j                  t        |j                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)a  
        Gets multiple agent response tests by their IDs. Returns a dictionary mapping test IDs to test summaries.

        Parameters
        ----------
        test_ids : typing.Sequence[str]
            List of test IDs to fetch. No duplicates allowed.

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

        Returns
        -------
        AsyncHttpResponse[GetTestsSummariesByIdsResponseModel]
            Successful Response
        ra   r+   r_   r1   r2   r3   Nr8   r9   r:   r<   r?   r@   rB   )r   rD   r'   rE   rC   rF   rG   r   r   r5   r   r   rH   r6   r   r   r   rI   rb   s         r!   rc   zAsyncRawTestsClient.summariesQ  s`    & ..;;CC/H  2 , D 
 
		ti++1c17"A ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooI
D  	ty'<'<d9K\K\F]dmdrdrss	ts4   7E?D:E?AD= E?A4D= ,E?=?E<<E?rd   re   rf   rg   c                  K   | j                   j                  j                  dd|||d|       d{   }	 d|j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |j                                     }t        ||	      S |j                  d
k(  rUt        t        |j                        t	        j
                  t        t        t        |j                                           |j                         }t        |j                  t        |j                        |      7 # t        $ r6 t        |j                  t        |j                        |j                         w xY ww)a  
        Lists all agent response tests with pagination support and optional search filtering.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        page_size : typing.Optional[int]
            How many Tests to return at maximum. Can not exceed 100, defaults to 30.

        search : typing.Optional[str]
            Search query to filter tests by name.

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

        Returns
        -------
        AsyncHttpResponse[GetTestsPageResponseModel]
            Successful Response
        ri   rR   rj   rk   Nr8   r9   r:   r<   r?   r@   rB   )r   rD   r'   rC   rF   rG   r   r   r5   r   r   rH   r6   r   r   r   rI   rm   s           r!   rn   zAsyncRawTestsClient.list  sT    < ..;;CC% & 
 , D 	
 	
		ti++1c1-"7 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooE	
@  	ty'<'<d9K\K\F]dmdrdrss	ts4   1E9D4E9AD7 E9A4D7 	,E97?E66E9)ro   rp   rq   r   r"   r   rF   rr   r   r   r   rN   rs   r   rU   r   r   rY   r]   r^   rt   r   rc   ru   r   rn   rv   r$   r!   rx   rx   t  s   .*< . fj6p06pCI??SaCb6p	7	86pr SW0p0p060O0p	+	,0pf tx9p9p(>9pQWQ`Q`aoQp9p	.	/9px SW2p2p060O2p	6::	&2pj ei7p!??3/7pBH//R`Ba7p	>	?7px (,*.'+;?@p $@p ??3'	@p
 $@p  8@p 
4	5@pr$   rx   )*rF   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.jsonable_encoderr
   core.request_optionsr   core.serializationr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   &types.create_agent_test_response_modelr   #types.get_tests_page_response_modelr   /types.get_tests_summaries_by_ids_response_modelr   types.http_validation_errorr   types.tests_create_request_bodyr   types.tests_get_responser   types.tests_update_request_bodyr   types.tests_update_responser   rG   r]   rE   r   rx   rv   r$   r!   <module>r      sr     ( & H A 5 2 I 7 I R L b > C 6 C < v{{6::s#Vp Vpr
Vp Vpr$   