Ce référentiel contient le SDK Python et JavaScript pour interagir avec la plate-forme Langsmith. Veuillez consulter la documentation Langsmith pour la documentation sur l'utilisation de la plate-forme Langsmith et du SDK client.
Langsmith aide votre équipe à déboguer, évaluer et surveiller vos modèles de langue et vos agents intelligents. Il fonctionne avec n'importe quelle application LLM, y compris une intégration native avec les bibliothèques open source de Langchain Python et Langchain JS.
Langsmith est développé et entretenu par Langchain, la société derrière le cadre de Langchain.
Pour commencer avec le SDK Python, installez le package, puis suivez les instructions dans le Python Readme.
pip install -U langsmith
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls_...Puis commencez à tracer votre application:
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"
)Pour commencer avec le SDK JavaScript / TypeScript, installez le package, puis suivez les instructions dans le JS Readme.
yarn add langsmith
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls_...Ensuite, commencez à tracer votre application!
import { OpenAI } from "openai" ;
import { traceable } from "langsmith/traceable" ;
import { wrapOpenAI } from "langsmith/wrappers" ;
const client = wrapOpenAI ( new OpenAI ( ) ) ;
await client . chat . completions . create ( {
model : "gpt-3.5-turbo" ,
messages : [ { content : "Hi there!" , role : "user" } ] ,
} ) ; {
id: 'chatcmpl-8sOWEOYVyehDlyPcBiaDtTxWvr9v6',
object: 'chat.completion',
created: 1707974654,
model: 'gpt-3.5-turbo-0613',
choices: [
{
index: 0,
message: { role: 'assistant', content: 'Hello! How can I help you today?' },
logprobs: null,
finish_reason: 'stop'
}
],
usage: { prompt_tokens: 10, completion_tokens: 9, total_tokens: 19 },
system_fingerprint: null
}
Pour des tutoriels sur la façon de tirer plus de valeur de Langsmith, consultez le Langsmith Cookbook Repo.
Pour en savoir plus sur la plate-forme Langsmith, consultez les documents