o
    /ifu                     @   s  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
 d dlmZ d dlZe jddZ	e	je
d	d e	 d
e jddddde jdddddfdeee jddf dee dee fddZe	jdde jdddde jdddde jddd de jdd!d"de jdd#d$dfd%ed&ed'ed(ed)ee f
d*d+Ze	jd,de jdd-d.dfd/efd0d1Ze	jd2dd3d4 Zed5kre	  dS dS )6    N)	Annotated)print)KEY_FILE_HANDLER	KeyValues)app)Optionaldeepeval)nametest z--confident-api-keyz-cz+Optional confident API key to bypass login.)helpFz--use-existingz-uz;Use the existing API key stored in the key file if present.api_keyzcAPI key to get from https://app.confident-ai.com. Required if you want to log events to the server.confident_api_keyuse_existingc                 C   s   |rt tj}|rtd |r|} n!	 td td td | dkr4	 td } | r/ntd q&t 	tj|  td	 td
 d S )NzUsing existing API key.z!Welcome to [bold]DeepEval[/bold]!ziLogin and grab your API key here: [link=https://app.confident-ai.com]https://app.confident-ai.com[/link] zhttps://app.confident-ai.comr   TzPaste your API Key: z+API Key cannot be empty. Please try again.
z2Congratulations! Login successful :raising_hands: zIf you are new to DeepEval, follow our quickstart tutorial here: [bold][link=https://docs.confident-ai.com/docs/getting-started]https://docs.confident-ai.com/docs/getting-started[/link][/bold])
r   
fetch_datar   API_KEYr   
webbrowseropeninputstrip	write_key)r   r   r    r   J/var/www/html/corbot_env/lib/python3.10/site-packages/deepeval/cli/main.pylogin   s0   
r   zset-azure-openai.z--openai-api-keyzAzure OpenAI API keyz--openai-endpointzAzure OpenAI endpointz--openai-api-versionzOpenAI API versionz--deployment-namezAzure deployment namez--model-versionzAzure model version (optional)azure_openai_api_keyazure_openai_endpointopenai_api_versionazure_deployment_nameazure_model_versionc                 C   sh   t tj|  t tj| t tj| t tj| |d ur't tj| t tjd t	d d S )NYESza:raising_hands: Congratulations! You're now using Azure OpenAI for all evals that require an LLM.)
r   r   r   AZURE_OPENAI_API_KEYAZURE_OPENAI_ENDPOINTOPENAI_API_VERSIONAZURE_DEPLOYMENT_NAMEAZURE_MODEL_VERSIONUSE_AZURE_OPENAIr   )r   r   r   r   r   r   r   r   set_azure_openai_envB   s$   r&   zset-azure-openai-embeddingz--embedding-deployment-namezAzure embedding deployment nameazure_embedding_deployment_namec                 C   s   t tj|  td d S )NzZ:raising_hands: Congratulations! You're now using Azure OpenAI Embeddings within DeepEval.)r   r   r   AZURE_EMBEDDING_DEPLOYMENT_NAMEr   )r'   r   r   r   set_azure_openai_embedding_envk   s   r)   zunset-azure-openaic                   C   s`   t tj t tj t tj t tj t tj t tj t tj	 t
d d S )Nzc:raising_hands: Congratulations! You're now using regular OpenAI for all evals that require an LLM.)r   
remove_keyr   r    r!   r"   r#   r(   r$   r%   r   r   r   r   r   unset_azure_openai_env}   s   r+   __main__)typertyping_extensionsr   richr   deepeval.key_handlerr   r   deepeval.cli.testr   test_apptypingr   r   Typer	add_typercommandOptionstrboolr   r&   r)   r+   __name__r   r   r   r   <module>   s    
2

(


