agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
38 lines • 1.66 kB
TypeScript
/**
* OpenAIThinkingHandler — normalizes OpenAI's o1/o3 reasoning_summary
* structured output into the framework's `ThinkingBlock[]` contract.
*
* OpenAI's reasoning_summary shape varies by model + API version:
*
* 1. Older o1 format — simple string:
* "I worked through the problem by first..."
*
* 2. Newer o3+ structured — array of summary items:
* [
* { type: 'summary_text', text: 'Identify the user request' },
* { type: 'summary_text', text: 'Choose appropriate tool' },
* ]
*
* 3. Missing entirely — most calls (gpt-4o, or o1/o3 without
* reasoning_summary param requested) → undefined raw input
*
* Handler dispatches on shape; output is `ThinkingBlock[]` with
* `summary: true` per Phase 1 contract — distinguishes structured-
* summary blocks from raw thinking content (Anthropic's shape).
*
* **No signature** — OpenAI doesn't sign reasoning. The output's
* `signature` field stays undefined. No round-trip integrity invariant
* (unlike Anthropic).
*
* **No `parseChunk`** — OpenAI doesn't stream reasoning content as of
* early 2026. Reasoning arrives only on the terminal response. Per
* Phase 1 design, `parseChunk` is optional; we omit entirely.
*
* **No `usage.thinking` computation** — reasoning_tokens lives on
* `response.usage.completion_tokens_details.reasoning_tokens` and is
* the OpenAIProvider's job to surface (deferred). Handler doesn't
* compute token counts.
*/
import type { ThinkingHandler } from './types.js';
export declare const openAIThinkingHandler: ThinkingHandler;
//# sourceMappingURL=OpenAIThinkingHandler.d.ts.map