Skip to content

Commit ba51103

Browse files
committed
fix incorrect messasge casting for github copilot model
1 parent ddbdf71 commit ba51103

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/LLMProviders/githubCopilotChatModel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { AIMessage, type BaseMessage, type MessageContent } from "@langchain/cor
66
import { type ChatResult, ChatGeneration } from "@langchain/core/outputs";
77
import { type CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
88
import { GitHubCopilotProvider } from "./githubCopilotProvider";
9+
import { extractTextFromChunk } from "@/utils";
910

1011
export interface CopilotChatModelParams extends BaseChatModelParams {
1112
provider: GitHubCopilotProvider;
@@ -53,7 +54,7 @@ export class CopilotChatModel extends BaseChatModel {
5354
): Promise<ChatResult> {
5455
const chatMessages = messages.map((m) => ({
5556
role: this._convertMessageType(m._getType()),
56-
content: m.content as string,
57+
content: extractTextFromChunk(m.content),
5758
}));
5859

5960
const response = await this.provider.sendChatMessage(chatMessages, this.modelName);

0 commit comments

Comments
 (0)