Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 1x | import type {
GoogleErrorResponse,
GoogleFinetuneRecord,
GoogleListFinetuneJobsResponse,
} from '@api/ai-providers/google/types';
import type { ResponseTransformFunction } from '@shared/types/ai-providers/config';
import { GoogleErrorResponseTransform, googleToOpenAIFinetune } from './utils';
export const googleFinetuneListResponseTransform: ResponseTransformFunction = (
input,
status,
) => {
if (status !== 200) {
return GoogleErrorResponseTransform(
input as unknown as GoogleErrorResponse,
);
}
const records =
(input as unknown as { tuningJobs: GoogleFinetuneRecord[] }).tuningJobs ??
[];
const objects = records.map(googleToOpenAIFinetune);
return {
data: objects,
object: 'list',
first_id: objects.at(0)?.id ?? '',
last_id: objects.at(-1)?.id ?? '',
has_more: !!(input as unknown as GoogleListFinetuneJobsResponse)
?.nextPageToken,
};
};
|