organizeModelsAndProviders.test.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { expect, test } from "vitest";
  2. import { organizeModelsAndProviders } from "../../src/utils/organizeModelsAndProviders";
  3. test("organizeModelsAndProviders", () => {
  4. const models = [
  5. "azure/ada",
  6. "azure/gpt-35-turbo",
  7. "azure/gpt-3-turbo",
  8. "azure/standard/1024-x-1024/dall-e-2",
  9. "vertex_ai_beta/chat-bison",
  10. "vertex_ai_beta/chat-bison-32k",
  11. "sagemaker/meta-textgeneration-llama-2-13b",
  12. "cohere.command-r-v1:0",
  13. "cloudflare/@cf/mistral/mistral-7b-instruct-v0.1",
  14. "gpt-4o",
  15. "together-ai-21.1b-41b",
  16. "gpt-4o-mini",
  17. "anthropic/claude-3-5-sonnet-20241022",
  18. "claude-3-haiku-20240307",
  19. "claude-2",
  20. "claude-2.1",
  21. "anthropic.unsafe-claude-2.1",
  22. ];
  23. const object = organizeModelsAndProviders(models);
  24. expect(object).toEqual({
  25. azure: {
  26. separator: "/",
  27. models: [
  28. "ada",
  29. "gpt-35-turbo",
  30. "gpt-3-turbo",
  31. "standard/1024-x-1024/dall-e-2",
  32. ],
  33. },
  34. vertex_ai_beta: {
  35. separator: "/",
  36. models: ["chat-bison", "chat-bison-32k"],
  37. },
  38. sagemaker: { separator: "/", models: ["meta-textgeneration-llama-2-13b"] },
  39. cohere: { separator: ".", models: ["command-r-v1:0"] },
  40. cloudflare: {
  41. separator: "/",
  42. models: ["@cf/mistral/mistral-7b-instruct-v0.1"],
  43. },
  44. openai: {
  45. separator: "/",
  46. models: ["gpt-4o", "gpt-4o-mini"],
  47. },
  48. anthropic: {
  49. separator: "/",
  50. models: [
  51. "claude-3-5-sonnet-20241022",
  52. "claude-3-haiku-20240307",
  53. "claude-2",
  54. "claude-2.1",
  55. ],
  56. },
  57. other: {
  58. separator: "",
  59. models: ["together-ai-21.1b-41b"],
  60. },
  61. });
  62. });