Coder Social home page Coder Social logo

alejlatorre / langsmith-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from langchain-ai/langsmith-sdk

0.0 0.0 0.0 2.75 MB

LangSmith Client SDK Implementations

Home Page: https://smith.langchain.com/

License: MIT License

JavaScript 1.42% Python 72.31% TypeScript 26.15% Makefile 0.12%

langsmith-sdk's Introduction

LangSmith Client SDKs

Release Notes Python Downloads

NPM Version JS Downloads

This repository contains the Python and Javascript SDK's for interacting with the LangSmith platform.

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 and LangChain JS open source libraries.

LangSmith is developed and maintained by LangChain, the company behind the LangChain framework.

Quick Start

To get started with the Python SDK, install the package, then follow the instructions in the Python README.

pip install -U langsmith
export LANGCHAIN_TRACING_V2=true
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, then follow the instructions in the JS README.

yarn add langsmith
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls_...

Then start tracing your app!

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
}

Cookbook

For tutorials on how to get more value out of LangSmith, check out the Langsmith Cookbook repo.

Documentation

To learn more about the LangSmith platform, check out the docs

langsmith-sdk's People

Contributors

hinthornw avatar langchain-infra avatar vowelparrot avatar nfcampos avatar jacoblee93 avatar samnoyes avatar dependabot[bot] avatar agola11 avatar dqbd avatar efriis avatar jakerachleff avatar baskaryan avatar chasemcdo avatar eyurtsev avatar hwchase17 avatar h4r5h4 avatar eltociear avatar joshuasundance-swca avatar obi1kenobi avatar savvasmohito avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.