From 38ed26897c06fbbd7edbec90a62e74ac9d5523f3 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 +++ .../workspace/ProviderManagementModal.tsx | 1 + sdks/js/src/types.ts | 5 ++ types/src/front/lib/api/credentials.ts | 2 + types/src/front/lib/assistant.ts | 77 +++++++++++++++++++ 5 files changed, 95 insertions(+) diff --git a/front/components/providers/types.ts b/front/components/providers/types.ts index cf0d7abd4e25..846197d90108 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/front/components/workspace/ProviderManagementModal.tsx b/front/components/workspace/ProviderManagementModal.tsx index 714196381b6e..7695d889d759 100644 --- a/front/components/workspace/ProviderManagementModal.tsx +++ b/front/components/workspace/ProviderManagementModal.tsx @@ -32,6 +32,7 @@ const prettyfiedProviderNames: { [key in ModelProviderIdType]: string } = { anthropic: "Anthropic", mistral: "Mistral AI", google_ai_studio: "Google", + togetherai: "TogetherAI", }; const modelProviders: Record = diff --git a/sdks/js/src/types.ts b/sdks/js/src/types.ts index 127dab09bcf8..5159927bbd9f 100644 --- a/sdks/js/src/types.ts +++ b/sdks/js/src/types.ts @@ -9,6 +9,7 @@ const ModelProviderIdSchema = FlexibleEnumSchema([ "anthropic", "mistral", "google_ai_studio", + "togetherai", ]); const ModelLLMIdSchema = FlexibleEnumSchema([ @@ -32,6 +33,10 @@ const ModelLLMIdSchema = FlexibleEnumSchema([ "codestral-latest", "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", + "meta-llama/Llama-3.3-70B-Instruct-Turbo", + "Qwen/Qwen2.5-Coder-32B-Instruct", + "Qwen/QwQ-32B-Preview", + "Qwen/Qwen2-72B-Instruct", ]); const EmbeddingProviderIdSchema = FlexibleEnumSchema(["openai", "mistral"]); diff --git a/types/src/front/lib/api/credentials.ts b/types/src/front/lib/api/credentials.ts index 09d0b095fc98..b46075be2089 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 7695bafd51ab..5563c444123c 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];