fix(llms): honor OPENAI_BASE_URL in structured provider (#6322)

This commit is contained in:
Jupiter
2026-07-17 20:45:58 +05:30
committed by GitHub
parent 739534c0a3
commit ddaa655edf
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -49,3 +49,14 @@ def test_regular_model_sends_sampling_params(mock_openai_client):
assert "max_tokens" in call_kwargs # standard sampling params still forwarded
assert "top_p" in call_kwargs
assert call_kwargs["model"] == "gpt-4o"
def test_uses_openai_base_url_environment_variable(monkeypatch):
base_url = "https://gateway.example/v1"
monkeypatch.setenv("OPENAI_API_BASE", "https://legacy.example/v1")
monkeypatch.setenv("OPENAI_BASE_URL", base_url)
with patch("mem0.llms.openai_structured.OpenAI") as mock_openai:
OpenAIStructuredLLM(OpenAIConfig(api_key="test-api-key"))
mock_openai.assert_called_once_with(api_key="test-api-key", base_url=base_url)