Metadata-Version: 2.1
Name: langsmith-wrappers
Version: 0.0.1
Summary: Experimental wrappers that also log to LangSmith.
Home-page: https://github.com/langchain-ai/langsmith-wrappers
License: MIT
Author: LangChain
Author-email: support@langchain.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: langsmith (>=0.0.24,<0.1.0)
Project-URL: Repository, https://github.com/langchain-ai/langsmith-wrappers
Description-Content-Type: text/markdown

# LangSmith API Wrappers


Some functionality to wrap common apis (e.g., `openai`) with [LangSmith](https://smith.langchain.com/) instrumentation.


Example:

```python
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:

```python
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")
```
