Download tests/test_temperature.py from codegood/job-chat: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/codegood/job-chat/resolve/main/tests/test_temperature.py
- Command line
-
hf download hf://spaces/codegood/job-chat/tests/test_temperature.py
-
curl -L -o test_temperature.py https://huggingface.co/spaces/codegood/job-chat/resolve/main/tests/test_temperature.py
1.45 kB
| """Drafting uses a higher temperature than analysis.""" | |
| import pytest | |
| import config | |
| from config import get_settings | |
| from graph import build_llm | |
| from skills import DRAFTING_SKILLS | |
| def test_drafting_is_warmer_than_analysis(): | |
| settings = get_settings() | |
| assert settings.drafting_temperature > settings.temperature | |
| def test_only_the_writing_skills_draft(): | |
| assert DRAFTING_SKILLS == {"cover_letter", "email"} | |
| def test_default_temperatures(): | |
| assert config.DEFAULT_TEMPERATURE == 0.0 | |
| assert 0 < config.DEFAULT_DRAFTING_TEMPERATURE < 1 | |
| def test_build_llm_defaults_to_the_analysis_temperature(): | |
| assert build_llm().temperature == pytest.approx(get_settings().temperature, abs=1e-6) | |
| assert build_llm().openai_api_base == config.OPENROUTER_BASE_URL | |
| def test_build_llm_accepts_an_override(): | |
| assert build_llm(0.4).temperature == 0.4 | |
| def test_build_llm_accepts_a_ui_key_without_an_environment_key(monkeypatch): | |
| monkeypatch.delenv("OPENROUTER_API_KEY") | |
| get_settings.cache_clear() | |
| try: | |
| llm = build_llm(api_key="ui-key") | |
| assert llm.openai_api_key.get_secret_value() == "ui-key" | |
| finally: | |
| get_settings.cache_clear() | |
| def test_drafting_temperature_is_configurable(monkeypatch): | |
| monkeypatch.setenv("LLM_DRAFTING_TEMPERATURE", "0.9") | |
| get_settings.cache_clear() | |
| try: | |
| assert get_settings().drafting_temperature == 0.9 | |
| finally: | |
| get_settings.cache_clear() | |