diff --git a/ai/models.ts b/ai/models.ts index f68fe32..d65e774 100644 --- a/ai/models.ts +++ b/ai/models.ts @@ -20,12 +20,6 @@ export const models: Array = [ apiIdentifier: 'gpt-4o', description: 'For complex, multi-step tasks', }, - { - id: 'gpt-4o-blocks', - label: 'GPT 4o with Blocks', - apiIdentifier: 'gpt-4o', - description: 'Collaborate with writing', - }, ] as const; export const DEFAULT_MODEL_NAME: string = 'gpt-4o-mini'; diff --git a/ai/prompts.ts b/ai/prompts.ts index 535c030..c9eba60 100644 --- a/ai/prompts.ts +++ b/ai/prompts.ts @@ -9,7 +9,6 @@ export const blocksPrompt = ` - When explicitly requested to create a document **When NOT to use \`createDocument\`:** - - For short content (<10 lines) - For informational/explanatory content - For conversational responses - When asked to keep it in chat @@ -24,3 +23,5 @@ export const blocksPrompt = ` export const regularPrompt = 'You are a friendly assistant! Keep your responses concise and helpful.'; + +export const systemPrompt = `${regularPrompt}\n\n${blocksPrompt}`; diff --git a/app/(chat)/api/chat/route.ts b/app/(chat)/api/chat/route.ts index ec73b3e..1b62443 100644 --- a/app/(chat)/api/chat/route.ts +++ b/app/(chat)/api/chat/route.ts @@ -9,7 +9,7 @@ import { z } from 'zod'; import { customModel } from '@/ai'; import { models } from '@/ai/models'; -import { blocksPrompt, regularPrompt } from '@/ai/prompts'; +import { blocksPrompt, regularPrompt, systemPrompt } from '@/ai/prompts'; import { auth } from '@/app/(auth)/auth'; import { deleteChatById, @@ -45,6 +45,8 @@ const blocksTools: AllowedTools[] = [ const weatherTools: AllowedTools[] = ['getWeather']; +const allTools: AllowedTools[] = [...blocksTools, ...weatherTools]; + export async function POST(request: Request) { const { id, @@ -89,11 +91,10 @@ export async function POST(request: Request) { const result = await streamText({ model: customModel(model.apiIdentifier), - system: modelId === 'gpt-4o-blocks' ? blocksPrompt : regularPrompt, + system: systemPrompt, messages: coreMessages, maxSteps: 5, - experimental_activeTools: - modelId === 'gpt-4o-blocks' ? blocksTools : weatherTools, + experimental_activeTools: allTools, tools: { getWeather: { description: 'Get the current weather at a location',