omp packages

@hfrancisla/pi-schema-compat0.2.0

Fix missing required arrays in JSON Schema tool definitions for Pi and strict OpenAI-compatible gateways.

GitHub Actions Published 8 days ago MIT ~41 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-schema-compat

English | 简体中文

一个轻量的 Pi 扩展,修复要求对象 Schema 显式提供 required 数组的 OpenAI-compatible 网关返回的 Invalid schema for function '...': null is not of type "array" 错误。

功能

  • 通过 Pi 的 before_provider_request 钩子,在 HTTP 请求发送前规范化 Chat Completions 工具 Schema。
  • 对缺少数组型 required 的 JSON Schema 对象(含嵌套对象)补充 "required": []。
  • 保留原本的必填字段,不重注册工具、不修改对话内容,也不记录提示词。
  • 不处理其他请求格式或无关的网关兼容性问题。

安装

要求 Pi >=1.6.1、Node.js >=22.19.0:

pi install npm:@hfrancisla/pi-schema-compat

重启 Pi 或执行 /reload,兼容请求会自动应用修复。

使用

执行 /schema-compat 查看当前进程中处理的请求数、工具数和规范化 Schema 对象数。不会保存请求体或 API 凭证。

开发

npm run verify       # JS 语法检查 + 测试
npm pack --dry-run   # 检查发布内容

无构建步骤或运行时依赖。

发布

npm publish --access public

MIT 协议,详见 LICENSE。