Documentation Index
Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt
Use this file to discover all available pages before exploring further.
LangSmith 支持在追踪中记录和渲染图像。目前该功能支持多模态 LLM 运行。
要记录图像,请分别在 Python 或 TypeScript 中使用 wrap_openai/wrapOpenAI,并在输入中传入图像 URL 或 base64 编码的图像。
from openai import OpenAI
from langsmith.wrappers import wrap_openai
client = wrap_openai(OpenAI())
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "这张图片里有什么?"},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
},
},
],
}
],
)
print(response.choices[0])
图像将在 LangSmith 用户界面中作为追踪的一部分进行渲染。