From e8de067e6715050787846b6e7369f2ebab41632f Mon Sep 17 00:00:00 2001 From: nhuang-lc Date: Tue, 17 Sep 2024 17:11:18 -0700 Subject: [PATCH 1/3] Add methods in slots attribute (#1012) Add methods that are in the slots attribute to the functions list --------- Co-authored-by: Nick Huang --- python/docs/create_api_rst.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python/docs/create_api_rst.py b/python/docs/create_api_rst.py index 3f51da948..253352767 100644 --- a/python/docs/create_api_rst.py +++ b/python/docs/create_api_rst.py @@ -108,6 +108,18 @@ def _load_module_members(module_path: str, namespace: str) -> ModuleMembers: else "Pydantic" if issubclass(type_, BaseModel) else "Regular" ) ) + if hasattr(type_, "__slots__"): + for func_name, func_type in inspect.getmembers(type_): + if inspect.isfunction(func_type): + functions.append( + FunctionInfo( + name=func_name, + qualified_name=f"{namespace}.{name}.{func_name}", + is_public=not func_name.startswith("_"), + is_deprecated=".. deprecated::" + in (func_type.__doc__ or ""), + ) + ) classes_.append( ClassInfo( name=name, From 17476521bf556def56d8add8f2c373babab3fb31 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:51:29 -0700 Subject: [PATCH 2/3] [Python] Filter beta warning in prompt deserialiazation (#1013) --- python/langsmith/client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/langsmith/client.py b/python/langsmith/client.py index 6377bd2d0..cb0e863f0 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -15,6 +15,7 @@ import atexit import collections import concurrent.futures as cf +import contextlib import datetime import functools import importlib @@ -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) From afbf1ae9a80996787ab61a6561cc592726bceab5 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Wed, 18 Sep 2024 06:06:27 -0700 Subject: [PATCH 3/3] Always trace evaluators (#1014) --- js/package.json | 2 +- js/src/evaluation/_runner.ts | 1 + js/src/index.ts | 2 +- js/src/tests/run_trees.int.test.ts | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/package.json b/js/package.json index eec53685e..a941749c0 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "langsmith", - "version": "0.1.57", + "version": "0.1.58", "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.", "packageManager": "yarn@1.22.19", "files": [ diff --git a/js/src/evaluation/_runner.ts b/js/src/evaluation/_runner.ts index f6a946bf2..cdd5b3ccf 100644 --- a/js/src/evaluation/_runner.ts +++ b/js/src/evaluation/_runner.ts @@ -566,6 +566,7 @@ export class _ExperimentManager { : new Date(example.created_at).toISOString(), }, client: fields.client, + tracingEnabled: true, }; const evaluatorResponse = await evaluator.evaluateRun( run, diff --git a/js/src/index.ts b/js/src/index.ts index 42fa4669f..54ead368d 100644 --- a/js/src/index.ts +++ b/js/src/index.ts @@ -14,4 +14,4 @@ export { RunTree, type RunTreeConfig } from "./run_trees.js"; export { overrideFetchImplementation } from "./singletons/fetch.js"; // Update using yarn bump-version -export const __version__ = "0.1.57"; +export const __version__ = "0.1.58"; diff --git a/js/src/tests/run_trees.int.test.ts b/js/src/tests/run_trees.int.test.ts index ecd40976f..15199efda 100644 --- a/js/src/tests/run_trees.int.test.ts +++ b/js/src/tests/run_trees.int.test.ts @@ -16,7 +16,7 @@ test.concurrent( "Test post and patch run", async () => { const projectName = `__test_run_tree_js ${uuid.v4()}`; - const langchainClient = new Client({ timeout_ms: 30000 }); + const langchainClient = new Client({ timeout_ms: 30_000 }); const parentRunConfig: RunTreeConfig = { name: "parent_run", run_type: "chain", @@ -33,7 +33,7 @@ test.concurrent( ); await parent_run.postRun(); - const child_llm_run = await parent_run.createChild({ + const child_llm_run = parent_run.createChild({ name: "child_run", run_type: "llm", inputs: { text: "hello world" },