iop/agent-client/pi/extensions/openai-sampling-parameters.ts
toki 01dc2ef78b refactor: readability baseline 및 테스트 구조 개선
- agent-readable-repository-refactor 완료: 기존 테스트 파일 아카이브 이동
- 새 테스트 파일 추가 (edge, node, client, config, readability)
- readability_audit 스크립트 및 baseline 추가
- roadmap/SDD 문서 갱신
- agent-client/pi/extensions/openai-sampling-parameters 추가
2026-07-17 16:02:12 +09:00

22 lines
612 B
TypeScript

import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
const OPENAI_APIS = new Set(["openai-completions", "openai-responses"]);
const TEMPERATURE = 0.2;
const TOP_P = 0.9;
export default function (pi: ExtensionAPI) {
pi.on("before_provider_request", (event, ctx) => {
if (!ctx.model || !OPENAI_APIS.has(ctx.model.api)) {
return;
}
if (!event.payload || typeof event.payload !== "object" || Array.isArray(event.payload)) {
return;
}
return {
...(event.payload as Record<string, unknown>),
temperature: TEMPERATURE,
top_p: TOP_P,
};
});
}