From cd38500ac321be6f5a7387f11e61194fc1f2c1e6 Mon Sep 17 00:00:00 2001 From: FilipZmijewski Date: Tue, 10 Dec 2024 12:01:03 +0100 Subject: [PATCH] Fixes related to 1.3 SDK upgrade --- libs/langchain-community/src/document_compressors/ibm.ts | 2 +- libs/langchain-community/src/llms/ibm.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/langchain-community/src/document_compressors/ibm.ts b/libs/langchain-community/src/document_compressors/ibm.ts index 026219cc8fa8..7bfbafdc9e62 100644 --- a/libs/langchain-community/src/document_compressors/ibm.ts +++ b/libs/langchain-community/src/document_compressors/ibm.ts @@ -159,7 +159,7 @@ export class WatsonxRerank ? { index: document.index, relevanceScore: document.score, - input: document?.input, + input: document?.input.text, } : { index: document.index, diff --git a/libs/langchain-community/src/llms/ibm.ts b/libs/langchain-community/src/llms/ibm.ts index e0e7ef947737..75e65fd6873d 100644 --- a/libs/langchain-community/src/llms/ibm.ts +++ b/libs/langchain-community/src/llms/ibm.ts @@ -298,7 +298,7 @@ export class WatsonxLLM< const watsonxCallbacks = this.invocationCallbacks(options); if (stream) { const textStream = idOrName - ? await this.service.deploymentGenerateTextStream({ + ? this.service.deploymentGenerateTextStream({ idOrName, ...requestOptions, parameters: { @@ -309,7 +309,7 @@ export class WatsonxLLM< }, returnObject: true, }) - : await this.service.generateTextStream( + : this.service.generateTextStream( { input, parameters, @@ -319,7 +319,9 @@ export class WatsonxLLM< }, watsonxCallbacks ); - return textStream; + return (await textStream) as AsyncIterable< + WatsonXAI.ObjectStreamed + >; } else { const textGenerationPromise = idOrName ? this.service.deploymentGenerateText(