pytest-llm-assert 0.1.1__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/PKG-INFO +1 -1
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/pyproject.toml +1 -1
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/core.py +24 -23
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/uv.lock +1 -1
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.env.example +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/CODEOWNERS +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/dependabot.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/ci.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/codeql.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/dependency-review.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/release.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/stale.yml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.gitignore +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.pre-commit-config.yaml +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/CODE_OF_CONDUCT.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/CONTRIBUTING.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/LICENSE +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/README.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/SECURITY.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/GITHUB_SETUP_GUIDE.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/README.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/api-reference.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/comparing-models.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/configuration.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/README.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/conftest.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/pytest_conftest.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/test_basic.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/test_compare_models.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/__init__.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/plugin.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/prompts/system_prompt.md +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/__init__.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/integration/__init__.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/integration/test_llm_integration.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/__init__.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_assertion_result.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_azure_auth.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_error_handling.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_fixture_integration.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_llm_assert_core.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_llm_response.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_plugin.py +0 -0
- {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_response_parsing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-llm-assert
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Simple LLM-powered assertions for any pytest test
|
|
5
5
|
Project-URL: Homepage, https://github.com/sbroenne/pytest-llm-assert
|
|
6
6
|
Project-URL: Documentation, https://github.com/sbroenne/pytest-llm-assert#readme
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import functools
|
|
6
5
|
import json
|
|
7
6
|
import os
|
|
8
7
|
import re
|
|
@@ -20,27 +19,6 @@ if TYPE_CHECKING:
|
|
|
20
19
|
from typing import Any
|
|
21
20
|
|
|
22
21
|
|
|
23
|
-
@functools.cache
|
|
24
|
-
def _get_azure_ad_token_provider() -> Callable[[], str] | None:
|
|
25
|
-
"""Get Azure AD token provider for Entra ID authentication.
|
|
26
|
-
|
|
27
|
-
Uses LiteLLM's built-in helper which leverages DefaultAzureCredential.
|
|
28
|
-
Cached at module level to avoid recreating credentials on each call.
|
|
29
|
-
"""
|
|
30
|
-
try:
|
|
31
|
-
from litellm.secret_managers.get_azure_ad_token_provider import (
|
|
32
|
-
get_azure_ad_token_provider,
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
return get_azure_ad_token_provider()
|
|
36
|
-
except ImportError:
|
|
37
|
-
# azure-identity not installed
|
|
38
|
-
return None
|
|
39
|
-
except Exception:
|
|
40
|
-
# Credential not available
|
|
41
|
-
return None
|
|
42
|
-
|
|
43
|
-
|
|
44
22
|
@dataclass(slots=True)
|
|
45
23
|
class LLMResponse:
|
|
46
24
|
"""Response details from the last LLM call.
|
|
@@ -115,7 +93,7 @@ class LLMAssert:
|
|
|
115
93
|
|
|
116
94
|
# Auto-configure Azure Entra ID when no API key is provided
|
|
117
95
|
if self._is_azure_model() and not self._has_azure_api_key():
|
|
118
|
-
self._azure_ad_token_provider = _get_azure_ad_token_provider()
|
|
96
|
+
self._azure_ad_token_provider = self._get_azure_ad_token_provider()
|
|
119
97
|
|
|
120
98
|
def _is_azure_model(self) -> bool:
|
|
121
99
|
"""Check if the model is an Azure OpenAI model."""
|
|
@@ -125,6 +103,29 @@ class LLMAssert:
|
|
|
125
103
|
"""Check if an Azure API key is available."""
|
|
126
104
|
return bool(self.api_key or os.environ.get("AZURE_API_KEY"))
|
|
127
105
|
|
|
106
|
+
@staticmethod
|
|
107
|
+
def _get_azure_ad_token_provider() -> Callable[[], str] | None:
|
|
108
|
+
"""Get Azure AD token provider for Entra ID authentication.
|
|
109
|
+
|
|
110
|
+
Uses LiteLLM's built-in helper which leverages DefaultAzureCredential:
|
|
111
|
+
- Azure CLI credentials (az login)
|
|
112
|
+
- Managed Identity
|
|
113
|
+
- Environment variables (AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, ...)
|
|
114
|
+
- Visual Studio Code credentials
|
|
115
|
+
"""
|
|
116
|
+
try:
|
|
117
|
+
from litellm.secret_managers.get_azure_ad_token_provider import (
|
|
118
|
+
get_azure_ad_token_provider,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return get_azure_ad_token_provider()
|
|
122
|
+
except ImportError:
|
|
123
|
+
# azure-identity not installed
|
|
124
|
+
return None
|
|
125
|
+
except Exception:
|
|
126
|
+
# Credential not available
|
|
127
|
+
return None
|
|
128
|
+
|
|
128
129
|
@property
|
|
129
130
|
def system_prompt(self) -> str:
|
|
130
131
|
"""Get the system prompt used for LLM assertions."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/feature_request.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/prompts/system_prompt.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/integration/test_llm_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|