From 9f1e94bb673118fa4bb58bd4d808d9d1697a6bf3 Mon Sep 17 00:00:00 2001 From: Henry Fontanier Date: Wed, 11 Dec 2024 11:49:04 +0100 Subject: [PATCH] feat: managed setup for togetherai model --- front/components/providers/types.ts | 10 ++++ types/src/front/lib/api/credentials.ts | 2 + types/src/front/lib/assistant.ts | 77 ++++++++++++++++++++++++++ types/src/shared/feature_flags.ts | 1 + 4 files changed, 90 insertions(+) diff --git a/front/components/providers/types.ts b/front/components/providers/types.ts index cf0d7abd4e25e..846197d90108c 100644 --- a/front/components/providers/types.ts +++ b/front/components/providers/types.ts @@ -3,6 +3,7 @@ import { GoogleLogo, MistralLogo, OpenaiLogo, + PlanetIcon, } from "@dust-tt/sparkle"; import type { ModelConfig, SUPPORTED_MODEL_CONFIGS } from "@dust-tt/types"; import { @@ -16,6 +17,10 @@ import { MISTRAL_CODESTRAL_MODEL_CONFIG, MISTRAL_LARGE_MODEL_CONFIG, MISTRAL_SMALL_MODEL_CONFIG, + TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_CONFIG, + TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_CONFIG, + TOGETHERAI_QWEN_32B_PREVIEW_MODEL_CONFIG, + TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_CONFIG, } from "@dust-tt/types"; import type { ComponentType } from "react"; @@ -26,6 +31,7 @@ export const MODEL_PROVIDER_LOGOS: Record = { anthropic: AnthropicLogo, mistral: MistralLogo, google_ai_studio: GoogleLogo, + togetherai: PlanetIcon, }; export const USED_MODEL_CONFIGS: readonly ModelConfig[] = [ @@ -39,4 +45,8 @@ export const USED_MODEL_CONFIGS: readonly ModelConfig[] = [ MISTRAL_CODESTRAL_MODEL_CONFIG, GEMINI_PRO_DEFAULT_MODEL_CONFIG, GEMINI_FLASH_DEFAULT_MODEL_CONFIG, + TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_CONFIG, + TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_CONFIG, + TOGETHERAI_QWEN_32B_PREVIEW_MODEL_CONFIG, + TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_CONFIG, ] as const; diff --git a/types/src/front/lib/api/credentials.ts b/types/src/front/lib/api/credentials.ts index 09d0b095fc98b..b46075be20899 100644 --- a/types/src/front/lib/api/credentials.ts +++ b/types/src/front/lib/api/credentials.ts @@ -10,6 +10,7 @@ const { DUST_MANAGED_GOOGLE_AI_STUDIO_API_KEY = "", DUST_MANAGED_SERP_API_KEY = "", DUST_MANAGED_BROWSERLESS_API_KEY = "", + DUST_MANAGED_TOGETHERAI_API_KEY = "", } = process.env; export const credentialsFromProviders = ( @@ -77,5 +78,6 @@ export const dustManagedCredentials = (): CredentialsType => { GOOGLE_AI_STUDIO_API_KEY: DUST_MANAGED_GOOGLE_AI_STUDIO_API_KEY, SERP_API_KEY: DUST_MANAGED_SERP_API_KEY, BROWSERLESS_API_KEY: DUST_MANAGED_BROWSERLESS_API_KEY, + TOGETHERAI_API_KEY: DUST_MANAGED_TOGETHERAI_API_KEY, }; }; diff --git a/types/src/front/lib/assistant.ts b/types/src/front/lib/assistant.ts index 7695bafd51ab0..5563c444123cd 100644 --- a/types/src/front/lib/assistant.ts +++ b/types/src/front/lib/assistant.ts @@ -13,6 +13,7 @@ export const MODEL_PROVIDER_IDS = [ "anthropic", "mistral", "google_ai_studio", + "togetherai", ] as const; export type ModelProviderIdType = (typeof MODEL_PROVIDER_IDS)[number]; @@ -108,6 +109,14 @@ export const MISTRAL_CODESTRAL_MODEL_ID = "codestral-latest" as const; export const GEMINI_1_5_PRO_LATEST_MODEL_ID = "gemini-1.5-pro-latest" as const; export const GEMINI_1_5_FLASH_LATEST_MODEL_ID = "gemini-1.5-flash-latest" as const; +export const TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_ID = + "meta-llama/Llama-3.3-70B-Instruct-Turbo" as const; +export const TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_ID = + "Qwen/Qwen2.5-Coder-32B-Instruct" as const; +export const TOGETHERAI_QWEN_32B_PREVIEW_MODEL_ID = + "Qwen/QwQ-32B-Preview" as const; +export const TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_ID = + "Qwen/Qwen2-72B-Instruct" as const; export const MODEL_IDS = [ GPT_3_5_TURBO_MODEL_ID, @@ -130,6 +139,10 @@ export const MODEL_IDS = [ MISTRAL_CODESTRAL_MODEL_ID, GEMINI_1_5_PRO_LATEST_MODEL_ID, GEMINI_1_5_FLASH_LATEST_MODEL_ID, + TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_ID, + TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_ID, + TOGETHERAI_QWEN_32B_PREVIEW_MODEL_ID, + TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_ID, ] as const; export type ModelIdType = (typeof MODEL_IDS)[number]; @@ -522,6 +535,66 @@ export const GEMINI_FLASH_DEFAULT_MODEL_CONFIG: ModelConfigurationType = { supportsVision: false, }; +export const TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_CONFIG: ModelConfigurationType = + { + providerId: "togetherai", + modelId: TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_ID, + displayName: "Llama 3.3 70B Instruct Turbo", + contextSize: 128_000, + recommendedTopK: 32, + recommendedExhaustiveTopK: 128, // 65_536 + largeModel: true, + description: "Meta's fast, powerful and open source model (128k context).", + shortDescription: "Meta's open source model.", + isLegacy: false, + supportsVision: false, + }; + +export const TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_CONFIG: ModelConfigurationType = + { + providerId: "togetherai", + modelId: TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_ID, + displayName: "Qwen 2.5 Coder 32B Instruct", + contextSize: 32_000, + recommendedTopK: 16, + recommendedExhaustiveTopK: 56, // 28_672 + largeModel: false, + description: "Alibaba's fast model for coding (32k context).", + shortDescription: "Alibaba's fast coding model.", + isLegacy: false, + supportsVision: false, + }; + +export const TOGETHERAI_QWEN_32B_PREVIEW_MODEL_CONFIG: ModelConfigurationType = + { + providerId: "togetherai", + modelId: TOGETHERAI_QWEN_32B_PREVIEW_MODEL_ID, + displayName: "Qwen 32B Preview", + contextSize: 32_000, + recommendedTopK: 16, + recommendedExhaustiveTopK: 56, // 28_672 + largeModel: false, + description: "Alibaba's fast model (32k context).", + shortDescription: "Alibaba's fast model.", + isLegacy: false, + supportsVision: false, + }; + +export const TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_CONFIG: ModelConfigurationType = + { + providerId: "togetherai", + modelId: TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_ID, + displayName: "Qwen 72B Instruct", + contextSize: 32_000, + recommendedTopK: 16, + recommendedExhaustiveTopK: 56, // 28_672 + largeModel: false, + description: "Alibaba's powerful model (32k context).", + shortDescription: "Alibaba's powerful model.", + isLegacy: false, + supportsVision: false, + }; + export const SUPPORTED_MODEL_CONFIGS: ModelConfigurationType[] = [ GPT_3_5_TURBO_MODEL_CONFIG, GPT_4_TURBO_MODEL_CONFIG, @@ -543,6 +616,10 @@ export const SUPPORTED_MODEL_CONFIGS: ModelConfigurationType[] = [ MISTRAL_CODESTRAL_MODEL_CONFIG, GEMINI_PRO_DEFAULT_MODEL_CONFIG, GEMINI_FLASH_DEFAULT_MODEL_CONFIG, + TOGETHERAI_LLAMA_3_3_70B_INSTRUCT_TURBO_MODEL_CONFIG, + TOGETHERAI_QWEN_2_5_CODER_32B_INSTRUCT_MODEL_CONFIG, + TOGETHERAI_QWEN_32B_PREVIEW_MODEL_CONFIG, + TOGETHERAI_QWEN_72B_INSTRUCT_MODEL_CONFIG, ]; export type ModelConfig = (typeof SUPPORTED_MODEL_CONFIGS)[number]; diff --git a/types/src/shared/feature_flags.ts b/types/src/shared/feature_flags.ts index e22dabe705439..10976ecb8359e 100644 --- a/types/src/shared/feature_flags.ts +++ b/types/src/shared/feature_flags.ts @@ -11,6 +11,7 @@ export const WHITELISTABLE_FEATURES = [ "index_private_slack_channel", "conversations_jit_actions", "labs_trackers", + "togetherai_models", ] as const; export type WhitelistableFeature = (typeof WHITELISTABLE_FEATURES)[number]; export function isWhitelistableFeature(