langsmith功能总结

langsmith功能总结

1、平台基础功能

  • Tracing(追踪)
  • Debugging(调试)
  • Testing(测试)
  • Evaluation(评价)
  • Langchain Hub

(1)Tracing&Debugging功能(最核心模块—服务于LLM应用开发者)

  • View Runs&Trees:将每次大模型的运行结果通过树状图的形式呈现(呈现部分:Chain、Tool、Retriever、Prompt、LLM、Parser等)
  • Share Run:将运行的结果展示,便于公共开发
  • Run Playground(调试功能):在线上平台,在线完成对Prompt与LLM(Model)的调试
    • 在线上完成LLM的参数调整如:Input、Prompt、Model等
    • 在Langsmith线上界面即可完成实时的运行
  • Upsert Dataset:将大语言模型此次的运行的输入与输出存储到Dataset中
    演示代码
    下面展示一些 内联代码片
from langchain.llms import OpenAI
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain.chains import SimpleSequentialChain
import os

# langsmith代理
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_PROJECT"] = "填入自己的langchain project"
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
os.environ["LANGCHAIN_API_KEY"] = "填入自己的langsmithAPI"

# openai代理
os.environ["OPENAI_API_KEY"] = "选择自己的API"

# 定义第一个chain
llm = OpenAI(temperature=.7)
template = """You are a playwright. Given the title of play, it is your job to write a synopsis for that title.

Title: {title}
Playwright: This is a synopsis for the above play:"""
prompt_template = PromptTemplate(input_variables=["title"], template=template)
synopsis_chain = LLMChain(llm=llm, prompt=prompt_template)

# 定义第二个chain

llm = OpenAI(temperature=.7)
template = """You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.

Play Synopsis:
{synopsis}
Review from a New York Times play critic of the above play:"""
prompt_template = PromptTemplate(input_variables=["synopsis"], template=template)
review_chain = LLMChain(llm=llm, prompt=prompt_template)

# 通过简单顺序链组合两个LLMChain
overall_chain = SimpleSequentialChain(chains=[synopsis_chain, review_chain], verbose=True)

# 执行顺序链
review = overall_chain.run("Tragedy at sunset on the beach")
View Runs&Trees

langsmith界面

  • Traces–表示此项目追踪的大模型运行
  • LLM Calls–表示记录大模型(LLM)调用次数
  • Monitor–可视化的展示大模型应用的相关信息如模型运行时间、token调用数等
  • Setup–指导如何使用langsmith,并如何将代码插入大模型应用的代码中(上述展示代码已经展示)
  • 在这里插入图片描述
    在这里插入图片描述
    如图为运行的LLM的反馈结果,通过选择LLM等相应的节点,并点击playground,可以对节点的参数进行微调(如下图),微调完成后点击Start,从而得到自己目标节点的Output
    在这里插入图片描述

(2)Testing&Evaluation功能(服务于数据工程师)

现阶段提供数据集类型:

  • LLM(Text inputs and outputs)
  • Chat(chat model inputs and outputs)
  • Key-Value(For chains,agents and tools)
①具体功能
  • 管理数据集
    • 导入:支持csv格式
    • 导出:支持csv、OpenAI JSONL格式
  • Feedbacks–汇总和存储数据集(由开发者选择模型的输入、输出是是否符合预期,符合则收录入Feedbacks中)
  • 在网页上可视化的选择提供的数据集(见下图:左侧为可选择的数据集,右侧为langsmith生成的大模型实例)

在这里插入图片描述

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值