From 40e38e66c5dcc48548c2d619ebf22e82bd9a3f8c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:38:52 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- packages/jupyter-ai/jupyter_ai/chat_handlers/base.py | 6 +++--- packages/jupyter-ai/jupyter_ai/chat_handlers/default.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py index 437dfd68f..97392168a 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py @@ -1,8 +1,8 @@ import argparse +import contextlib import os import time import traceback -import contextlib from typing import ( TYPE_CHECKING, Awaitable, @@ -21,9 +21,9 @@ from jupyter_ai.models import ( AgentChatMessage, ChatMessage, + ClosePendingMessage, HumanChatMessage, PendingMessage, - ClosePendingMessage, ) from jupyter_ai_magics import Persona from jupyter_ai_magics.providers import BaseProvider @@ -199,7 +199,7 @@ def reply(self, response: str, human_msg: Optional[HumanChatMessage] = None): handler.broadcast_message(agent_msg) break - + def start_pending(self, text: str, ellipsis: bool = True) -> str: """ Sends a pending message to the client. diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py index a09660837..dddbf1417 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py @@ -48,5 +48,7 @@ def create_llm_chain( async def process_message(self, message: HumanChatMessage): self.get_llm_chain() with self.pending(PENDING_MESSAGE): - response = await self.llm_chain.apredict(input=message.body, stop=["\nHuman:"]) + response = await self.llm_chain.apredict( + input=message.body, stop=["\nHuman:"] + ) self.reply(response, message)