feat: dynamic model discovery from vercel ai gateway (#1353)

This commit is contained in:
josh 2025-12-14 21:26:49 +00:00 committed by GitHub
parent 2b0b42d144
commit b1da86062e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 7426 additions and 2277 deletions

View file

@ -1,7 +1,7 @@
import { streamObject } from "ai";
import { z } from "zod";
import { codePrompt, updateDocumentPrompt } from "@/lib/ai/prompts";
import { myProvider } from "@/lib/ai/providers";
import { getArtifactModel } from "@/lib/ai/providers";
import { createDocumentHandler } from "@/lib/artifacts/server";
export const codeDocumentHandler = createDocumentHandler<"code">({
@ -10,7 +10,7 @@ export const codeDocumentHandler = createDocumentHandler<"code">({
let draftContent = "";
const { fullStream } = streamObject({
model: myProvider.languageModel("artifact-model"),
model: getArtifactModel(),
system: codePrompt,
prompt: title,
schema: z.object({
@ -43,7 +43,7 @@ export const codeDocumentHandler = createDocumentHandler<"code">({
let draftContent = "";
const { fullStream } = streamObject({
model: myProvider.languageModel("artifact-model"),
model: getArtifactModel(),
system: updateDocumentPrompt(document.content, "code"),
prompt: description,
schema: z.object({