555e282cc4
ci / changelog_check (push) Waiting to run
ci / check_changes (push) Waiting to run
ci / build_mem0 (3.10) (push) Blocked by required conditions
ci / build_mem0 (3.11) (push) Blocked by required conditions
ci / build_mem0 (3.12) (push) Blocked by required conditions
CLI Node CI / lint (push) Waiting to run
CLI Node CI / test (20) (push) Waiting to run
CLI Node CI / test (22) (push) Waiting to run
CLI Node CI / build (push) Waiting to run
CLI Python CI / lint (push) Waiting to run
CLI Python CI / test (3.10) (push) Waiting to run
CLI Python CI / test (3.11) (push) Waiting to run
CLI Python CI / test (3.12) (push) Waiting to run
CLI Python CI / build (push) Waiting to run
openclaw checks / lint (push) Waiting to run
openclaw checks / test (20) (push) Waiting to run
openclaw checks / test (22) (push) Waiting to run
openclaw checks / build (push) Waiting to run
opencode-plugin checks / build (push) Waiting to run
pi-agent-plugin checks / lint (push) Waiting to run
pi-agent-plugin checks / test (20) (push) Waiting to run
pi-agent-plugin checks / test (22) (push) Waiting to run
pi-agent-plugin checks / build (push) Waiting to run
TypeScript SDK CI / check_changes (push) Waiting to run
TypeScript SDK CI / changelog_check (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (22) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (22) (push) Blocked by required conditions
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
import httpx
|
|
import pytest
|
|
|
|
from mem0.configs.embeddings.base import BaseEmbedderConfig
|
|
from mem0.configs.llms.base import BaseLlmConfig
|
|
from mem0.utils.factory import LlmFactory
|
|
|
|
|
|
@pytest.mark.parametrize("config_cls", [BaseLlmConfig, BaseEmbedderConfig])
|
|
def test_config_with_string_proxy_builds_client(config_cls):
|
|
config = config_cls(http_client_proxies="http://proxy.local:8080")
|
|
assert isinstance(config.http_client, httpx.Client)
|
|
assert config.http_client_proxies == "http://proxy.local:8080"
|
|
|
|
|
|
@pytest.mark.parametrize("config_cls", [BaseLlmConfig, BaseEmbedderConfig])
|
|
def test_config_with_dict_proxy_builds_client(config_cls):
|
|
proxies = {"http://": "http://p:8080", "https://": "http://p:8080"}
|
|
config = config_cls(http_client_proxies=proxies)
|
|
assert isinstance(config.http_client, httpx.Client)
|
|
assert config.http_client_proxies == proxies
|
|
|
|
|
|
@pytest.mark.parametrize("config_cls", [BaseLlmConfig, BaseEmbedderConfig])
|
|
def test_config_without_proxy_has_no_client(config_cls):
|
|
config = config_cls()
|
|
assert config.http_client is None
|
|
assert config.http_client_proxies is None
|
|
|
|
|
|
def test_llm_factory_preserves_http_client_proxies():
|
|
base = BaseLlmConfig(
|
|
model="gpt-4o-mini",
|
|
api_key="sk-test",
|
|
http_client_proxies="http://proxy.local:8080",
|
|
)
|
|
llm = LlmFactory.create("openai", base)
|
|
assert llm.config.http_client_proxies == "http://proxy.local:8080"
|
|
assert isinstance(llm.config.http_client, httpx.Client)
|