Refactor chat route to remove mistral dependency and update provider registry

This commit is contained in:
zaidmukaddam 2024-10-16 00:04:44 +05:30
parent c90e72664b
commit dc104ea3ca

View File

@ -1,6 +1,5 @@
import { z } from "zod";
import { createAzure } from '@ai-sdk/azure';
import { mistral } from '@ai-sdk/mistral';
import {
convertToCoreMessages,
streamText,
@ -50,7 +49,6 @@ const anthropicVertex = createAnthropicVertex({
const registry = experimental_createProviderRegistry({
anthropicVertex,
azure,
mistral,
});
function sanitizeUrl(url: string): string {
@ -73,7 +71,7 @@ export async function POST(req: Request) {
const result = await streamText({
model: registry.languageModel(model),
messages: convertToCoreMessages(messages),
temperature: provider === "azure" ? 0.72 : provider === "mistral" ? 0.5 : 0,
temperature: provider === "azure" ? 0.72 : 0,
topP: 0.5,
frequencyPenalty: 0,
presencePenalty: 0,