Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Feat/Add DEVELOPER role for openai o1 #10033

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ class OpenAIChatPromptExecutionSettings(OpenAIPromptExecutionSettings):
dict[str, Any] | None,
Field(description="Additional options to pass when streaming is used. Do not set this manually."),
] = None
max_completion_tokens: Annotated[
int | None,
Field(
gt=0,
description="A maximum limit on total tokens for completion, including both output and reasoning tokens.",
),
] = None
reasoning_effort: Annotated[
Literal["low", "medium", "high"] | None,
Field(
description="Adjusts reasoning effort (low/medium/high). Lower values reduce response time and token usage."
),
] = None

@field_validator("functions", "function_call", mode="after")
@classmethod
Expand Down
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"
Loading