LangSmith
安装 LangSmith
1
pip install --upgrade langsmith
注册账号,并申请一个
LANGCHAIN_API_KEY
在环境变量中设置以下值
1
2
3export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_PROJECT=YOUR_PROJECT_NAME #自定义项目名称(可选)
export LANGCHAIN_API_KEY=LANGCHAIN_API_KEY # LangChain API Key程序中的调用将自动被记录
1
2
3
4import os
from datetime import datetime
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_PROJECT"] = "hello-world-"+datetime.now().strftime("%d/%m/%Y %H:%M:%S")
基本功能
- Traces
- LLM Calls
- Monitor
- Playground
1 | from langchain.prompts import ( |
在线标注(在平台上进行标注)
上传已有数据集
定义评估函数
运行测试
基于 LLM 的评估函数
1 | https://docs.smith.langchain.com/evaluation/faq/evaluator-implementations |