From 62b199d38ecb8f2cb02410705961cce1327f06b5 Mon Sep 17 00:00:00 2001 From: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:18:13 -0700 Subject: [PATCH] [Python] increase default client cache --- python/langsmith/evaluation/_runner.py | 2 +- python/langsmith/run_trees.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/python/langsmith/evaluation/_runner.py b/python/langsmith/evaluation/_runner.py index 4c5be97b1..a040ea7a3 100644 --- a/python/langsmith/evaluation/_runner.py +++ b/python/langsmith/evaluation/_runner.py @@ -347,7 +347,7 @@ def evaluate_existing( ... ) # doctest: +ELLIPSIS View the evaluation results for experiment:... """ # noqa: E501 - client = client or rt.get_cached_client() + client = client or rt.get_cached_client(timeout_ms=(20_000, 90_001)) project = ( experiment if isinstance(experiment, schemas.TracerSession) diff --git a/python/langsmith/run_trees.py b/python/langsmith/run_trees.py index 8d7e1b36b..dceb49287 100644 --- a/python/langsmith/run_trees.py +++ b/python/langsmith/run_trees.py @@ -32,12 +32,14 @@ # Note, this is called directly by langchain. Do not remove. -def get_cached_client() -> Client: + + +def get_cached_client(**init_kwargs: Any) -> Client: global _CLIENT if _CLIENT is None: with _LOCK: if _CLIENT is None: - _CLIENT = Client() + _CLIENT = Client(**init_kwargs) return _CLIENT