From 3e85ea05e9a71341f04fdaaf12bdf5ce580d1c09 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 20 Feb 2025 11:28:26 -0500 Subject: [PATCH] Fix codestral --- core/llm/llms/VertexAI.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 {