Commit 56447e1
authored
Parametric LLM model tests (#617)
* Make LLM tests fully parametric in model name via EFFECTFUL_LLM_MODEL env var
Replace provider-specific environment variable checks (OPENAI_API_KEY,
ANTHROPIC_API_KEY) and skip markers (requires_openai, requires_anthropic)
with a single EFFECTFUL_LLM_MODEL environment variable that controls
which model is used for all LLM integration tests.
- Remove hardcoded model names from all test files in favor of LLM_MODEL
read from EFFECTFUL_LLM_MODEL env var
- Replace requires_openai/requires_anthropic markers with requires_llm
- Remove model parametrization that was cross-provider; tests now use
whichever model the env var specifies
- Use litellm.supports_vision() to conditionally skip vision tests
- Remove default model from LiteLLMProvider (make model required)
- Update CI workflow to pass EFFECTFUL_LLM_MODEL as a matrix parameter,
making it easy to add parallel CI stages for different providers
- Rename/remove fixture files to match updated test names
Closes #589
* Deduplicate LLM_MODEL/requires_llm into conftest, fix import order, rename test
- Move LLM_MODEL and requires_llm definitions to tests/conftest.py;
all four LLM test files now import from there
- Fix import ordering in test_handlers_llm_encoding.py (stdlib before local)
- Rename test_agent_tool_names_are_openai_compatible_integration to
test_agent_tool_names_are_valid_integration since it's no longer
OpenAI-specific
* Address review feedback: fix breaking change, import hygiene, redundancy
- Restore LiteLLMProvider default model via env var fallback so existing
callers (template.py, test_handlers_llm_template.py, notebook) are not
broken: model=os.environ.get("EFFECTFUL_LLM_MODEL", "gpt-4o")
- Move LLM_MODEL/requires_llm from conftest.py to tests/_llm_helpers.py
since conftest.py should not be imported directly
- Fix import placement in test_handlers_llm_provider.py (was between
module-level constants instead of grouped with imports)
- Remove redundant @requires_llm on vision tests where the skipif
condition already covers the not-LLM_MODEL case
* Revert LiteLLMProvider default to plain literal "gpt-4o"
The env var belongs in test infrastructure, not the library API.
LiteLLMProvider should have a clean, explicit default.
* Minor fix
* minor fixes
* minor
* Make LLM test suite parametric in model name (#589)
Remove provider-specific environment variable checks and skip markers
from LLM tests in favor of a single EFFECTFUL_LLM_MODEL env var.
- Add LLM_MODEL and requires_llm to tests/conftest.py; LLM_MODEL
defaults to "gpt-4o-mini" and is overridable via EFFECTFUL_LLM_MODEL
- Live tests (tool calling, encoding, agent tool names) use LLM_MODEL
and are gated by requires_llm which checks for any provider API key
- Integration tests use make_provider() which returns a live
LiteLLMProvider when API keys are available, else falls back to
ReplayLiteLLMProvider for offline replay from fixtures
- Replay-only tests (simple_prompt_multiple_models, cross_endpoint,
caching) keep hardcoded model names and always run since they never
call the API
- Update CI workflow to pass EFFECTFUL_LLM_MODEL as a matrix parameter
for easy parallel stages with different providers
Closes #589
* Minor fix
* Minor fix
* Fix tuple type schemas for OpenAI structured output compatibility
Three fixes in encoding.py:
1. TupleEncodable.encode() now returns a TupleItems model instance
(not a raw tuple), and deserialize() returns the model directly.
This fixes pydantic validation in litellm integration tests for
NamedTuple and fixed-tuple types.
2. Add _TupleSafeJsonSchema that overrides pydantic's tuple_schema()
to produce object schemas (item_0, item_1 properties) instead of
prefixItems arrays. Applied via _BoxEncoding.model_json_schema()
so dataclasses containing tuple fields produce OpenAI-compatible
schemas.
3. SequenceEncodable.encode() returns a list (not tuple) to preserve
encode idempotency — nested_type on a list dispatches to the
sequence encoder, avoiding a mismatch with TupleEncodable.
Also adds test_handlers_llm_encoding.py back to CI workflow.
* Clean up
* Split out tuple encoding fixes to separate branch
Revert encoding.py to master and remove encoding tests from CI
workflow. Tuple schema fixes will be in a dedicated PR.
* Removing hard-coded test value and renaminng const
* Use litellm to check requires vision
* Fix missing fixture and lint formatting
- Add renamed fixture for test_simple_prompt (was test_simple_prompt_multiple_models[gpt-4o-mini])
- Reformat long lines to pass ruff lint1 parent ec7dcb8 commit 56447e1
10 files changed
Lines changed: 74 additions & 259 deletions
File tree
- .github/workflows
- tests
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
3 | 22 | | |
4 | 23 | | |
5 | 24 | | |
| |||
Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 0 additions & 44 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 31 | + | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| |||
744 | 742 | | |
745 | 743 | | |
746 | 744 | | |
747 | | - | |
| 745 | + | |
748 | 746 | | |
749 | 747 | | |
750 | 748 | | |
751 | 749 | | |
752 | 750 | | |
753 | 751 | | |
754 | | - | |
| 752 | + | |
755 | 753 | | |
756 | 754 | | |
757 | 755 | | |
| |||
777 | 775 | | |
778 | 776 | | |
779 | 777 | | |
780 | | - | |
| 778 | + | |
781 | 779 | | |
782 | 780 | | |
783 | 781 | | |
| |||
793 | 791 | | |
794 | 792 | | |
795 | 793 | | |
796 | | - | |
| 794 | + | |
797 | 795 | | |
798 | 796 | | |
799 | 797 | | |
| |||
802 | 800 | | |
803 | 801 | | |
804 | 802 | | |
805 | | - | |
| 803 | + | |
806 | 804 | | |
807 | 805 | | |
808 | 806 | | |
| |||
818 | 816 | | |
819 | 817 | | |
820 | 818 | | |
821 | | - | |
| 819 | + | |
822 | 820 | | |
823 | 821 | | |
824 | 822 | | |
| |||
0 commit comments