Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Add support for http clients in config (#1355)

Abdur Rahman Nawazebc5e25f9825
diff --git a/embedchain/config/llm/base.py b/embedchain/config/llm/base.py
index 26b094c9e..cdb158c5b 100644
--- a/embedchain/config/llm/base.py
+++ b/embedchain/config/llm/base.py
@@ -98,6 +98,8 @@ class BaseLlmConfig(BaseConfig):
base_url: Optional[str] = None,
endpoint: Optional[str] = None,
model_kwargs: Optional[dict[str, Any]] = None,
+ http_client: Optional[Any] = None,
+ http_async_client: Optional[Any] = None,
local: Optional[bool] = False,
default_headers: Optional[Mapping[str, str]] = None,
):
@@ -175,6 +177,8 @@ class BaseLlmConfig(BaseConfig):
self.base_url = base_url
self.endpoint = endpoint
self.model_kwargs = model_kwargs
+ self.http_client = http_client
+ self.http_async_client = http_async_client
self.local = local
self.default_headers = default_headers
diff --git a/embedchain/llm/openai.py b/embedchain/llm/openai.py
index c1b2d0afd..aec91b2a0 100644
--- a/embedchain/llm/openai.py
+++ b/embedchain/llm/openai.py
@@ -52,6 +52,8 @@ class OpenAILlm(BaseLlm):
callbacks=callbacks,
api_key=api_key,
base_url=base_url,
+ http_client=config.http_client,
+ http_async_client=config.http_async_client,
)
else:
chat = ChatOpenAI(**kwargs, api_key=api_key, base_url=base_url)