Skip to content

Commit

Permalink
Improve type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Hialus committed Apr 29, 2024
1 parent 2c4e2ea commit 272b01c
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions app/llm/external/openai_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

from openai import OpenAI
from openai.lib.azure import AzureOpenAI
from openai.types.chat import ChatCompletionMessage
from pydantic import Json
from openai.types.chat import ChatCompletionMessage, ChatCompletionMessageParam

from ...common.message_converters import map_str_to_role, map_role_to_str
from app.domain.data.text_message_content_dto import TextMessageContentDTO
Expand All @@ -17,17 +16,7 @@

def convert_to_open_ai_messages(
messages: list[PyrisMessage],
) -> list[
dict[
str,
Literal["user", "assistant", "system"]
| list[
dict[str, str | dict[str, str]]
| dict[str, str]
| dict[str, str | Json | Any]
],
]
]:
) -> list[ChatCompletionMessageParam]:
"""
Convert a list of PyrisMessage to a list of ChatCompletionMessageParam
"""
Expand Down

0 comments on commit 272b01c

Please sign in to comment.