Skip to content

Commit

Permalink
refactor: coderabbit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom committed Dec 18, 2024
1 parent 27a1e82 commit 260f240
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/assistant-stream/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions python/assistant-stream/src/assistant_stream/create_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(
Expand All @@ -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)

Expand Down

0 comments on commit 260f240

Please sign in to comment.