Skip to content

Commit

Permalink
python: add developer role to AuthorRole, ChatHistory for openai o1
Browse files Browse the repository at this point in the history
  • Loading branch information
ymuichiro committed Dec 24, 2024
1 parent 7bfda00 commit 0c5fdb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/semantic_kernel/contents/chat_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ def add_system_message_list(self, content: list[KernelContent], **kwargs: Any) -
"""Add a system message to the chat history."""
self.add_message(message=self._prepare_for_add(role=AuthorRole.SYSTEM, items=content, **kwargs))

@singledispatchmethod
def add_developer_message(self, content: str | list[KernelContent], **kwargs) -> None:
"""Add a system message to the chat history."""
raise NotImplementedError

@add_developer_message.register
def add_developer_message_str(self, content: str, **kwargs: Any) -> None:
"""Add a system message to the chat history."""
self.add_message(message=self._prepare_for_add(role=AuthorRole.DEVELOPER, content=content, **kwargs))

@add_developer_message.register(list)
def add_developer_message_list(self, content: list[KernelContent], **kwargs: Any) -> None:
"""Add a system message to the chat history."""
self.add_message(message=self._prepare_for_add(role=AuthorRole.DEVELOPER, items=content, **kwargs))

@singledispatchmethod
def add_user_message(self, content: str | list[KernelContent], **kwargs: Any) -> None:
"""Add a user message to the chat history."""
Expand Down
1 change: 1 addition & 0 deletions python/semantic_kernel/contents/utils/author_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ class AuthorRole(str, Enum):
USER = "user"
ASSISTANT = "assistant"
TOOL = "tool"
DEVELOPER = "developer"

0 comments on commit 0c5fdb0

Please sign in to comment.