{"version":3,"sources":["../../src/deepseek/deepseek.ts"],"sourcesContent":["/**\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 */\n\nimport { z } from 'genkit';\nimport { ModelInfo, ModelReference } from 'genkit/model';\nimport {\n  ChatCompletionCommonConfigSchema,\n  ModelRequestBuilder,\n  compatOaiModelRef,\n} from '../model';\n\n/** DeepSeek Custom configuration schema. */\nexport const DeepSeekChatCompletionConfigSchema =\n  ChatCompletionCommonConfigSchema.extend({\n    maxTokens: z.number().int().min(1).max(8192).optional(),\n  });\n\nexport const deepSeekRequestBuilder: ModelRequestBuilder = (req, params) => {\n  const { maxTokens } = req.config;\n  // DeepSeek still uses max_tokens\n  params.max_tokens = maxTokens;\n};\n\n/** DeepSeek ModelRef helper, with DeepSeek specific config. */\nexport function deepSeekModelRef(params: {\n  name: string;\n  info?: ModelInfo;\n  config?: any;\n}): ModelReference<typeof DeepSeekChatCompletionConfigSchema> {\n  return compatOaiModelRef({\n    ...params,\n    configSchema: DeepSeekChatCompletionConfigSchema,\n    info: params.info ?? {\n      supports: {\n        multiturn: true,\n        tools: true,\n        media: false,\n        systemRole: true,\n        output: ['text', 'json'],\n      },\n    },\n  });\n}\n\nexport const SUPPORTED_DEEPSEEK_MODELS = {\n  'deepseek-reasoner': deepSeekModelRef({ name: 'deepseek/deepseek-reasoner' }),\n  'deepseek-chat': deepSeekModelRef({ name: 'deepseek/deepseek-chat' }),\n};\n"],"mappings":"AAgBA,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AAGA,MAAM,qCACX,iCAAiC,OAAO;AAAA,EACtC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,SAAS;AACxD,CAAC;AAEI,MAAM,yBAA8C,CAAC,KAAK,WAAW;AAC1E,QAAM,EAAE,UAAU,IAAI,IAAI;AAE1B,SAAO,aAAa;AACtB;AAGO,SAAS,iBAAiB,QAI6B;AAC5D,SAAO,kBAAkB;AAAA,IACvB,GAAG;AAAA,IACH,cAAc;AAAA,IACd,MAAM,OAAO,QAAQ;AAAA,MACnB,UAAU;AAAA,QACR,WAAW;AAAA,QACX,OAAO;AAAA,QACP,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,QAAQ,CAAC,QAAQ,MAAM;AAAA,MACzB;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,4BAA4B;AAAA,EACvC,qBAAqB,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAAA,EAC5E,iBAAiB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACtE;","names":[]}