/**
 * The following code is modified based on
 * https://github.com/token-js/token.js/blob/main/src/models.ts
 *
 * MIT License
 * Copyright (c) 2024 RPate97
 * https://github.com/token-js/token.js/blob/main/LICENSE
 */

export const TableDisplayNames = {
  models: 'Model',
  supportsCompletion: 'Chat Completion',
  supportsStreaming: 'Streaming',
  supportsJSON: 'JSON Output',
  supportsImages: 'Image Input',
  supportsToolCalls: 'Function Calling',
  supportsN: 'N > 1',
};
export const models = {
  openai: {
    models: [
      // https://platform.openai.com/docs/models/gpt-image-1
      'gpt-image-1',
      'gpt-4.5-preview',
      'gpt-4.5-preview-2025-02-27',
      'gpt-4.1',
      'gpt-4.1-2025-04-14',
      'gpt-4o',
      'gpt-4o-mini',
      'gpt-4o-2024-05-13',
      'gpt-4o-2024-08-06',
      'gpt-4-turbo',
      'gpt-4-turbo-2024-04-09',
      'gpt-4-0125-preview',
      'gpt-4-turbo-preview',
      'gpt-4-1106-preview',
      'gpt-4-vision-preview',
      'gpt-4',
      'gpt-4-0314',
      'gpt-4-0613',
      'gpt-4-32k',
      'gpt-4-32k-0314',
      'gpt-4-32k-0613',
      'gpt-3.5-turbo',
      'gpt-3.5-turbo-16k',
      'gpt-3.5-turbo-0301',
      'gpt-3.5-turbo-0613',
      'gpt-3.5-turbo-1106',
      'gpt-3.5-turbo-0125',
      'gpt-3.5-turbo-16k-0613',
      'o3-mini',
      'o1-mini',
      'o1-mini-2024-09-12',
      'o1-preview',
      'o1-preview-2024-09-12',
    ] as const,
    supportsCompletion: true,
    supportsStreaming: [
      'gpt-4.1',
      'gpt-4.1-2025-04-14',
      'gpt-4.5-preview',
      'gpt-4.5-preview-2025-02-27',
      'gpt-4o',
      'gpt-4o-mini',
      'gpt-4o-2024-05-13',
      'gpt-4o-2024-08-06',
      'gpt-4-turbo',
      'gpt-4-turbo-2024-04-09',
      'gpt-4-0125-preview',
      'gpt-4-turbo-preview',
      'gpt-4-1106-preview',
      'gpt-4-vision-preview',
      'gpt-4',
      'gpt-4-0314',
      'gpt-4-0613',
      'gpt-4-32k',
      'gpt-4-32k-0314',
      'gpt-4-32k-0613',
      'gpt-3.5-turbo',
      'gpt-3.5-turbo-16k',
      'gpt-3.5-turbo-0301',
      'gpt-3.5-turbo-0613',
      'gpt-3.5-turbo-1106',
      'gpt-3.5-turbo-0125',
      'gpt-3.5-turbo-16k-0613',
      'o3-mini',
    ] as const,
    supportsJSON: [
      'gpt-4.1',
      'gpt-4.1-2025-04-14',
      'gpt-4.5-preview',
      'gpt-4.5-preview-2025-02-27',
      'gpt-4o',
      'gpt-4o-mini',
      'gpt-4o-2024-05-13',
      'gpt-4o-2024-08-06',
      'gpt-4-turbo',
      'gpt-4-turbo-2024-04-09',
      'gpt-4-0125-preview',
      'gpt-4-turbo-preview',
      'gpt-4-1106-preview',
      'gpt-4-vision-preview',
      'gpt-3.5-turbo',
      'gpt-3.5-turbo-1106',
      'gpt-3.5-turbo-0125',
      'o3-mini',
    ] as const,
    supportsImages: [
      'gpt-4.1',
      'gpt-4.1-2025-04-14',
      'gpt-4.5-preview',
      'gpt-4.5-preview-2025-02-27',
      'gpt-4o',
      'gpt-4o-mini',
      'gpt-4o-2024-05-13',
      'gpt-4o-2024-08-06',
      'gpt-4-turbo',
      'gpt-4-turbo-2024-04-09',
      'gpt-4-0125-preview',
      'gpt-4-turbo-preview',
      'gpt-4-1106-preview',
      'gpt-4-vision-preview',
    ] as const,
    supportsToolCalls: [
      'gpt-4.1',
      'gpt-4.1-2025-04-14',
      'gpt-4.5-preview',
      'gpt-4.5-preview-2025-02-27',
      'gpt-4o',
      'gpt-4o-mini',
      'gpt-4o-2024-05-13',
      'gpt-4o-2024-08-06',
      'gpt-4-turbo',
      'gpt-4-turbo-2024-04-09',
      'gpt-4-turbo-preview',
      'gpt-4-0125-preview',
      'gpt-4-1106-preview',
      'gpt-4',
      'gpt-4-0613',
      'gpt-3.5-turbo',
      'gpt-3.5-turbo-0125',
      'gpt-3.5-turbo-1106',
      'gpt-3.5-turbo-0613',
      'o3-mini',
    ] as const,
    supportsN: true,
    generateDocs: true,
  },
  'openai-non-streaming': {
    models: [
      'gpt-image-1', // Example model that might not support streaming natively
      'o1-mini',
      'o1-mini-2024-09-12',
      'o1-preview',
      'o1-preview-2024-09-12',
    ] as const,
    supportsCompletion: true,
    // All models are marked false for native streaming since we're simulating it
    supportsStreaming: [] as const,
    supportsJSON: ['o1-mini', 'o1-mini-2024-09-12', 'o1-preview', 'o1-preview-2024-09-12'] as const,
    supportsImages: ['gpt-image-1'] as const,
    supportsToolCalls: [
      'o1-mini',
      'o1-mini-2024-09-12',
      'o1-preview',
      'o1-preview-2024-09-12',
    ] as const,
    supportsN: true,
    generateDocs: true,
  },
  ai21: {
    models: ['jamba-instruct'] as const,
    supportsCompletion: true,
    supportsStreaming: ['jamba-instruct'] as const,
    supportsJSON: [] as const,
    supportsImages: [] as const,
    supportsToolCalls: [] as const,
    supportsN: true,
    generateDocs: true,
  },
  anthropic: {
    models: [
      'claude-3-7-sonnet-latest',
      'claude-3-7-sonnet-20250219',
      'claude-3-5-sonnet-latest',
      'claude-3-5-sonnet-20240620',
      'claude-3-5-haiku-20241022',
      'claude-3-opus-20240229',
      'claude-3-sonnet-20240229',
      'claude-3-haiku-20240307',
      'claude-2.1',
      'claude-2.0',
      'claude-instant-1.2',
    ] as const,
    supportsCompletion: true,
    supportsStreaming: [
      'claude-3-7-sonnet-latest',
      'claude-3-7-sonnet-20250219',
      'claude-3-5-sonnet-latest',
      'claude-3-5-sonnet-20240620',
      'claude-3-5-haiku-20241022',
      'claude-3-opus-20240229',
      'claude-3-sonnet-20240229',
      'claude-3-haiku-20240307',
      'claude-2.1',
      'claude-2.0',
      'claude-instant-1.2',
    ] as const,
    supportsJSON: [] as const,
    supportsImages: [
      'claude-3-7-sonnet-latest',
      'claude-3-7-sonnet-20250219',
      'claude-3-5-sonnet-latest',
      'claude-3-5-sonnet-20240620',
      'claude-3-opus-20240229',
      'claude-3-sonnet-20240229',
      'claude-3-haiku-20240307',
    ] as const,
    supportsToolCalls: [
      'claude-3-7-sonnet-latest',
      'claude-3-7-sonnet-20250219',
      'claude-3-5-sonnet-latest',
      'claude-3-5-sonnet-20240620',
      'claude-3-5-haiku-20241022',
      'claude-3-opus-20240229',
      'claude-3-sonnet-20240229',
      'claude-3-haiku-20240307',
    ] as const,
    supportsN: false,
    generateDocs: true,
  },
  gemini: {
    models: [
      'gemini-2.0-flash-001',
      'gemini-2.0-flash-lite-preview-02-05',
      'gemini-1.5-pro',
      'gemini-1.5-flash',
      'gemini-1.5-flash-8b',
      'gemini-1.0-pro',
    ] as const,
    supportsCompletion: true,
    supportsStreaming: [
      'gemini-2.0-flash-001',
      'gemini-2.0-flash-lite-preview-02-05',
      'gemini-1.5-pro',
      'gemini-1.5-flash',
      'gemini-1.5-flash-8b',
      'gemini-1.0-pro',
    ] as const,
    supportsJSON: [
      'gemini-2.0-flash-001',
      'gemini-2.0-flash-lite-preview-02-05',
      'gemini-1.5-pro',
      'gemini-1.5-flash',
      'gemini-1.5-flash-8b',
    ] as const,
    supportsImages: [
      'gemini-2.0-flash-001',
      'gemini-2.0-flash-lite-preview-02-05',
      'gemini-1.5-pro',
      'gemini-1.5-flash',
      'gemini-1.5-flash-8b',
    ] as const,
    supportsToolCalls: [
      'gemini-2.0-flash-001',
      'gemini-1.5-pro',
      'gemini-1.5-flash',
      'gemini-1.5-flash-8b',
      'gemini-1.0-pro',
    ] as const,
    supportsN: true,
    generateDocs: true,
  },
  mistral: {
    models: [
      'open-mistral-7b',
      'mistral-tiny-2312',
      'open-mixtral-8x7b',
      'mistral-small-2312',
      'open-mixtral-8x22b',
      'open-mixtral-8x22b-2404',
      'mistral-small-latest',
      'mistral-small-2402',
      'mistral-medium-latest',
      'mistral-medium-2312',
      'mistral-large-latest',
      'mistral-large-2402',
      'codestral-latest',
      'codestral-2405',
      'codestral-mamba-2407',
    ] as const,
    supportsCompletion: true,
    supportsStreaming: [
      'open-mistral-7b',
      'mistral-tiny-2312',
      'open-mixtral-8x7b',
      'mistral-small-2312',
      'open-mixtral-8x22b',
      'open-mixtral-8x22b-2404',
      'mistral-small-latest',
      'mistral-small-2402',
      'mistral-medium-latest',
      'mistral-medium-2312',
      'mistral-large-latest',
      'mistral-large-2402',
      'codestral-latest',
      'codestral-2405',
      'codestral-mamba-2407',
    ] as const,
    // Mistral claims that all of its models support JSON, but several of their weaker models either
    // fail to produce valid JSON or produce very low quality results for the following prompt:
    // "Generate a JSON that maps ten athletes to their jersey numbers". We removed these models
    // from the list to ensure that we only support models that reliably produce decent results.
    supportsJSON: [
      'open-mistral-7b',
      'mistral-tiny-2312',
      'open-mixtral-8x22b',
      'open-mixtral-8x22b-2404',
      'mistral-large-latest',
      'mistral-large-2402',
      'codestral-latest',
      'codestral-2405',
      'codestral-mamba-2407',
    ] as const,
    supportsImages: [] as const,
    supportsToolCalls: [
      'open-mixtral-8x22b',
      'open-mixtral-8x22b-2404',
      'mistral-small-latest',
      'mistral-small-2402',
      'mistral-large-latest',
      'mistral-large-2402',
      'codestral-mamba-2407',
    ] as const,
    supportsN: false,
    generateDocs: true,
  },
  groq: {
    models: [
      'llama-3.3-70b-versatile',
      'llama-3.1-8b-instant',
      'llama3-8b-8192',
      'llama3-70b-8192',
      'mixtral-8x7b-32768',
      'gemma-7b-it',
      'gemma2-9b-it',
    ] as const,
    supportsCompletion: true,
    supportsStreaming: [
      'llama-3.3-70b-versatile',
      'llama-3.1-8b-instant',
      'llama3-8b-8192',
      'llama3-70b-8192',
      'mixtral-8x7b-32768',
      'gemma-7b-it',
      'gemma2-9b-it',
    ] as const,
    // Groq claims that all of its models support JSON, but some of the weaker models either fail to
    // produce valid JSON or produce very low quality results for the following prompt: "Generate a
    // JSON that maps ten athletes to their jersey numbers". We removed these models from the list
    // to ensure that we only support models that reliably produce decent results.
    supportsJSON: [
      'llama-3.3-70b-versatile',
      'llama-3.1-8b-instant',
      'llama3-70b-8192',
      'gemma-7b-it',
      'gemma2-9b-it',
    ] as const,
    supportsImages: [] as const,
    supportsToolCalls: [] as const,
    supportsN: false,
    generateDocs: true,
  },
  perplexity: {
    models: [
      'llama-3.1-sonar-small-128k-online',
      'llama-3.1-sonar-large-128k-online',
      'llama-3.1-sonar-huge-128k-online',
    ] as const,
    supportsCompletion: true,
    supportsStreaming: [
      'llama-3.1-sonar-small-128k-online',
      'llama-3.1-sonar-large-128k-online',
      'llama-3.1-sonar-huge-128k-online',
    ] as const,
    supportsJSON: [] as const,
    supportsImages: [] as const,
    supportsToolCalls: [] as const,
    supportsN: false,
    generateDocs: true,
  },
  openrouter: {
    models: true,
    supportsCompletion: true,
    supportsStreaming: true,
    supportsJSON: true,
    supportsImages: true,
    supportsToolCalls: true,
    supportsN: true,
    generateDocs: false,
  },
  'openai-compatible': {
    models: true,
    supportsCompletion: true,
    supportsStreaming: true,
    supportsJSON: true,
    supportsImages: true,
    supportsToolCalls: true,
    supportsN: true,
    generateDocs: false,
  },
  'azure-openai': {
    models: true,
    supportsCompletion: true,
    supportsStreaming: true,
    supportsJSON: true,
    supportsImages: true,
    supportsToolCalls: true,
    supportsN: true,
    generateDocs: false,
  },
};
