Skip to content

Commit c5924ec

Browse files
authored
feat: preserve conversation content-part metadata (#1813)
1 parent 2bea397 commit c5924ec

6 files changed

Lines changed: 33 additions & 4 deletions

File tree

packages/uipath-core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-core"
3-
version = "0.5.30"
3+
version = "0.5.31"
44
description = "UiPath Core abstractions"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-core/src/uipath/core/chat/content.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class UiPathConversationContentPartData(BaseModel):
9696

9797
mime_type: str = Field(..., alias="mimeType")
9898
data: InlineOrExternal
99+
metadata: dict[str, Any] | None = Field(None, alias="metaData")
99100
citations: Sequence[UiPathConversationCitationData] = Field(default_factory=list)
100101
is_transcript: bool | None = Field(None, alias="isTranscript")
101102
is_incomplete: bool | None = Field(None, alias="isIncomplete")

packages/uipath-core/tests/chat/test_message.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,31 @@ def test_explicit_ids_are_preserved() -> None:
5757
assert (
5858
msg.content_parts[0].content_part_id == "00000000-0000-0000-0000-000000000002"
5959
)
60+
61+
62+
def test_content_part_metadata_is_preserved() -> None:
63+
msg = UiPathConversationMessage.model_validate(
64+
{
65+
"role": "assistant",
66+
"contentParts": [
67+
{
68+
"mimeType": "text/markdown",
69+
"name": "plan.md",
70+
"data": {
71+
"uri": "urn:uipath:cas:file:orchestrator:"
72+
"00000000-0000-0000-0000-000000000003"
73+
},
74+
"metaData": {"fileKind": "workspace", "sha256": "abc123"},
75+
}
76+
],
77+
}
78+
)
79+
80+
assert msg.content_parts[0].metadata == {
81+
"fileKind": "workspace",
82+
"sha256": "abc123",
83+
}
84+
assert msg.model_dump(by_alias=True)["contentParts"][0]["metaData"] == {
85+
"fileKind": "workspace",
86+
"sha256": "abc123",
87+
}

packages/uipath-core/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath-platform/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)