Skip to content

Commit

Permalink
Introduce @mistral-medium Global Agent for paid accounts (#2953)
Browse files Browse the repository at this point in the history
* Use Mistral Small as default provider for mistral global agent

* ✨

* ✨

* Add mistral-medium global agent
  • Loading branch information
flvndvd authored Dec 19, 2023
1 parent de74fe1 commit e950961
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
43 changes: 43 additions & 0 deletions front/lib/api/assistant/global_agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CLAUDE_INSTANT_DEFAULT_MODEL_CONFIG,
GPT_3_5_TURBO_MODEL_CONFIG,
GPT_4_TURBO_MODEL_CONFIG,
MISTRAL_MEDIUM_MODEL_CONFIG,
MISTRAL_SMALL_MODEL_CONFIG,
} from "@dust-tt/types";
import { AgentConfigurationType, GlobalAgentStatus } from "@dust-tt/types";
Expand Down Expand Up @@ -240,6 +241,42 @@ async function _getClaudeGlobalAgent({
};
}

async function _getMistralMediumGlobalAgent({
plan,
settings,
}: {
plan: PlanType;
settings: GlobalAgentSettings | null;
}): Promise<AgentConfigurationType> {
let status = settings?.status ?? "disabled_by_admin";
if (plan.code === FREE_TEST_PLAN_CODE) {
status = "disabled_free_workspace";
}

return {
id: -1,
sId: GLOBAL_AGENTS_SID.MISTRAL_MEDIUM,
version: 0,
versionAuthorId: null,
name: "mistral-medium",
description: "Mistral latest larger model (8x7B Instruct, 32k context).",
pictureUrl: "https://dust.tt/static/systemavatar/mistral_avatar_full.png",
status,
scope: "global",
userListStatus: status === "active" ? "in-list" : "not-in-list",
generation: {
id: -1,
prompt: "",
model: {
providerId: MISTRAL_MEDIUM_MODEL_CONFIG.providerId,
modelId: MISTRAL_MEDIUM_MODEL_CONFIG.modelId,
},
temperature: 0.7,
},
action: null,
};
}

async function _getMistralSmallGlobalAgent({
settings,
}: {
Expand Down Expand Up @@ -642,6 +679,12 @@ export async function getGlobalAgent(
case GLOBAL_AGENTS_SID.CLAUDE:
agentConfiguration = await _getClaudeGlobalAgent({ settings, plan });
break;
case GLOBAL_AGENTS_SID.MISTRAL_MEDIUM:
agentConfiguration = await _getMistralMediumGlobalAgent({
plan,
settings,
});
break;
case GLOBAL_AGENTS_SID.MISTRAL_SMALL:
agentConfiguration = await _getMistralSmallGlobalAgent({ settings });
break;
Expand Down
2 changes: 2 additions & 0 deletions front/lib/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export enum GLOBAL_AGENTS_SID {
GPT35_TURBO = "gpt-3.5-turbo",
CLAUDE = "claude-2",
CLAUDE_INSTANT = "claude-instant-1",
MISTRAL_MEDIUM = "mistral-medium",
//!\ TEMPORARY WORKAROUND: Renaming 'mistral' to 'mistral-small' is not feasible since
// it interferes with the retrieval of ongoing conversations involving this agent.
// Needed to preserve ongoing chat integrity due to 'sId=mistral' references in legacy messages.
Expand All @@ -55,6 +56,7 @@ const CUSTOM_ORDER: string[] = [
GLOBAL_AGENTS_SID.GPT35_TURBO,
GLOBAL_AGENTS_SID.CLAUDE,
GLOBAL_AGENTS_SID.CLAUDE_INSTANT,
GLOBAL_AGENTS_SID.MISTRAL_MEDIUM,
GLOBAL_AGENTS_SID.MISTRAL_SMALL,
GLOBAL_AGENTS_SID.HELPER,
];
Expand Down
11 changes: 11 additions & 0 deletions types/src/front/lib/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const CLAUDE_INSTANT_DEFAULT_MODEL_CONFIG = {
} as const;

export const MISTRAL_7B_INSTRUCT_MODEL_ID = "mistral_7B_instruct" as const;
export const MISTRAL_MEDIUM_MODEL_ID = "mistral-medium" as const;
export const MISTRAL_SMALL_MODEL_ID = "mistral-small" as const;

export const MISTRAL_7B_DEFAULT_MODEL_CONFIG = {
Expand All @@ -79,6 +80,15 @@ export const MISTRAL_7B_DEFAULT_MODEL_CONFIG = {
largeModel: false,
} as const;

export const MISTRAL_MEDIUM_MODEL_CONFIG = {
providerId: "mistral",
modelId: MISTRAL_MEDIUM_MODEL_ID,
displayName: "Mistral Medium",
contextSize: 31500,
recommendedTopK: 16,
largeModel: true,
} as const;

export const MISTRAL_SMALL_MODEL_CONFIG = {
providerId: "mistral",
modelId: MISTRAL_SMALL_MODEL_ID,
Expand All @@ -105,6 +115,7 @@ export const SUPPORTED_MODEL_CONFIGS = [
CLAUDE_DEFAULT_MODEL_CONFIG,
CLAUDE_INSTANT_DEFAULT_MODEL_CONFIG,
MISTRAL_7B_DEFAULT_MODEL_CONFIG,
MISTRAL_MEDIUM_MODEL_CONFIG,
MISTRAL_SMALL_MODEL_CONFIG,
GEMINI_PRO_DEFAULT_MODEL_CONFIG,
] as const;
Expand Down

0 comments on commit e950961

Please sign in to comment.