diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 9f52d3c6c..0e0910330 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -263,7 +263,9 @@ class VertexAI extends BaseLLM { }); for await (const chunk of streamSse(response)) { - yield chunk.choices[0].delta.content; + if (chunk.choices?.[0].delta) { + yield chunk.choices[0].delta.content; + } } } @@ -358,7 +360,7 @@ class VertexAI extends BaseLLM { } supportsFim(): boolean { - return ["code-gecko", "codestral-latest"].includes(this.model); + return this.model.includes("code-gecko") || this.model.includes("codestral"); } protected async _embed(chunks: string[]): Promise {