Skip to content

Commit

Permalink
Allow only specifying guideline condition or action when updating gui…
Browse files Browse the repository at this point in the history
…deline from CLI
  • Loading branch information
mc-dorzo committed Jan 15, 2025
1 parent dcb6122 commit ee68cfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to Parlant will be documented here.
- Fix wrong import of RateLimitError
- Reduced likelihood of agent offering hallucinated services
- Add a log command under client CLI for streaming logs
- Allow only specifying guideline condition or action when updating guideline from CLI


## [1.5.1] - 2025-01-05
Expand Down
16 changes: 13 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,8 @@ def guideline_update(
check: bool,
connect: bool,
) -> None:
assert condition or action

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

Expand Down

0 comments on commit ee68cfb

Please sign in to comment.