mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-11 09:10:13 +01:00
1d39b8a2ce
* add Together AI LLM support * update readme to support together ai * Patch togetherAI implementation * add model sorting/option labels by organization for model selection * linting + add data handling for TogetherAI * change truthy statement patch validLLMSelection method --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
// Together AI does not provide a simple REST API to get models,
|
|
// so we have a table which we copy from their documentation
|
|
// https://docs.together.ai/edit/inference-models that we can
|
|
// then parse and get all models from in a format that makes sense
|
|
// Why this does not exist is so bizarre, but whatever.
|
|
|
|
// To run, cd into this directory and run `node parse.mjs`
|
|
// copy outputs into the export in ../models.js
|
|
|
|
// Update the date below if you run this again because TogetherAI added new models.
|
|
// Last Collected: Jan 10, 2023
|
|
|
|
import fs from "fs";
|
|
|
|
function parseChatModels() {
|
|
const fixed = {};
|
|
const tableString = fs.readFileSync("chat_models.txt", { encoding: "utf-8" });
|
|
const rows = tableString.split("\n").slice(2);
|
|
|
|
rows.forEach((row) => {
|
|
const [provider, name, id, maxLength] = row.split("|").slice(1, -1);
|
|
const data = {
|
|
provider: provider.trim(),
|
|
name: name.trim(),
|
|
id: id.trim(),
|
|
maxLength: Number(maxLength.trim()),
|
|
};
|
|
|
|
fixed[data.id] = {
|
|
id: data.id,
|
|
organization: data.provider,
|
|
name: data.name,
|
|
maxLength: data.maxLength,
|
|
};
|
|
});
|
|
|
|
fs.writeFileSync("chat_models.json", JSON.stringify(fixed, null, 2), "utf-8");
|
|
return fixed;
|
|
}
|
|
|
|
parseChatModels();
|