> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 实验配置

LangSmith 支持多种实验配置选项：

* [重复次数](#重复次数)
* [并发性](#并发性)
* [缓存](#缓存)

### 重复次数

*重复次数* 用于多次运行实验，以应对大语言模型输出的变异性。由于大语言模型的输出具有非确定性，多次重复运行能提供更准确的性能评估。

通过向 `evaluate` / `aevaluate` 传递 `num_repetitions` 参数来配置重复次数（[Python](https://reference.langchain.com/python/langsmith/evaluation/_runner/evaluate)、[TypeScript](https://reference.langchain.com/javascript/langsmith/evaluation/EvaluateOptions#member-numRepetitions-9)）。每次重复都会重新运行目标函数和所有评估器。

在[重复次数操作指南](/langsmith/repetition)中了解更多。

### 并发性

*并发性* 控制实验期间同时运行的示例数量。通过向 `evaluate` / `aevaluate` 传递 `max_concurrency` 参数进行配置。两个函数的语义有所不同：

#### `evaluate`

`max_concurrency` 参数指定运行目标函数和评估器时的最大并发线程数。

#### `aevaluate`

`max_concurrency` 参数使用信号量来限制并发任务数。`aevaluate` 为每个示例创建一个任务，每个任务运行该示例的目标函数和所有评估器。`max_concurrency` 参数指定要处理的最大并发示例数。

### 缓存

*缓存* 将 API 调用结果存储到磁盘，以加速未来的实验。将 `LANGSMITH_TEST_CACHE` 环境变量设置为具有写入权限的有效文件夹路径。未来进行相同 API 调用的实验将重用缓存结果，而不是发起新请求。

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档](/use-these-docs)通过 MCP 连接到 Claude、VSCode 等工具，以获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/langsmith/experiment-configuration.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
