gitlab_monitor/utils/chatTools.ts
zhaoyingbo 92fa30ef3d
All checks were successful
CI Monitor MIflow / build-image (push) Successful in 2m42s
feat: 支持初步的CR
2024-08-12 12:24:45 +00:00

33 lines
1.1 KiB
TypeScript

import { ChatOpenAI } from "@langchain/openai"
/**
* 获取Deepseek模型
* @param {number} temperature - 温度参数,用于控制生成文本的随机性。
* @returns {Promise<ChatOpenAI>} 返回一个包含Deepseek模型实例的Promise。
*/
const getDeepseekModel = async (temperature: number) => {
const model = "deepseek-coder"
const apiKey = "sk-21a2ce1c2ee94bc2933798eac1bbcadc"
const baseURL = "https://api.deepseek.com"
return new ChatOpenAI({ apiKey, temperature, model }, { baseURL })
}
/**
* 获取GPT-4o模型
* @param {number} temperature - 温度参数,用于控制生成文本的随机性。
* @returns {Promise<ChatOpenAI>} 返回一个包含GPT-4o模型实例的Promise。
*/
const getGpt4oModel = async (temperature: number) => {
const model = "deepseek-coder"
const apiKey = "sk-EhbBTR0QjhH22iLr9aCb04D2B0F44f88A07c2924Eb54CfA4"
const baseURL = "https://api.gpt.ge/v1"
return new ChatOpenAI({ apiKey, temperature, model }, { baseURL })
}
const chatTools = {
getDeepseekModel,
getGpt4oModel,
}
export default chatTools