Skip to content

Commit

Permalink
pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
PCSwingle committed Sep 27, 2024
1 parent 833f5bd commit 12f8526
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ dependencies = [
"pillow",
"tiktoken",
"httpx",
"jinja2"
"jinja2",
"termcolor",
]

[project.optional-dependencies]
Expand All @@ -32,5 +33,4 @@ dev = [
"pyright",
"pytest",
"pytest-asyncio",
"termcolor",
]
4 changes: 2 additions & 2 deletions spice/wrapped_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ def __init__(self, key, base_url=None):
self._client = AsyncOpenAI(api_key=key, base_url=base_url)

def _convert_messages(self, messages: Collection[SpiceMessage]) -> List[ChatCompletionMessageParam]:
converted_messages: List[ChatCompletionMessageParam] = []
converted_messages = []
for message in messages:
content_part = _spice_message_to_openai_content_part(message)
if (
converted_messages
and converted_messages[-1]["role"] == message.role
and (
("name" in converted_messages[-1]) == (message.name is not None)
and (message.name is None or message.name == converted_messages[-1]["name"])
and ("name" not in converted_messages[-1] or message.name == converted_messages[-1]["name"])
)
):
converted_messages[-1]["content"].append(content_part)
Expand Down

0 comments on commit 12f8526

Please sign in to comment.