MCPcopy Create free account
hub / github.com/apache/maka / isOpenAIChatCompletion

Function isOpenAIChatCompletion

packages/runtime/src/test-connection.ts:382–405  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

380}
381
382function isOpenAIChatCompletion(value: unknown): boolean {
383 if (!value || typeof value !== 'object') return false;
384 const choices = (value as { choices?: unknown }).choices;
385 return (
386 Array.isArray(choices) &&
387 choices.some((choice) => {
388 if (!choice || typeof choice !== 'object') return false;
389 const message = (choice as { message?: unknown }).message;
390 if (!message || typeof message !== 'object') return false;
391 const completion = message as {
392 content?: unknown;
393 reasoning?: unknown;
394 reasoning_content?: unknown;
395 tool_calls?: unknown;
396 };
397 return (
398 typeof completion.content === 'string' ||
399 typeof completion.reasoning === 'string' ||
400 typeof completion.reasoning_content === 'string' ||
401 (Array.isArray(completion.tool_calls) && completion.tool_calls.length > 0)
402 );
403 })
404 );
405}
406
407async function probeGoogle(
408 baseUrl: string,

Callers 1

probeOpenAIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected