@fileoverview Shared OpenAI wire-format conversion helpers. Both the OpenAI and Copilot adapters use the OpenAI Chat Completions API format. This module contains the common conversion logic so it isn't duplicated across adapters. /
/**
* @fileoverview Shared OpenAI wire-format conversion helpers.
*
* Both the OpenAI and Copilot adapters use the OpenAI Chat Completions API
* format. This module contains the common conversion logic so it isn't
* duplicated across adapters.
*/
import OpenAI from 'openai'
import type {
ChatCompletion,
ChatCompletionAssistantMessageParam,
ChatCompletionMessageParam,
ChatCompletionMessageToolCall,
ChatCompletionTool,
ChatCompletionToolMessageParam,
ChatCompletionUserMessageParam,
} from 'openai/resources/chat/completions/index.js'
import type {
ContentBlock,
LLMMessage,
LLMResponse,
LLMToolDef,
ReasoningBlock,
TextBlock,
ThinkingConfig,
ToolResultContentPart,
ToolUseBlock,
} from '../types.js'
import { UnsupportedToolCallError, UnsupportedToolResultC
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key