Skip to content

Commit 6870e8d

Browse files
authored
fix: allow us to run daprd at edge version (#218)
* fix: allow us to run daprd at edge version Signed-off-by: Samantha Coyle <sam@diagrid.io> * test: add unit test for this change Signed-off-by: Samantha Coyle <sam@diagrid.io> --------- Signed-off-by: Samantha Coyle <sam@diagrid.io>
1 parent cd255bd commit 6870e8d

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

dapr_agents/llm/dapr/chat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ def generate(
332332
if dapr_runtime_version is not None:
333333
# Allow only versions >=1.16.0 and <2.0.0 for Alpha2 Chat Client
334334
if not is_version_supported(
335-
str(dapr_runtime_version), ">=1.16.0, <2.0.0"
335+
str(dapr_runtime_version), ">=1.16.0, edge, <2.0.0"
336336
):
337337
raise DaprRuntimeVersionNotSupportedError(
338-
f"!!!!! Dapr Runtime Version {dapr_runtime_version} is not supported with Alpha2 Dapr Chat Client. Only Dapr runtime versions >=1.16.0 and <2.0.0 are supported."
338+
f"!!!!! Dapr Runtime Version {dapr_runtime_version} is not supported with Alpha2 Dapr Chat Client. Only Dapr runtime versions >=1.16.0, edge,and <2.0.0 are supported."
339339
)
340340

341341
raw = self.client.chat_completion_alpha2(

dapr_agents/utils/semver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def is_version_supported(version: str, constraints: str) -> bool:
6363
- Each token supports operators: ==, !=, >=, <=, >, <
6464
- Missing operator defaults to ==
6565
"""
66+
if version == "edge":
67+
return True
6668
v = Version.parse(version)
6769
for group in constraints.split("||"):
6870
group = group.strip()

tests/utils/test_semver.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,25 @@ def test_version_parse_defaults_missing_parts_to_zero() -> None:
5858
assert Version.parse("1.2").major == 1
5959
assert Version.parse("1.2").minor == 2
6060
assert Version.parse("1.2").patch == 0
61+
62+
63+
def test_edge_version_always_satisfies_constraints() -> None:
64+
"""Edge version should always satisfy any constraint."""
65+
assert is_version_supported("edge", "==1.2.3") is True
66+
assert is_version_supported("edge", "!=1.2.3") is True
67+
assert is_version_supported("edge", ">1.2.2") is True
68+
assert is_version_supported("edge", ">=1.2.3") is True
69+
assert is_version_supported("edge", "<1.2.4") is True
70+
assert is_version_supported("edge", "<=1.2.3") is True
71+
assert is_version_supported("edge", ">=1.16.0, <2.0.0") is True
72+
assert is_version_supported("edge", ">=2.0.0, <3.0.0 || ==1.16.1") is True
73+
assert is_version_supported("edge", "==0.0.0") is True
74+
assert is_version_supported("edge", ">999.999.999") is True
75+
assert is_version_supported("edge", "<0.0.1") is True
76+
77+
78+
def test_edge_version_case_sensitivity() -> None:
79+
"""Edge version should be case sensitive."""
80+
assert is_version_supported("edge", "==1.2.3") is True
81+
assert is_version_supported("Edge", "==1.2.3") is False
82+
assert is_version_supported("EDGE", "==1.2.3") is False

0 commit comments

Comments
 (0)