@ agenticprimitives/orchestration-openai-compat
部分 代理先导 ——代理应用程序的开源信任底板:可以签名的身份,行为时间检查权限,所有者携带的证据. 开发者工具包 • 妇女 所有软件包
这个 OpenAI 兼容 LLM 绑定 联 合 国 @agenticprimitives/orchestration Planner
财务报告和审定财务报表 AnswerComposer 端口——在repo中适配器 chain-state 编号 : chain-state-viem 模式),兄弟关系
orchestration-anthropic. 纯管弦乐核心不出售
聊天 - 完成翻译在此居住 .
供应商中立. 此软件包没有主机和模型的名称 。 Groq, Ollama, OpenRouter, 一个自办的 vLLM: 每个
是一个 baseUrl + 键 model 你提供.
安装
pnpm add @agenticprimitives/orchestration-openai-compat @agenticprimitives/orchestration
快速启动 (Groq)
import { runIntent, type ToolSpec } from '@agenticprimitives/orchestration';
import { createOpenAiCompatPlanner, createFetchOpenAiCompatClient } from '@agenticprimitives/orchestration-openai-compat';
const tools: ToolSpec[] = [
{ id: 'get_vault_record', description: 'Read a vault record by recordType.', inputSchema: { type: 'object', properties: { recordType: { type: 'string' } }, required: ['recordType'] } },
{ id: 'get_pii', description: 'Read the principal’s PII (high sensitivity).' },
];
// Dependency-free client — works in a Cloudflare Worker (no SDK, no node shims). The host is YOUR choice.
const client = createFetchOpenAiCompatClient({ apiKey: env.GROQ_API_KEY, baseUrl: 'https://api.groq.com/openai/v1' });
const planner = createOpenAiCompatPlanner({ client, model: 'openai/gpt-oss-120b', label: 'groq' });
const result = await runIntent(
{ goal: 'show me my profile' },
{ planner, tools, invoke: async (toolId, args) => myDelegatedMcpCall(toolId, args) },
);
模型选择 哪个 工具符合目标; 选中的呼叫仍然通过任务链上的代表团在 援引者(ADR-0041)。 模式从不通过被问来获得权威.
还有什么
createOpenAiCompatComposer({ client, model })将工具变成一个有根据的句子.createOpenAiCompatStructuredCall({ client, model })——强制单工具呼叫(查询,选择).OpenAiCompatHttpError——被扔到一个非肯定的反应与status在429号公路上,retryAfterSeconds说 给个人的 永远不要去另一个小贩那里.
OpenAiCompatLike
每个工厂都有一个结构 OpenAiCompatLike 客户端( 最小值) chat.completions.create (原始内容存档于2018-10-21). space.
也通过 createFetchOpenAiCompatClient({ apiKey, baseUrl }) 或官员 new OpenAI({ apiKey, baseURL })
- 它符合相同的形状。 这使得适配器单元可以使用假的测试,并避免了硬的SDK依赖.
线条
- 工具
arguments以JSON身份来 字符串;适配器描述它们. 无法解析planner_failed。 。 。 . tool_choice: 'required'是一个请求;一个只讲道者的答复是no_plan。 。 。 .- 客户端不流. 规划/应对预算的罚款;一代人可能遭受 中间超时,直到流出.
边界
仅导入 @agenticprimitives/orchestration (+ 数) types) (中文(简体) ). 见 spec.md + 键 capability.manifest.json。 。 。 .
许可证
麻省理工学院