sie

应用程序

superlinked/sie

自托管推理引擎,为AI智能体统一提供多种开源模型服务。

项目简介

SIE 是开源推理服务器与生产集群,通过统一的 OpenAI 兼容 API 提供搜索、文档转换、结构化输出、内容安全及智能体循环等模型服务。支持按需加载 100 多个预配置模型,并提供 Kubernetes 生产部署配置。

README 预览

\n\n\n  \n  \n\n\nSIE: Superlinked Inference Engine\n\nSelf-hosted inference for agents. Every open model your agents call, served from one cluster in your cloud.\n\n\n  Docs |\n  Quickstart |\n  API Reference |\n  Models\n\n\n[](LICENSE)\n[](https://pypi.org/project/sie-sdk/)\n[](https://github.com/superlinked/sie/stargazers)\n\n⭐ _Help us reach more developers and grow the SIE community. Star this repo!_\n\n\n\n## About\n\nSIE is an open-source inference engine that runs the models behind every agent task through one API: search and retrieval, document-to-markdown conversion, structured output, content safety, and the agent loop itself. It replaces the patchwork of a separate model server per task with one system that serves 100+ models, loading each on demand.\n\n- OpenAI-compatible API for drop-in migration: `/v1/embeddings`, `/v1/chat/completions`, `/v1/completions`, `/v1/responses`\n- Pre-configured model catalog: Stella, SPLADE, Qwen3, GLiNER, SigLIP, and more; embedding and retrieval models benchmarked on MTEB\n- Serves multiple models simultaneously with on-demand loading and LRU eviction\n- Ships Kubernetes and Helm deployment configs for the load-balancing gateway, KEDA autoscaling, and Grafana dashboards\n- Integrates with LangChain, LlamaIndex, Haystack, DSPy, CrewAI, Chroma, Qdrant, Weaviate, and LanceDB\n\n## Development\n\nInstall [mise](https://mise.jdx.dev/getting-started.html), then bootstrap the\nversioned Python, Rust, Node.js, and Helm toolchains from the repository root:\n\n```bash\n./tools/init.sh\n```\n\nThe common development checks and local server are available as mise tasks:\n\n```bash\nmise run test\nmise run lint\nmise run typecheck\nmise run serve\nmise run rust-check\nmise run rust-test\nmise run gateway-test\nmise run server-sidecar-test\n```\n\nThe Python workspace uses the committed root lock. Package membership is\nexplicit in `pyproject.toml`; a package joins the workspace only in the same\nchange that adds its complete source. 

常见问题 (5)

故障排除
如何修复并发转录时长超过30秒且长度不同的音频时出现的 Whisper HTTP 500 错误?

发生此问题的原因是 sie-server 会对长音频(long-form)Whisper 请求进行批处理,但 Transformers 的 pipeline collate 无法处理帧数不同的 log-mel 张量,例如 [128, 18110] 和 [128, 18593]。当两段时间超过 30 秒的录音在同一批次中被处理时,该问题会影响 sie-server 0.9.0 与 transformers 4.57.6 的组合。

临时解决方案:在服务器配置中将 Whisper 的 pipeline_batch_size 设置为 1,然后重启服务器。这样会单独处理每段录音,从而避开失败的 collate 路径。30 秒或更短的音频片段不受影响。

永久修复:在 packages/sie_server/src/sie_server/adapters/whisper/adapter.py 中,短音频组保留 batch_size=self._pipeline_batch_size,但长音频组以 batch_size=1 运行,即每次 pipeline 调用只处理一段录音。对于直接使用 Transformers 的情况,应对每个长音频条目分别调用 pipeline,而不是在一个批次中传入多个长度不等的条目。

修复后,两段时长不同且超过 30 秒的录音应该能在一次 extract() 调用中返回转录文本,并且在并发 4/8 下应该能够完成而不会出现 HTTP 500。实测的长音频吞吐量基本保持不变:在并发 4 且 batch_size=1 时约为 21.9 audio-seconds/second,而在默认配置下并发 1 时为 22.3。

来源 Issue #574
故障排除
如何修复 sie_mcp 的 OAuth issuer 和 token_endpoint 通过 X-Forwarded-Host 被伪造的问题?

升级到包含 PR #292(提交 f5c4451)的 sie_mcp 版本。作为临时解决方案,请显式固定公共源地址,使 X-Forwarded-Host 和 X-Forwarded-Proto 被忽略:

export SIE_MCP_PUBLIC_URL=https://mcp.your-domain.example

对于 Helm,设置:

mcpEdge:
  publicUrl: "https://mcp.your-domain.example"
  oauthEnabled: true

修复后,如果未设置 SIE_MCP_PUBLIC_URL,则仅允许对回环主机(loopback)或 SIE_MCP_ALLOWED_HOSTS 中列出的主机进行请求源推导;不受信任的主机将从 OAuth 元数据路由收到 HTTP 503 响应,且不会收到 WWW-Authenticate 质询。更新后的 Helm chart 还会在 mcpEdge.publicUrl 为空且已启用边缘 ingress 时,自动渲染 SIE_MCP_PUBLIC_URL=https://<mcpEdge.ingress.host>。请确保你的反向代理或负载均衡器会覆盖/清理 X-Forwarded-Host,并且除非这些请求头可信,否则不要启用 ingress-nginx 的 use-forwarded-headers。

来源 Issue #275
故障排除
为什么 Docker 镜像构建时安装的依赖版本与 uv.lock 中锁定的版本不同?

出现这种情况是因为镜像构建器运行了 resolve-deps,将每个 bundle 的范围依赖说明符(例如 gliner>=0.2.26,<1)写入 requirements 文件,然后运行 pip install --target=/app/bundle-libs -r,这会在构建时把版本范围解析为 PyPI 上的最新发布版本,从而覆盖了 CI 测试所依据的 uv.lock 中固定的版本。因此,对同一提交的两次构建可能会交付不同的版本。该问题已通过 PR #653 和 #802 修复:bundle 镜像在构建期间不再解析版本范围,而是改为从检入代码仓库的按目标划分的锁文件安装已保存的依赖闭包。这 15 个检入的目标锁文件覆盖了全部 11 个已发布的 Linux amd64 镜像,以及四种受支持的 CPU arm64 组合。除非适用明确且有文档记录的 bundle 例外(例如 transformers 5 bundle),否则软件包均保留根目录 uv.lock 中固定的版本。CI 会拒绝过期或不一致的锁文件,并且镜像构建会验证并保留已安装的 /app/bundle-libs 清单(解析后的 pip freeze 结果),以便任何已部署的版本都可以被审计。升级到包含这些修复的版本后,构建即可复现:现在对同一提交构建两次会安装完全相同的版本。

来源 Issue #377
故障排除
如何修复 keda-apply Helm hook 在升级期间被 OOMKilled 并返回 exit 137 的问题?

这种情况发生在 chart 0.7.2 中,因为 keda-apply hook 具有硬编码的 256Mi 内存限制。升级会以 JSON 形式获取现有的 ScaledObject 资源,并使用 jq 对其进行处理,这比全新安装占用更多内存。请升级到包含 PR #268 的 chart 版本,该版本添加了可配置的 hook 资源,并将默认限制提高到 1Gi。然后设置,例如:

hooks:
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 1Gi

使用 helm upgrade <release> <chart> -f values.yaml 应用这些值。可配置的资源会应用于 keda-apply、keda-cleanup 和 KEDA ready hook 的 Jobs。作为旧版本 chart 的临时变通方法,你可以设置 upgrade.disableHooks: true,但不建议这样做,因为它会跳过 ScaledObject 的调和与健康检查。Helm post-renderers 无法用于修补 hook Jobs。

来源 Issue #248
故障排除
如何修复单节点 /v1/embeddings 响应中不正确或未标记的 prompt_tokens?

升级到包含修复 fix(server): report measured embedding token usage(即 issue #566 的修复)的版本。在单节点 OpenAI 兼容路由上,服务器现在会透传 pipeline 的计时/用量信息,使 usage.prompt_tokens 和 usage.total_tokens 在可用时采用 worker 分词后的精确计数。如果不存在实测计数,则回退到之前的字符估算方式(len(input) / 4,最小值为 1),因为 OpenAI 客户端期望收到 usage 对象。响应中还包含 usage.sie_token_source,实测计数时设为 worker,回退时设为 character_estimate。作为升级前的临时解决方案,可使用原生 POST /v1/encode/{model} 端点获取精确计数,或将服务部署在网关之后,网关已将 sie_token_source 报告为 worker 或 character_estimate。

来源 Issue #566