Documentation
¶
Overview ¶
Package lmstudio 实现 LM Studio 本地模型服务的 ModelProvider.
LM Studio 提供 GUI 界面管理本地 LLM,并内置 OpenAI 兼容 API 服务器. 与 Ollama 不同,LM Studio 使用标准的 OpenAI /v1/models 端点, 同时也支持 /v1/chat/completions 流式请求.
两者对比:
- Ollama:命令行管理,/api/tags 端点,更适合服务器场景
- LM Studio:GUI 管理,/v1/models 端点,更适合桌面开发场景
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BaseURL 是 LM Studio 本地 API 服务器地址(默认 http://localhost:1234).
BaseURL string
// HTTPClient 注入自定义 HTTP 客户端.
// nil = 使用默认 http.Client (带 Timeout 字段配置的 ResponseHeaderTimeout).
// 非 nil 时 consumer 完全接管超时责任, 下面的 Timeout 字段被忽略.
HTTPClient *http.Client
// Timeout 限制"从请求发出到收到响应首字节"的时间.
//
// 通过 http.Transport.ResponseHeaderTimeout 实现, **不影响** SSE 流式 body 读取.
// 精妙之处(CLEVER): 不要误用 http.Client.Timeout - 会砍死 SSE 流.
//
// 0 = 使用 defaultTimeout (300s, 适合本地推理冷启动).
// 与 ollama 一致: 本地模型 load + warm-up 可能耗时 30-60s.
// 仅当 HTTPClient 为 nil 时生效; 提供自定义 HTTPClient 时此字段被忽略.
Timeout time.Duration
}
Config 是 LM Studio provider 的配置.
Click to show internal directories.
Click to hide internal directories.