You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

11 months ago
  1. // Fireworks AI does not provide a simple REST API to get models,
  2. // so we have a table which we copy from their documentation
  3. // at https://fireworks.ai/models that we can
  4. // then parse and get all models from in a format that makes sense
  5. // Why this does not exist is so bizarre, but whatever.
  6. // To run, cd into this directory and run `node parse.mjs`
  7. // copy outputs into the export in ../models.js
  8. // Update the date below if you run this again because Fireworks AI added new models.
  9. // Last Collected: Sep 27, 2024
  10. // NOTE: Only managed to collect 20 out of ~100 models!
  11. // https://fireworks.ai/models lists almost 100 chat language models.
  12. // If you want to add models, please manually add them to chat_models.txt...
  13. // ... I tried to write a script to grab them all but gave up after a few hours...
  14. import fs from "fs";
  15. function parseChatModels() {
  16. const fixed = {};
  17. const tableString = fs.readFileSync("chat_models.txt", { encoding: "utf-8" });
  18. const rows = tableString.split("\n").slice(2);
  19. rows.forEach((row) => {
  20. const [provider, name, id, maxLength] = row.split("|").slice(1, -1);
  21. const data = {
  22. provider: provider.trim(),
  23. name: name.trim(),
  24. id: id.trim(),
  25. maxLength: Number(maxLength.trim()),
  26. };
  27. fixed[data.id] = {
  28. id: data.id,
  29. organization: data.provider,
  30. name: data.name,
  31. maxLength: data.maxLength,
  32. };
  33. });
  34. fs.writeFileSync("chat_models.json", JSON.stringify(fixed, null, 2), "utf-8");
  35. return fixed;
  36. }
  37. parseChatModels();