Skip to content

Commit

Permalink
Merge pull request #233 from emcie-co/feature/mc-516-allow-only-speci…
Browse files Browse the repository at this point in the history
…fying-guideline-condition-or-action-when

Allow only specifying guideline condition or action when updating gui…
  • Loading branch information
mc-dorzo authored Jan 17, 2025
2 parents 5ee6aa2 + 58ebb69 commit 7fe08d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to Parlant will be documented here.
- Add a log command under client CLI for streaming logs
- Modified ToolCaller shot schema
- Fix ToolCaller making up argument values when it doesn't have them
- Allow only specifying guideline condition or action when updating guideline from CLI


## [1.5.1] - 2025-01-05
Expand Down
18 changes: 15 additions & 3 deletions src/parlant/bin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,18 @@ def update_guideline(
action: str,
check: bool,
index: bool,
updated_id: Optional[str] = None,
updated_id: str,
) -> GuidelineWithConnectionsAndToolAssociations:
client = cast(ParlantClient, ctx.obj.client)

if not (condition and action):
retrived_guideline = client.guidelines.retrieve(
agent_id=agent_id, guideline_id=updated_id
)

condition = condition or retrived_guideline.guideline.condition
action = action or retrived_guideline.guideline.action

evaluation = client.evaluations.create(
agent_id=agent_id,
payloads=[
Expand Down Expand Up @@ -2429,13 +2437,13 @@ def guideline_create(
"--condition",
type=str,
help="A statement describing when the guideline should apply",
required=True,
required=False,
)
@click.option(
"--action",
type=str,
help="The instruction to perform when the guideline applies",
required=True,
required=False,
)
@click.option(
"--agent-id",
Expand Down Expand Up @@ -2468,6 +2476,10 @@ def guideline_update(
check: bool,
connect: bool,
) -> None:
if not (condition or action):
Interface.write_error("At least one of --condition or --action must be specified")
raise FastExit()

agent_id = agent_id if agent_id else Interface.get_default_agent(ctx)
assert agent_id

Expand Down

0 comments on commit 7fe08d4

Please sign in to comment.