-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No test cases found error #739
Comments
Hey @GantaVenkataKousik there is some formatting errors in your code can you double check your backticks. You're getting this error because you're using |
I have reviewed the documentation, but I'm still unable to identify the issue. These are the screenshots of the code . |
Hey @GantaVenkataKousik I missed your message, can you come to our discord for faster response times? https://discord.com/invite/a3K9c8GRGt
|
Sure , I will join discord . |
See this code:
`import json
import asyncio
from deepeval.metrics import AnswerRelevancyMetric, SummarizationMetric, HallucinationMetric
from deepeval.test_case import LLMTestCase
from deepeval import assert_test
import os
import openai # Import OpenAI library
Initialize OpenAI API key
os.environ["OPENAI_API_KEY"] = "MY_OPEN_AI_KEY"
Function to retrieve summary asynchronously (replace with actual implementation)
async def get_summary(input_text):
# Call the OpenAI chatbot to generate a response
response = openai.Completion.create(
engine="text-davinci-003", # Specify the engine to use
prompt=input_text,
max_tokens=150 # Specify the maximum number of tokens for the response
)
return response.choices[0].text.strip()
Function to read questions from JSON file
def read_questions_from_json(file_path):
with open(file_path, 'r') as file:
data = json.load(file)
questions = [item['question'] for item in data['questions']]
return questions
Function to perform analysis
async def perform_analysis(test_cases):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
async def create_test_cases(medical_questions, answers, context):
test_cases = []
tasks = []
Function to retrieve summary asynchronously and create test case
async def get_summary_and_create_test_case(prompt, expected_output, context, test_cases):
actual_output = await get_summary(prompt)
test_case = LLMTestCase(
input=prompt,
actual_output=actual_output,
expected_output=expected_output,
context=context,
metric=HallucinationMetric(threshold=0.7)
)
test_cases.append(test_case)
Main function
async def main():
# Path to the JSON file containing medical questions
file_path = "medical_questions.json"
if name == "main":
main()
`
OUTPUT :
`plugins: deepeval-0.21.36, anyio-4.3.0, repeat-0.9.3, xdist-3.6.1
collected 0 items
Running teardown with pytest sessionfinish...
=========================================================================== 2 warnings in 0.01s ===========================================================================
No test cases found, please try again.`
The text was updated successfully, but these errors were encountered: