Update language-inference-engine.js

This commit is contained in:
Namhyeon Go 2025-01-29 17:41:29 +09:00
parent 8699d89694
commit 6496da9b7e

View File

@ -8,9 +8,11 @@
// - OpenAI: https://openai.com/policies/row-privacy-policy/ // - OpenAI: https://openai.com/policies/row-privacy-policy/
// - Anthropic: https://www.anthropic.com/legal/privacy // - Anthropic: https://www.anthropic.com/legal/privacy
// - Groq: https://groq.com/privacy-policy/ // - Groq: https://groq.com/privacy-policy/
// - Mistral: https://mistral.ai/terms/
// - xAI: https://x.ai/legal/privacy-policy // - xAI: https://x.ai/legal/privacy-policy
// - Google Gemini: https://developers.google.com/idx/support/privacy // - Google Gemini: https://developers.google.com/idx/support/privacy
// - DeepSeek: https://chat.deepseek.com/downloads/DeepSeek%20Privacy%20Policy.html // - DeepSeek: https://chat.deepseek.com/downloads/DeepSeek%20Privacy%20Policy.html
// - Moonshot: https://kimi.moonshot.cn/user/agreement/userPrivacy
// //
var HTTP = require("lib/http"); var HTTP = require("lib/http");
var CRED = require("lib/credentials"); var CRED = require("lib/credentials");
@ -266,6 +268,41 @@ var engineProfiles = {
return response.choices.reduce(function(a, x) { return response.choices.reduce(function(a, x) {
a.push(x.message.content); 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; return a;
}, []); }, []);
} }
@ -334,7 +371,7 @@ exports.create = function() {
return new LanguageInferenceEngine(); 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.AUTHOR = "abuse@catswords.net";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;