Remove blocks as model and switch automatically (#504)

This commit is contained in:
Jeremy 2024-11-08 18:12:54 +03:00 committed by GitHub
parent 58117f932f
commit c5c85ca7e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 11 deletions

View file

@ -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',