Experimental wrappers that also log to LangSmith.
Project description
LangSmith API Wrappers
Some functionality to wrap common apis (e.g., openai
) with LangSmith instrumentation.
Example:
from langsmith.wrappers.openai import openai
result = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "user",
"content": "What's the weather like in san francisco right now?",
}
],
functions=[
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location"],
},
}
],
)
print(result)
You can try wrapping your own library. Function calls will be mapped as "chain" runs.
Example:
from langsmith.wrappers.base import ModuleWrapper
import transformers as transformers_base
transformers = ModuleWrapper(transformers_base)
pipe = transformers.pipeline("text2text-generation", model="google/t5-efficient-tiny")
result = pipe("This is a test")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file langsmith_wrappers-0.0.1.tar.gz
.
File metadata
- Download URL: langsmith_wrappers-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.2 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 897b051bddec05f1ba937f3b7427bf844ac305e53e95430ace768f9fe0ec1a54 |
|
MD5 | 9b25bbd9180484327d066311a5c5d46b |
|
BLAKE2b-256 | fe8389dcb89ab83d6a6cc7e97278e52ba863256aa6306c243bfa490c55a956c3 |
File details
Details for the file langsmith_wrappers-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: langsmith_wrappers-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.2 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 557671f126263fd8511b2a452ba07403873ad708e4f93db77c6daa7ce54d2452 |
|
MD5 | d28d86bb5a92b1d5e5125f907b7a7a6d |
|
BLAKE2b-256 | 274a7c2ec1df68333e698b1ce3ca1e32af5af652c5c8041219bec65f259c754a |