mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	clean up anthropic constant locations
This commit is contained in:
		
							parent
							
								
									a5488771ae
								
							
						
					
					
						commit
						997edd8de8
					
				@ -4,14 +4,6 @@ import log from "../../services/log.js";
 | 
				
			|||||||
import type { Request, Response } from "express";
 | 
					import type { Request, Response } from "express";
 | 
				
			||||||
import { PROVIDER_CONSTANTS } from '../../services/llm/constants/provider_constants.js';
 | 
					import { PROVIDER_CONSTANTS } from '../../services/llm/constants/provider_constants.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Map of simplified model names to full model names with versions
 | 
					 | 
				
			||||||
const MODEL_MAPPING: Record<string, string> = {
 | 
					 | 
				
			||||||
    'claude-3-opus': 'claude-3-opus-20240229',
 | 
					 | 
				
			||||||
    'claude-3-sonnet': 'claude-3-sonnet-20240229',
 | 
					 | 
				
			||||||
    'claude-3-haiku': 'claude-3-haiku-20240307',
 | 
					 | 
				
			||||||
    'claude-2': 'claude-2.1'
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Interface for Anthropic model entries
 | 
					// Interface for Anthropic model entries
 | 
				
			||||||
interface AnthropicModel {
 | 
					interface AnthropicModel {
 | 
				
			||||||
    id: string;
 | 
					    id: string;
 | 
				
			||||||
 | 
				
			|||||||
@ -4,8 +4,29 @@ export const PROVIDER_CONSTANTS = {
 | 
				
			|||||||
        BETA_VERSION: 'messages-2023-12-15',
 | 
					        BETA_VERSION: 'messages-2023-12-15',
 | 
				
			||||||
        BASE_URL: 'https://api.anthropic.com',
 | 
					        BASE_URL: 'https://api.anthropic.com',
 | 
				
			||||||
        DEFAULT_MODEL: 'claude-3-haiku-20240307',
 | 
					        DEFAULT_MODEL: 'claude-3-haiku-20240307',
 | 
				
			||||||
 | 
					        // Model mapping for simplified model names to their full versions
 | 
				
			||||||
 | 
					        MODEL_MAPPING: {
 | 
				
			||||||
 | 
					            'claude-3.7-sonnet': 'claude-3-7-sonnet-20240620',
 | 
				
			||||||
 | 
					            'claude-3.5-haiku': 'claude-3-5-haiku-20240307',
 | 
				
			||||||
 | 
					            'claude-3-opus': 'claude-3-opus-20240229',
 | 
				
			||||||
 | 
					            'claude-3-sonnet': 'claude-3-sonnet-20240229',
 | 
				
			||||||
 | 
					            'claude-3-haiku': 'claude-3-haiku-20240307',
 | 
				
			||||||
 | 
					            'claude-2': 'claude-2.1'
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        // These are the currently available models from Anthropic
 | 
					        // These are the currently available models from Anthropic
 | 
				
			||||||
        AVAILABLE_MODELS: [
 | 
					        AVAILABLE_MODELS: [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                id: 'claude-3-7-sonnet-20240620',
 | 
				
			||||||
 | 
					                name: 'Claude 3.7 Sonnet',
 | 
				
			||||||
 | 
					                description: 'Most intelligent model with hybrid reasoning capabilities',
 | 
				
			||||||
 | 
					                maxTokens: 4096
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                id: 'claude-3-5-haiku-20240307',
 | 
				
			||||||
 | 
					                name: 'Claude 3.5 Haiku',
 | 
				
			||||||
 | 
					                description: 'Improved version of Haiku with better performance',
 | 
				
			||||||
 | 
					                maxTokens: 4096
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                id: 'claude-3-opus-20240229',
 | 
					                id: 'claude-3-opus-20240229',
 | 
				
			||||||
                name: 'Claude 3 Opus',
 | 
					                name: 'Claude 3 Opus',
 | 
				
			||||||
 | 
				
			|||||||
@ -9,14 +9,6 @@ interface AnthropicMessage {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class AnthropicService extends BaseAIService {
 | 
					export class AnthropicService extends BaseAIService {
 | 
				
			||||||
    // Map of simplified model names to full model names with versions
 | 
					 | 
				
			||||||
    private static MODEL_MAPPING: Record<string, string> = {
 | 
					 | 
				
			||||||
        'claude-3-opus': 'claude-3-opus-20240229',
 | 
					 | 
				
			||||||
        'claude-3-sonnet': 'claude-3-sonnet-20240229',
 | 
					 | 
				
			||||||
        'claude-3-haiku': 'claude-3-haiku-20240307',
 | 
					 | 
				
			||||||
        'claude-2': 'claude-2.1'
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        super('Anthropic');
 | 
					        super('Anthropic');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user