Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

助手

ASSISTANTS_API_KEY=your-key
  • 您可以使用 ASSISTANTS_MODELS 来确定您希望可用的模型;否则,将使用从 OpenAI 获取的模型列表(仅显示与 Assistants API 兼容的模型)。
ASSISTANTS_MODELS=gpt-3.5-turbo-0125,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-16k,gpt-3.5-turbo,gpt-4,gpt-4-0314,gpt-4-32k-0314,gpt-4-0613,gpt-3.5-turbo-0613,gpt-3.5-turbo-1106,gpt-4-0125-preview,gpt-4-turbo-preview,gpt-4-1106-preview
  • 如有必要,你也可以使用 ASSISTANTS_BASE_URL 设置一个替代的 base URL,而不是使用官方地址,这与 OpenAI 的 OPENAI_REVERSE_PROXY 类似。
ASSISTANTS_BASE_URL=http://your-alt-baseURL:3080/
  • 根据您的需求,还有一些额外的可选配置(例如禁用 assistant builder UI),可以通过 librechat.yaml 自定义配置文件 进行设置:
    • 控制助手构建器界面的可见性和使用。 更多信息
    • 指定用于检查运行更新或助手运行状态更改的轮询间隔(以毫秒为单位)。更多信息
    • 设置 assistant 运行的超时时间(以毫秒为单位)。通过限制总运行操作时间来帮助管理系统负载。更多信息
    • 指定支持或排除哪些 assistant Ids 更多信息

严格函数调用 (Strict function calling)

With librechat you can add add the 'x-strict': true flag at operation-level in the openapi spec for actions. This will automatically generate function calls with 'strict' mode enabled. Note that strict mode supports only a partial subset of json. Read https://platform.openai.com/docs/guides/structured-outputs for details.

例如:

{
  "openapi": "3.1.0",
  "info": {
    "title": "Math.js API",
    "description": "API for performing mathematical operations, such as addition, subtraction, etc.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.mathjs.org/v4"
    }
  ],
  "paths": {
    "/": {
      "post": {
        "summary": "Evaluate a mathematical expression",
        "description": "Sends a mathematical expression in the request body to evaluate.",
"operationId": "math",
"x-strict": true,
"parameters": [
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expr": {
                    "type": "string",
                    "description": "The mathematical expression to evaluate (e.g., `2+3`)."
                  }
                },
                "required": ["expr"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result of the evaluated expression.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "number",
                      "description": "The evaluated result of the expression."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid expression provided.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Error message describing the invalid expression."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

注意

注意:

  • 在撰写本文时,仅以下模型支持 Retrieval 功能:
    • gpt-3.5-turbo-0125
    • gpt-4-0125-preview
    • gpt-4-turbo-preview
    • gpt-4-1106-preview
    • gpt-3.5-turbo-1106
  • 目前尚不支持 Vision 功能。
  • 如果您之前已经在您的 .env 文件中设置了 ENDPOINTS,则需要添加 assistants 值。

这篇指南怎么样?