Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Filter beta warning in prompt deserialiazation #1013

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading