UNPKG

@genkit-ai/compat-oai

Version:

Genkit AI framework plugin for OpenAI APIs.

1 lines 1.88 kB
{"version":3,"sources":["../../src/openai/tts.ts"],"sourcesContent":["/**\n * Copyright 2024 The Fire Company\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { z } from 'genkit';\nimport { ModelInfo } from 'genkit/model';\nimport { compatOaiSpeechModelRef, SpeechConfigSchema } from '../audio.mjs';\n\n/** OpenAI speech ModelRef helper, same as the OpenAI-compatible spec. */\nexport function openAISpeechModelRef<\n CustomOptions extends z.ZodTypeAny = z.ZodTypeAny,\n>(params: {\n name: string;\n info?: ModelInfo;\n configSchema?: CustomOptions;\n config?: any;\n}) {\n return compatOaiSpeechModelRef({ ...params, namespace: 'openai' });\n}\n\nexport const SUPPORTED_TTS_MODELS = {\n 'tts-1': openAISpeechModelRef({ name: 'tts-1' }),\n 'tts-1-hd': openAISpeechModelRef({\n name: 'tts-1-hd',\n }),\n 'gpt-4o-mini-tts': openAISpeechModelRef({\n name: 'gpt-4o-mini-tts',\n configSchema: SpeechConfigSchema.omit({ speed: true }),\n }),\n};\n"],"mappings":"AAkBA,SAAS,yBAAyB,0BAA0B;AAGrD,SAAS,qBAEd,QAKC;AACD,SAAO,wBAAwB,EAAE,GAAG,QAAQ,WAAW,SAAS,CAAC;AACnE;AAEO,MAAM,uBAAuB;AAAA,EAClC,SAAS,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAAA,EAC/C,YAAY,qBAAqB;AAAA,IAC/B,MAAM;AAAA,EACR,CAAC;AAAA,EACD,mBAAmB,qBAAqB;AAAA,IACtC,MAAM;AAAA,IACN,cAAc,mBAAmB,KAAK,EAAE,OAAO,KAAK,CAAC;AAAA,EACvD,CAAC;AACH;","names":[]}