From 260f240eb5c60cff0c0b364b18504f9d4fcb1aaf Mon Sep 17 00:00:00 2001 From: Simon Farshid Date: Tue, 17 Dec 2024 16:41:44 -0800 Subject: [PATCH] refactor: coderabbit suggestions --- python/assistant-stream/pyproject.toml | 2 +- python/assistant-stream/src/assistant_stream/create_run.py | 4 ++-- .../src/assistant_stream/modules/tool_call.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/assistant-stream/pyproject.toml b/python/assistant-stream/pyproject.toml index e8ba1565d..1612919d6 100644 --- a/python/assistant-stream/pyproject.toml +++ b/python/assistant-stream/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api" name = "assistant-stream" version = "0.0.5" authors = [ - { name="Simon Farshid", email="simon.farshid@outlook.com" }, + { name="Simon Farshid", email="simon@assistant-ui.com" }, ] readme = "README.md" requires-python = ">=3.8" diff --git a/python/assistant-stream/src/assistant_stream/create_run.py b/python/assistant-stream/src/assistant_stream/create_run.py index 3ebdfa0b1..509f653df 100644 --- a/python/assistant-stream/src/assistant_stream/create_run.py +++ b/python/assistant-stream/src/assistant_stream/create_run.py @@ -15,7 +15,7 @@ def __init__(self, queue): self._dispose_callbacks = [] self._stream_tasks = [] - def append_text(self, text_delta: str): + def append_text(self, text_delta: str) -> None: """Append a text delta to the stream.""" chunk = TextDeltaChunk(type="text-delta", text_delta=text_delta) self._loop.call_soon_threadsafe(self._queue.put_nowait, chunk) @@ -30,7 +30,7 @@ async def add_tool_call( self.add_stream(stream) return controller - def add_stream(self, stream: AsyncGenerator[AssistantStreamChunk, None]): + def add_stream(self, stream: AsyncGenerator[AssistantStreamChunk, None]) -> None: """Append a substream to the main stream.""" async def reader(): diff --git a/python/assistant-stream/src/assistant_stream/modules/tool_call.py b/python/assistant-stream/src/assistant_stream/modules/tool_call.py index bff8cb24e..d9aee3d3a 100644 --- a/python/assistant-stream/src/assistant_stream/modules/tool_call.py +++ b/python/assistant-stream/src/assistant_stream/modules/tool_call.py @@ -31,7 +31,7 @@ def __init__(self, queue, tool_name: str, tool_call_id: str): ) self.queue.put_nowait(begin_chunk) - def append_args_text(self, args_text_delta: str): + def append_args_text(self, args_text_delta: str) -> None: """Append an args text delta to the stream.""" chunk = ToolCallDeltaChunk( type="tool-call-delta", @@ -40,7 +40,7 @@ def append_args_text(self, args_text_delta: str): ) self.loop.call_soon_threadsafe(self.queue.put_nowait, chunk) - def set_result(self, result: Any): + def set_result(self, result: Any) -> None: """Set the result of the tool call.""" chunk = ToolResultChunk( @@ -51,7 +51,7 @@ def set_result(self, result: Any): self.loop.call_soon_threadsafe(self.queue.put_nowait, chunk) self.close() - def close(self): + def close(self) -> None: """Close the stream.""" self.loop.call_soon_threadsafe(self.queue.put_nowait, None)