UNPKG

genkitx-azure-openai

Version:

Firebase Genkit AI framework plugin for Azure OpenAI APIs.

1 lines 2.91 kB
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Copyright 2024 The Fire Company\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 */\n\nimport type { Genkit } from 'genkit';\nimport { genkitPlugin } from 'genkit/plugin';\nimport { AzureClientOptions, AzureOpenAI } from 'openai';\n\nimport { dallE3, dallE3Model } from './dalle.js';\nimport { whisper1, whisper1Model } from './whisper.js';\n\nimport {\n openaiEmbedder,\n SUPPORTED_EMBEDDING_MODELS,\n textEmbedding3Large,\n textEmbedding3Small,\n textEmbeddingAda002,\n} from './embedder.js';\nimport {\n gpt35Turbo,\n gpt4,\n gptO1Preview,\n gptO1Mini,\n gptO1,\n gpt4o,\n gptO3Mini,\n gpt45,\n gptModel,\n SUPPORTED_GPT_MODELS,\n} from './gpt.js';\nimport { SUPPORTED_TTS_MODELS, ttsModel, tts1, tts1Hd } from './tts.js';\nexport {\n dallE3,\n tts1,\n tts1Hd,\n whisper1,\n gpt35Turbo,\n gpt4,\n gptO1,\n gptO1Mini,\n gptO1Preview,\n gpt4o,\n gptO3Mini,\n gpt45,\n textEmbedding3Large,\n textEmbedding3Small,\n textEmbeddingAda002,\n};\n\nexport interface PluginOptions extends AzureClientOptions {}\n\nexport const azureOpenAI = (options?: PluginOptions) =>\n genkitPlugin('azure-openai', async (ai: Genkit) => {\n const client = new AzureOpenAI(options);\n for (const name of Object.keys(SUPPORTED_GPT_MODELS)) {\n gptModel(ai, name, client);\n }\n dallE3Model(ai, client);\n whisper1Model(ai, client);\n for (const name of Object.keys(SUPPORTED_TTS_MODELS)) {\n ttsModel(ai, name, client);\n }\n for (const name of Object.keys(SUPPORTED_EMBEDDING_MODELS)) {\n openaiEmbedder(ai, name, client);\n }\n });\n\nexport default azureOpenAI;\n"],"mappings":";;;AAiBA,SAAS,oBAAoB;AAC7B,SAA6B,mBAAmB;AAEhD,SAAS,QAAQ,mBAAmB;AACpC,SAAS,UAAU,qBAAqB;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB,UAAU,MAAM,cAAc;AAqBtD,MAAM,cAAc,CAAC,YAC1B,aAAa,gBAAgB,CAAO,OAAe;AACjD,QAAM,SAAS,IAAI,YAAY,OAAO;AACtC,aAAW,QAAQ,OAAO,KAAK,oBAAoB,GAAG;AACpD,aAAS,IAAI,MAAM,MAAM;AAAA,EAC3B;AACA,cAAY,IAAI,MAAM;AACtB,gBAAc,IAAI,MAAM;AACxB,aAAW,QAAQ,OAAO,KAAK,oBAAoB,GAAG;AACpD,aAAS,IAAI,MAAM,MAAM;AAAA,EAC3B;AACA,aAAW,QAAQ,OAAO,KAAK,0BAA0B,GAAG;AAC1D,mBAAe,IAAI,MAAM,MAAM;AAAA,EACjC;AACF,EAAC;AAEH,IAAO,cAAQ;","names":[]}