From 2c7f1665cabd480a05e6820b0503647c4c4d9496 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Sun, 28 Jan 2024 17:09:52 -0800 Subject: [PATCH] Release: 0.0.84 (#388) --- README.md | 27 +++++++++++++++---- python/pyproject.toml | 2 +- python/tests/integration_tests/test_client.py | 4 +-- python/tests/integration_tests/test_runs.py | 5 +--- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 35ef022a0..d8a7dc02c 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,45 @@ # LangSmith Client SDKs -This repository contains `BaseTracer` schemas used in LangChain as well as the Python and Javascript clients for interacting with the [LangSmith platform](https://smith.langchain.com/). +This repository contains the Python and Javascript SDK's for interacting with the [LangSmith platform](https://smith.langchain.com/). -LangSmith helps you and your team debug, evaluate, and monitor your language models and intelligent agents. It works +LangSmith helps your team debug, evaluate, and monitor your language models and intelligent agents. It works with any LLM Application, including a native integration with the [LangChain Python](https://github.com/hwchase17/langchain) and [LangChain JS](https://github.com/hwchase17/langchainjs) open source libraries. LangSmith is developed and maintained by [LangChain](https://langchain.com/), the company behind the LangChain framework. -⚠️ The SDK and LangSmith platform is still in early beta and continuously evolving! - ## Quick Start To get started with the Python SDK, [install the package](https://pypi.org/project/langsmith/), then follow the instructions in the [Python README](python/README.md). ```bash -pip install langsmith +pip install -U langsmith +export LANGCHAIN_API_KEY=ls_... +``` + +Then start tracing your app: + +``` +import openai +from langsmith import traceable +from langsmith.wrappers import wrap_openai + +client = wrap_openai(openai.Client()) + +client.chat.completions.create( + messages=[{"role": "user", "content": "Hello, world"}], + model="gpt-3.5-turbo" +) ``` To get started with the JavaScript / TypeScript SDK, [install the package](https://www.npmjs.com/package/langsmith), then follow the instructions in the [JS README](js/README.md). ```bash yarn add langsmith +export LANGCHAIN_API_KEY=ls_... ``` +Then start tracing your app! + ## Cookbook For tutorials on how to get more value out of LangSmith, check out the [Langsmith Cookbook](https://github.com/langchain-ai/langsmith-cookbook/tree/main) repo. diff --git a/python/pyproject.toml b/python/pyproject.toml index 41eda1bb8..fcd380a6f 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langsmith" -version = "0.0.83" +version = "0.0.84" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." authors = ["LangChain "] license = "MIT" diff --git a/python/tests/integration_tests/test_client.py b/python/tests/integration_tests/test_client.py index 1eae4f974..2cbd6c5bb 100644 --- a/python/tests/integration_tests/test_client.py +++ b/python/tests/integration_tests/test_client.py @@ -345,7 +345,7 @@ def test_create_run_with_masked_inputs_outputs( if project.name == project_name: langchain_client.delete_project(project_name=project_name) - run_id = "8bac165f-470e-4bf8-baa0-15f2de4cc706" + run_id = uuid4() langchain_client.create_run( id=run_id, project_name=project_name, @@ -359,7 +359,7 @@ def test_create_run_with_masked_inputs_outputs( hide_outputs=True, ) - run_id2 = "8bac165f-490e-4bf8-baa0-15f2de4cc707" + run_id2 = uuid4() langchain_client.create_run( id=run_id2, project_name=project_name, diff --git a/python/tests/integration_tests/test_runs.py b/python/tests/integration_tests/test_runs.py index 4b6263bc7..06e1a7745 100644 --- a/python/tests/integration_tests/test_runs.py +++ b/python/tests/integration_tests/test_runs.py @@ -16,7 +16,7 @@ @pytest.fixture def langchain_client() -> Generator[Client, None, None]: original = os.environ.get("LANGCHAIN_ENDPOINT") - os.environ["LANGCHAIN_ENDPOINT"] = "http://localhost:1984" + os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" yield Client() if original is None: os.environ.pop("LANGCHAIN_ENDPOINT") @@ -135,18 +135,15 @@ async def my_chain_run(text: str): assert runs_dict["my_chain_run"].execution_order == 1 assert runs_dict["my_run"].parent_run_id == runs_dict["my_chain_run"].id assert runs_dict["my_run"].run_type == "chain" - assert runs_dict["my_run"].execution_order == 2 assert runs_dict["my_llm_run"].parent_run_id == runs_dict["my_run"].id assert runs_dict["my_llm_run"].run_type == "llm" assert runs_dict["my_llm_run"].inputs == {"text": "foo"} - assert runs_dict["my_llm_run"].execution_order == 3 assert runs_dict["my_sync_tool"].parent_run_id == runs_dict["my_run"].id assert runs_dict["my_sync_tool"].run_type == "tool" assert runs_dict["my_sync_tool"].inputs == { "text": "foo", "my_arg": 20, } - assert runs_dict["my_sync_tool"].execution_order == 4 langchain_client.delete_project(project_name=project_name)