Skip to content

Commit

Permalink
[Python] Filter beta warning in prompt deserialiazation (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Sep 18, 2024
1 parent 5718627 commit c1a9504
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import atexit
import collections
import concurrent.futures as cf
import contextlib
import datetime
import functools
import importlib
Expand Down Expand Up @@ -5294,11 +5295,19 @@ def pull_prompt(
"The client.pull_prompt function requires the langchain_core"
"package to run.\nInstall with `pip install langchain_core`"
)
try:
from langchain_core._api import suppress_langchain_beta_warning
except ImportError:

@contextlib.contextmanager
def suppress_langchain_beta_warning():
yield

prompt_object = self.pull_prompt_commit(
prompt_identifier, include_model=include_model
)
prompt = loads(json.dumps(prompt_object.manifest))
with suppress_langchain_beta_warning():
prompt = loads(json.dumps(prompt_object.manifest))

if (
isinstance(prompt, BasePromptTemplate)
Expand Down

0 comments on commit c1a9504

Please sign in to comment.