File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
backend/src/llm-apis/vercel-ai-sdk Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { z } from 'zod'
2929import { System } from '../claude'
3030import { saveMessage } from '../message-cost-tracker'
3131import { vertexFinetuned } from './vertex-finetuned'
32+ import { logger } from 'common/util/logger'
3233
3334// TODO: We'll want to add all our models here!
3435const modelToAiSDKModel = ( model : Model ) : LanguageModelV1 => {
@@ -90,6 +91,12 @@ export const promptAiSdkStream = async function* (
9091 let finishedReasoning = false
9192
9293 for await ( const chunk of response . fullStream ) {
94+ if ( chunk . type === 'error' ) {
95+ logger . error ( { chunk } , 'Error from AI SDK' )
96+ if ( process . env . ENVIRONMENT !== 'prod' ) {
97+ throw new Error ( chunk . error as string )
98+ }
99+ }
93100 if ( chunk . type === 'reasoning' ) {
94101 if ( ! hasReasoning ) {
95102 hasReasoning = true
You can’t perform that action at this time.
0 commit comments