From 6496da9b7edf0233b4563ef597a131e78a165b2f Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 29 Jan 2025 17:41:29 +0900 Subject: [PATCH] Update language-inference-engine.js --- lib/language-inference-engine.js | 39 +++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/lib/language-inference-engine.js b/lib/language-inference-engine.js index 1f217e5..84bef8f 100644 --- a/lib/language-inference-engine.js +++ b/lib/language-inference-engine.js @@ -8,9 +8,11 @@ // - OpenAI: https://openai.com/policies/row-privacy-policy/ // - Anthropic: https://www.anthropic.com/legal/privacy // - Groq: https://groq.com/privacy-policy/ +// - Mistral: https://mistral.ai/terms/ // - xAI: https://x.ai/legal/privacy-policy // - Google Gemini: https://developers.google.com/idx/support/privacy // - DeepSeek: https://chat.deepseek.com/downloads/DeepSeek%20Privacy%20Policy.html +// - Moonshot: https://kimi.moonshot.cn/user/agreement/userPrivacy // var HTTP = require("lib/http"); var CRED = require("lib/credentials"); @@ -266,6 +268,41 @@ var engineProfiles = { return response.choices.reduce(function(a, x) { a.push(x.message.content); + return a; + }, []); + } + } + }, + "moonshot": { + "type": "llm", + "defaultModel": "moonshot-v1-8k", + "headers": { + "Content-Type": "application/json", + "Authorization": "Bearer {apikey}" + }, + "url": "https://api.moonshot.cn/v1", + "wrap": function(model, message, temperature) { + "model": model, + "messages": [ + { + "role": "system", + "content": biasMessage + }, + { + "role": "user", + "content": message + } + ], + "temperature": temperature, + "stream": false + }, + "callback": function(response) { + if ("error" in response) { + return ["Error: " + response.error.message]; + } else { + return response.choices.reduce(function(a, x) { + a.push(x.message.content); + return a; }, []); } @@ -334,7 +371,7 @@ exports.create = function() { return new LanguageInferenceEngine(); }; -exports.VERSIONINFO = "Language Inference Engine integration version 0.1.3"; +exports.VERSIONINFO = "Language Inference Engine integration version 0.1.4"; exports.AUTHOR = "abuse@catswords.net"; exports.global = global; exports.require = global.require;