Skip to content

Commit

Permalink
Merge pull request #14 from confident-ai/main
Browse files Browse the repository at this point in the history
merge from main.
  • Loading branch information
Anindyadeep authored Nov 19, 2023
2 parents a748939 + fc1520f commit 579d5d9
Show file tree
Hide file tree
Showing 50 changed files with 1,443 additions and 1,627 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/deepeval-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction

- name: Run tests without pytest
run: poetry run python tests/test_without_pytest.py

- name: Run deepeval tests and capture output
run: poetry run deepeval test run tests/test_quickstart.py > output.txt 2>&1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
poetry run pytest tests/ --ignore=tests/test_llm_metric.py --ignore=tests/test_overall_score.py
poetry run pytest tests/ --ignore=tests/test_llm_metric.py
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ from deepeval.evaluator import assert_test

def test_case():
input = "What if these shoes don't fit?"
context = "All customers are eligible for a 30 day full refund at no extra costs."
context = ["All customers are eligible for a 30 day full refund at no extra costs."]

# Replace this with the actual output from your LLM application
actual_output = "We offer a 30-day full refund at no extra costs."
Expand Down Expand Up @@ -118,7 +118,7 @@ deepeval test run test_chatbot.py

You should see a link displayed in the CLI once the test has finished running. Paste it into your browser to view the results!

![ok](https://d2lsxfc3p6r9rv.cloudfront.net/dashboard.png)
![ok](https://d2lsxfc3p6r9rv.cloudfront.net/test-summary.png)

<br />

Expand Down
2 changes: 1 addition & 1 deletion deepeval/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "0.20.17"
__version__: str = "0.20.19"
63 changes: 0 additions & 63 deletions deepeval/cli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import typer
import os
from typing_extensions import Annotated
from deepeval.metrics.overall_score import assert_overall_score
from .cli_key_handler import set_env_vars
from typing import Optional
from deepeval.test_run import test_run_manager, TEMP_FILE_NAME
from deepeval.utils import delete_file_if_exists
Expand All @@ -17,67 +15,6 @@
app = typer.Typer(name="test")


def sample():
set_env_vars()
print("Sending sample test results...")
print(
"If this is your first time running these models, it may take a while."
)
try:
query = "How does photosynthesis work?"
output = "Photosynthesis is the process by which green plants and some other organisms use sunlight to synthesize foods with the help of chlorophyll pigment."
expected_output = "Photosynthesis is the process by which green plants and some other organisms use sunlight to synthesize food with the help of chlorophyll pigment."
context = "Biology"

assert_overall_score(query, output, expected_output, context)

except AssertionError as e:
pass
try:
query = "What is the capital of France?"
output = "The capital of France is Paris."
expected_output = "The capital of France is Paris."
context = "Geography"

assert_overall_score(query, output, expected_output, context)

except AssertionError as e:
pass
try:
query = "What are the major components of a cell?"
output = "Cells have many major components, including the cell membrane, nucleus, mitochondria, and endoplasmic reticulum."
expected_output = "Cells have several major components, such as the cell membrane, nucleus, mitochondria, and endoplasmic reticulum."
context = "Biology"
minimum_score = 0.8 # Adjusting the minimum score threshold

assert_overall_score(
query, output, expected_output, context, minimum_score
)

except AssertionError as e:
pass

try:
query = "What is the capital of Japan?"
output = "The largest city in Japan is Tokyo."
expected_output = "The capital of Japan is Tokyo."
context = "Geography"

assert_overall_score(query, output, expected_output, context)
except AssertionError as e:
pass

try:
query = "Explain the theory of relativity."
output = "Einstein's theory of relativity is famous."
expected_output = "Einstein's theory of relativity revolutionized our understanding of space, time, and gravity."
context = "Physics"

assert_overall_score(query, output, expected_output, context)
except AssertionError as e:
pass


def check_if_valid_file(test_file_or_directory: str):
if "::" in test_file_or_directory:
test_file_or_directory, test_case = test_file_or_directory.split("::")
Expand Down
Loading

0 comments on commit 579d5d9

Please sign in to comment.