Spaces:
Running
Running
| import test from 'node:test'; | |
| import assert from 'node:assert/strict'; | |
| import { | |
| convertAnthropicResponseToOpenAI, | |
| convertOpenAIRequestToAnthropic | |
| } from '../../src/format/openai-compat.js'; | |
| test('legacy Flash alias resolves and preserves reasoning_effort', () => { | |
| const converted = convertOpenAIRequestToAnthropic({ | |
| model: 'antigravity/gemini-3-flash', | |
| messages: [{ role: 'user', content: 'hello' }], | |
| reasoning_effort: 'high' | |
| }); | |
| assert.equal(converted.model, 'gemini-3.5-flash-low'); | |
| assert.equal(converted.reasoning_effort, 'high'); | |
| assert.equal(converted.messages[0].role, 'user'); | |
| }); | |
| test('non-streaming response becomes OpenAI chat.completion', () => { | |
| const converted = convertAnthropicResponseToOpenAI({ | |
| id: 'msg_123', | |
| content: [{ type: 'text', text: 'hello' }], | |
| stop_reason: 'end_turn', | |
| usage: { input_tokens: 3, output_tokens: 2 } | |
| }, 'antigravity/gemini-3-flash'); | |
| assert.equal(converted.object, 'chat.completion'); | |
| assert.equal(converted.choices[0].message.content, 'hello'); | |
| assert.equal(converted.usage.total_tokens, 5); | |
| }); | |