All checks were successful
CI Monitor MIflow / build-image (push) Successful in 2m42s
33 lines
1.1 KiB
TypeScript
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
|