mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-11-22 00:59:54 +02:00
fix(sentiment): send Jev requests to the endpoint TYPESAFE_BASE_URL names (#1416)
- post screening reads TypeSafe's own TYPESAFE_BASE_URL and appends /v1/systemone, as the TypeSafe SDKs do, so Jev can be reached through OpenRouter; the key still turns screening on
This commit is contained in:
@@ -45,6 +45,7 @@ def post(monkeypatch):
|
||||
monkeypatch.setattr(typesafe.time, "sleep", calls.sleeps.append)
|
||||
monkeypatch.setenv("TYPESAFE_API_KEY", "ts-test")
|
||||
monkeypatch.delenv("TYPESAFE_DEFAULT_MODEL", raising=False)
|
||||
monkeypatch.delenv("TYPESAFE_BASE_URL", raising=False)
|
||||
return calls
|
||||
|
||||
|
||||
@@ -76,6 +77,26 @@ def test_the_model_follows_the_sdk_environment(post, monkeypatch):
|
||||
assert post[0][1]["json"]["model"] == "jev-1.13.0"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.parametrize("base", ["https://openrouter.ai/api", "https://openrouter.ai/api/"])
|
||||
def test_the_endpoint_follows_the_sdk_environment(post, monkeypatch, base):
|
||||
"""TypeSafe's SDKs read TYPESAFE_BASE_URL and append /v1/systemone; OpenRouter
|
||||
serves Jev at https://openrouter.ai/api with an OpenRouter key (#1416)."""
|
||||
monkeypatch.setenv("TYPESAFE_BASE_URL", base)
|
||||
post.queue.append(_ok())
|
||||
|
||||
typesafe.system_one("s", QUESTIONS)
|
||||
|
||||
assert post[0][0] == "https://openrouter.ai/api/v1/systemone"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_a_base_url_without_a_key_does_not_turn_screening_on(monkeypatch):
|
||||
monkeypatch.delenv("TYPESAFE_API_KEY", raising=False)
|
||||
monkeypatch.setenv("TYPESAFE_BASE_URL", "https://openrouter.ai/api")
|
||||
assert typesafe.jev_screen("AAPL") is None
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.parametrize("transient", [
|
||||
_Response(429), _Response(529), requests.ConnectionError(), requests.Timeout(),
|
||||
|
||||
Reference in New Issue
Block a user