o
    /ife                     @   s   d dl Z d dlmZ d dlmZmZmZmZmZm	Z	 d dl
mZ d dlmZmZ dZdZdZg d	Ze jjd
ddd Ze jjd
ddd ZdS )    N)LLMTestCase)RagasMetricRAGASContextualPrecisionMetricRAGASContextualRelevancyMetricRAGASFaithfulnessMetricRAGASContextualRecallMetricRAGASAnswerRelevancyMetric)assert_test)OpenAIEmbeddings
ChatOpenAIz:Who won the FIFA World Cup in 2018 and what was the score?zDWinners of the FIFA world cup were the French national football teamzFrench national football team)zHThe FIFA World Cup in 2018 was won by the French national football team.z
I am birdyzI am a froggyzRThe French defeated Croatia 4-2 in the final FIFA match to claim the championship.zopenai is expensive)reasonc                  C   sV   t ttttd} t }tt t	| g|gd W d    d S 1 s$w   Y  d S )N)inputactual_outputexpected_outputcontext)	test_casemetrics)
r   queryoutputr   r   r   pytestraisesAssertionErrorr	   )r   metric r   I/var/www/html/corbot_env/lib/python3.10/site-packages/tests/test_ragas.pytest_ragas_score   s   "r   c                  C   sd   t dd} ttttttd}t }t }t }t	| d}t
 }ttdd| d}t||||g d S )Nztext-embedding-3-large)model)r   r   r   retrieval_contextr   )
embeddingszgpt-3.5-turbo)
model_name)r   r   )r
   r   r   r   r   r   r   r   r   r   r   r   r   r	   )r   r   metric1metric2metric3metric8metric9metric10r   r   r   test_everything*   s.   


r&   )r   deepeval.test_caser   deepeval.metrics.ragasr   r   r   r   r   r   deepevalr	   langchain_openair
   r   r   r   r   r   markskipr   r&   r   r   r   r   <module>   s     
