From 2f896307ea3d7157bb44e5c9b1f113e66fa5a7db Mon Sep 17 00:00:00 2001 From: Mateusz Szewczyk Date: Mon, 18 Nov 2024 16:08:56 +0100 Subject: [PATCH] update passing moderations v3 --- libs/ibm/langchain_ibm/llms.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/ibm/langchain_ibm/llms.py b/libs/ibm/langchain_ibm/llms.py index 935536b..4cd344e 100644 --- a/libs/ibm/langchain_ibm/llms.py +++ b/libs/ibm/langchain_ibm/llms.py @@ -323,9 +323,11 @@ def _create_llm_result(self, response: List[dict]) -> LLMResult: Generation( text=result.get("generated_text", ""), generation_info={"finish_reason": result.get("stop_reason")} - | {"moderations": moderations} - if (moderations := result.get("moderations")) - else {}, + | ( + {"moderations": moderations} + if (moderations := result.get("moderations")) + else {} + ), ) ] for res in response