Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions deepeval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ def _expose_public_api() -> None:
# Do not do this at module level or ruff will complain with E402
global __version__, evaluate, assert_test, compare
global on_test_run_end, log_hyperparameters, login, telemetry
global AsyncConfig, DisplayConfig, CacheConfig, ErrorConfig

from ._version import __version__ as _version
from deepeval.evaluate import (
evaluate as _evaluate,
assert_test as _assert_test,
)
from deepeval.evaluate.compare import compare as _compare
from deepeval.evaluate.configs import (
AsyncConfig as _AsyncConfig,
DisplayConfig as _DisplayConfig,
CacheConfig as _CacheConfig,
ErrorConfig as _ErrorConfig,
)
from deepeval.test_run import (
on_test_run_end as _on_end,
log_hyperparameters as _log_hparams,
Expand All @@ -35,6 +42,10 @@ def _expose_public_api() -> None:
evaluate = _evaluate
assert_test = _assert_test
compare = _compare
AsyncConfig = _AsyncConfig
DisplayConfig = _DisplayConfig
CacheConfig = _CacheConfig
ErrorConfig = _ErrorConfig
on_test_run_end = _on_end
log_hyperparameters = _log_hparams
login = _login
Expand All @@ -60,6 +71,10 @@ def _expose_public_api() -> None:
"assert_test",
"on_test_run_end",
"compare",
"AsyncConfig",
"DisplayConfig",
"CacheConfig",
"ErrorConfig",
]


Expand Down
12 changes: 4 additions & 8 deletions docs/docs/evaluation-flags-and-configs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ These flags control retry and backoff behavior for API calls.
The `AsyncConfig` controls how concurrently `metrics`, `observed_callback`, and `test_cases` will be evaluated during `evaluate()`.

```python
from deepeval.evaluate import AsyncConfig
from deepeval import evaluate
from deepeval import AsyncConfig, evaluate

evaluate(async_config=AsyncConfig(), ...)
```
Expand All @@ -92,8 +91,7 @@ The `throttle_value` and `max_concurrent` parameter is only used when `run_async
The `DisplayConfig` controls how results and intermediate execution steps are displayed during `evaluate()`.

```python
from deepeval.evaluate import DisplayConfig
from deepeval import evaluate
from deepeval import DisplayConfig, evaluate

evaluate(display_config=DisplayConfig(), ...)
```
Expand All @@ -111,8 +109,7 @@ There are **FOUR** optional parameters when creating an `DisplayConfig`:
The `ErrorConfig` controls how error is handled in `evaluate()`.

```python
from deepeval.evaluate import ErrorConfig
from deepeval import evaluate
from deepeval import ErrorConfig, evaluate

evaluate(error_config=ErrorConfig(), ...)
```
Expand All @@ -129,8 +126,7 @@ If both `skip_on_missing_params` and `ignore_errors` are set to `True`, `skip_on
The `CacheConfig` controls the caching behavior of `evaluate()`.

```python
from deepeval.evaluate import CacheConfig
from deepeval import evaluate
from deepeval import CacheConfig, evaluate

evaluate(cache_config=CacheConfig(), ...)
```
Expand Down
19 changes: 19 additions & 0 deletions tests/test_core/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,25 @@ def test_evaluate_imports():
assert CacheConfig is not None
assert ErrorConfig is not None

# Test that config classes can also be imported directly from deepeval (Issue #2216)
from deepeval import (
AsyncConfig as AsyncConfig2,
DisplayConfig as DisplayConfig2,
CacheConfig as CacheConfig2,
ErrorConfig as ErrorConfig2,
)

assert AsyncConfig2 is not None
assert DisplayConfig2 is not None
assert CacheConfig2 is not None
assert ErrorConfig2 is not None

# Verify they are the same classes
assert AsyncConfig is AsyncConfig2
assert DisplayConfig is DisplayConfig2
assert CacheConfig is CacheConfig2
assert ErrorConfig is ErrorConfig2


def test_dataset_imports():
"""Test that dataset classes can be imported."""
Expand Down
Loading