From ce31ee32c033b2163ef87d7804ed493c975c8a27 Mon Sep 17 00:00:00 2001 From: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com> Date: Thu, 24 Apr 2025 11:38:13 +0530 Subject: [PATCH] Use specific model snapshots --- api/src/backend/api/models.py | 4 ++-- ui/app/(ai)/analyst/route.ts | 16 ++++++++-------- ui/app/(prowler)/lighthouse/config/page.tsx | 7 +++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/api/src/backend/api/models.py b/api/src/backend/api/models.py index 5849133cb7..7eeb00cd22 100644 --- a/api/src/backend/api/models.py +++ b/api/src/backend/api/models.py @@ -1335,8 +1335,8 @@ class LighthouseConfig(RowLevelSecurityProtectedModel): name = models.CharField(max_length=100, validators=[MinLengthValidator(3)]) api_key = models.BinaryField(blank=False, null=False) - model = models.CharField(max_length=50, default="gpt-4o") - temperature = models.FloatField(default=0.7) + model = models.CharField(max_length=50, default="gpt-4o-2024-08-06") + temperature = models.FloatField(default=0) max_tokens = models.IntegerField(default=4000) business_context = models.TextField( blank=True, diff --git a/ui/app/(ai)/analyst/route.ts b/ui/app/(ai)/analyst/route.ts index afc865db1c..146ec4807b 100644 --- a/ui/app/(ai)/analyst/route.ts +++ b/ui/app/(ai)/analyst/route.ts @@ -80,22 +80,22 @@ ${ const initializeModels = async () => { const apiKey = await getAIKey(); + const aiConfig = await getAIConfiguration(); + const modelConfig = aiConfig?.data?.attributes; // Initialize models without API keys const llm = new ChatOpenAI({ - model: "gpt-4o", - temperature: 0, - topP: 0, - maxTokens: 5000, + model: modelConfig?.model || "gpt-4", + temperature: modelConfig?.temperature || 0, + maxTokens: modelConfig?.max_tokens || 5000, apiKey: apiKey, tags: ["agent"], }); const supervisorllm = new ChatOpenAI({ - model: "gpt-4o", - temperature: 0, - topP: 0, - maxTokens: 5000, + model: modelConfig?.model || "gpt-4", + temperature: modelConfig?.temperature || 0, + maxTokens: modelConfig?.max_tokens || 5000, apiKey: apiKey, streaming: true, tags: ["supervisor"], diff --git a/ui/app/(prowler)/lighthouse/config/page.tsx b/ui/app/(prowler)/lighthouse/config/page.tsx index 2df8e5ed37..07b019e438 100644 --- a/ui/app/(prowler)/lighthouse/config/page.tsx +++ b/ui/app/(prowler)/lighthouse/config/page.tsx @@ -207,10 +207,13 @@ export default function ChatbotConfig() { size="md" isRequired > - + GPT-4o (Recommended) - + GPT-4o Mini