Skip to content

Commit 7fe08d4

Browse files
authored
Merge pull request #233 from emcie-co/feature/mc-516-allow-only-specifying-guideline-condition-or-action-when
Allow only specifying guideline condition or action when updating gui…
2 parents 5ee6aa2 + 58ebb69 commit 7fe08d4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ All notable changes to Parlant will be documented here.
1616
- Add a log command under client CLI for streaming logs
1717
- Modified ToolCaller shot schema
1818
- Fix ToolCaller making up argument values when it doesn't have them
19+
- Allow only specifying guideline condition or action when updating guideline from CLI
1920

2021

2122
## [1.5.1] - 2025-01-05

src/parlant/bin/client.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,18 @@ def update_guideline(
366366
action: str,
367367
check: bool,
368368
index: bool,
369-
updated_id: Optional[str] = None,
369+
updated_id: str,
370370
) -> GuidelineWithConnectionsAndToolAssociations:
371371
client = cast(ParlantClient, ctx.obj.client)
372372

373+
if not (condition and action):
374+
retrived_guideline = client.guidelines.retrieve(
375+
agent_id=agent_id, guideline_id=updated_id
376+
)
377+
378+
condition = condition or retrived_guideline.guideline.condition
379+
action = action or retrived_guideline.guideline.action
380+
373381
evaluation = client.evaluations.create(
374382
agent_id=agent_id,
375383
payloads=[
@@ -2429,13 +2437,13 @@ def guideline_create(
24292437
"--condition",
24302438
type=str,
24312439
help="A statement describing when the guideline should apply",
2432-
required=True,
2440+
required=False,
24332441
)
24342442
@click.option(
24352443
"--action",
24362444
type=str,
24372445
help="The instruction to perform when the guideline applies",
2438-
required=True,
2446+
required=False,
24392447
)
24402448
@click.option(
24412449
"--agent-id",
@@ -2468,6 +2476,10 @@ def guideline_update(
24682476
check: bool,
24692477
connect: bool,
24702478
) -> None:
2479+
if not (condition or action):
2480+
Interface.write_error("At least one of --condition or --action must be specified")
2481+
raise FastExit()
2482+
24712483
agent_id = agent_id if agent_id else Interface.get_default_agent(ctx)
24722484
assert agent_id
24732485

0 commit comments

Comments
 (0)