> ## 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.

# 在提示词中包含多模态内容

某些应用围绕多模态内容构建，例如能够回答关于PDF或图像问题的聊天机器人。在这些情况下，您需要在提示词中包含多模态内容，并测试模型回答相关内容问题的能力。

Playground支持两种在提示词中融入多模态内容的方法：

1. **内联内容**：将静态文件（图像、PDF、音频）直接嵌入到提示词中。当您希望在提示词的所有使用中始终包含相同的多模态内容时，这种方法非常理想。例如，您可以包含一张参考图像，以帮助模型更好地理解并生成回答。

2. **模板变量**：为附件创建动态占位符，每次可以填充不同的内容。这种方法提供了更大的灵活性，允许您：

   * 测试模型如何处理不同的输入
   * 创建适用于不同内容、可重复使用的提示词

<Note>
  并非所有模型都支持多模态内容。在Playground中使用多模态功能之前，请确保您选择的模型支持您想要使用的文件类型。
</Note>

## 内联内容

点击您想要添加多模态内容的消息中的文件图标。在`上传内容`标签页下，您可以上传文件并将其以内联方式包含在提示词中。

<img src="https://mintcdn.com/hhh-8c10bf0c/jRI9Uh24bT9O5tSI/langsmith/images/upload-inline-multimodal-content.png?fit=max&auto=format&n=jRI9Uh24bT9O5tSI&q=85&s=656376510a3cc4a9c30b851ae94b0b61" alt="上传内联多模态内容" width="410" height="339" data-path="langsmith/images/upload-inline-multimodal-content.png" />

## 模板变量

点击您想要添加多模态内容的消息中的文件图标。在`模板变量`标签页下，您可以为特定附件类型创建模板变量。目前仅支持图像、PDF和音频文件（.wav、.mp3）。

<img src="https://mintcdn.com/hhh-8c10bf0c/BCyPqRNhtAjzdCmk/langsmith/images/template-variable-multimodal-content.png?fit=max&auto=format&n=BCyPqRNhtAjzdCmk&q=85&s=3a110f10658b2336421c8ab63e863292" alt="模板变量多模态内容" width="391" height="303" data-path="langsmith/images/template-variable-multimodal-content.png" />

## 填充模板变量

添加模板变量后，您可以使用屏幕右侧的面板为其提供内容。只需点击`+`按钮上传或选择内容，即可填充该模板变量。

<img src="https://mintcdn.com/hhh-8c10bf0c/lQoj_T05pUgIcyPg/langsmith/images/manual-prompt-multimodal.png?fit=max&auto=format&n=lQoj_T05pUgIcyPg&q=85&s=4c953085f13049e28fc3e5ae37b95981" alt="手动提示多模态" width="1466" height="482" data-path="langsmith/images/manual-prompt-multimodal.png" />

## 运行评估

手动测试提示词后，您可以[运行评估](/langsmith/evaluate-with-attachments?mode=ui)，以查看提示词在黄金示例数据集上的表现。

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\langsmith\multimodal-content.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
