Skip to content

Commit 4ba1cbd

Browse files
authored
add initial converter class (#41619)
* add initial converter class * update * changes * import handling * handle import erorr in init * small fixes for consistency * fix typos * json load tool args and results * better handling * better docstring * plain system msg * handle developer msg * typo * rebase file format * add unit tests * add sk config to platform-matrix * black formats * black formats * remove ptest-async form config * exclude sk from test save eval
1 parent a9d244f commit 4ba1cbd

File tree

7 files changed

+800
-0
lines changed

7 files changed

+800
-0
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262
"[INFO] Could not import AIAgentConverter. Please install the dependency with `pip install azure-ai-projects`."
6363
)
6464

65+
try:
66+
from ._converters._sk_services import SKAgentConverter
67+
68+
_patch_all.append("SKAgentConverter")
69+
except ImportError:
70+
print("[INFO] Could not import SKAgentConverter. Please install the dependency with `pip install semantic-kernel`.")
6571

6672
__all__ = [
6773
"evaluate",

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_converters/_models.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
_USER = "user"
2121
_AGENT = "assistant"
2222
_TOOL = "tool"
23+
_DEVELOPER = "developer" # part of the semantic kernel
2324

2425
# Constant definitions for what tool details include.
2526
_TOOL_CALL = "tool_call"
@@ -124,6 +125,17 @@ class UserMessage(Message):
124125
role: str = _USER
125126

126127

128+
class SKDeveloperMessage(Message):
129+
"""Represents a developer message in a conversation with agents, assistants, and tools.
130+
This is used in the context of Semantic Kernel (SK) agents.
131+
132+
:param role: The role of the message sender, which is always 'developer'.
133+
:type role: str
134+
"""
135+
136+
role: str = _DEVELOPER
137+
138+
127139
class ToolMessage(Message):
128140
"""Represents a tool message in a conversation with agents, assistants, and tools.
129141
@@ -140,6 +152,19 @@ class ToolMessage(Message):
140152
tool_call_id: Optional[str] = None
141153

142154

155+
class SKToolMessage(Message):
156+
"""Represents a tool message in the context of a Semantic Kernel (SK) agent.
157+
158+
:param role: The role of the message sender, which is always 'tool'.
159+
:type role: str
160+
:param tool_call_id: The ID of the tool call associated with the message. Optional.
161+
:type tool_call_id: Optional[str]
162+
"""
163+
164+
role: str = _TOOL
165+
tool_call_id: Optional[str] = None
166+
167+
143168
class AssistantMessage(Message):
144169
"""Represents an assistant message.
145170
@@ -153,6 +178,26 @@ class AssistantMessage(Message):
153178
role: str = _AGENT
154179

155180

181+
class SKAssistantMessage(Message):
182+
"""Represents an assistant message in the context of a Semantic Kernel (SK) agent.
183+
184+
:param role: The role of the message sender, which is always 'assistant'.
185+
:type role: str
186+
"""
187+
188+
role: str = _AGENT
189+
190+
191+
class SKAssistantMessage(Message):
192+
"""Represents an assistant message in the context of a Semantic Kernel (SK) agent.
193+
194+
:param role: The role of the message sender, which is always 'assistant'.
195+
:type role: str
196+
"""
197+
198+
role: str = _AGENT
199+
200+
156201
class ToolDefinition(BaseModel):
157202
"""Represents a tool definition that will be used in the agent.
158203

0 commit comments

Comments
 (0)