147
*/
148
export function openAiRequestToBridge(vendor: string, body: IOpenAiChatRequest): IByokLmChatRequest {
150
>
if (!model) {
151
throw new OpenAiTranslationError('Request is missing the "model" field');
152
}
154
>
const messages: IByokLmChatMessage[] = sourceMessages.map(message => ({
155
role: toBridgeRole(message.role),
156
content: flattenContent(message.content),
157
toolCalls: toBridgeToolCalls(message.tool_calls),
158
toolCallId: message.tool_call_id,
160
>
161
>
const modelOptions: Record<string, unknown> = {};
162
>
if (typeof body.temperature === 'number') {
163
modelOptions.temperature = body.temperature;
164
}