Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "gradient-labs"
version = "0.11.1"
version = "0.11.2"
description = "Python bindings for the Gradient Labs API"
readme = "README.md"
requires-python = ">=3.9,<4.0"
Expand Down
25 changes: 25 additions & 0 deletions src/gradient_labs/_handoff_target_set_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from dataclasses import dataclass
from dataclasses_json import dataclass_json

from ._http_client import HttpClient
from .conversation import ConversationChannel


@dataclass_json
@dataclass(frozen=True)
class SetDefaultHandOffTargetParams:
# id is your identifier of choice for this hand-off target. Can be anything consisting
# of letters, numbers, or any of the following characters: `_` `-` `+` `=`.
id: str

# channel is the conversation channel for which to set the default hand-off target.
channel: ConversationChannel


def set_default_hand_off_target(
*, client: HttpClient, params: SetDefaultHandOffTargetParams
) -> None:
_ = client.put(
path="hand-off-targets/default",
body=params.to_dict(),
)
17 changes: 17 additions & 0 deletions src/gradient_labs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from ._handoff_target_upsert import upsert_hand_off_target, UpsertHandOffTargetParams
from ._handoff_targets import list_handoff_targets, HandOffTargets
from ._handoff_target_delete import delete_hand_off_target, DeleteHandOffTargetParams
from ._handoff_target_set_default import (
set_default_hand_off_target,
SetDefaultHandOffTargetParams,
)

from .procedure import Procedure
from ._procedure_read import read_procedure
Expand Down Expand Up @@ -228,6 +232,19 @@ def upsert_hand_off_target(self, *, params: UpsertHandOffTargetParams) -> None:
params=params,
)

def set_default_hand_off_target(
self, *, params: SetDefaultHandOffTargetParams
) -> None:
"""set_default_hand_off_target sets the default hand-off target that the AI agent will
use when handing off the conversation, if there is no specific target for that intent
or procedure. This can be set by channel.

Note: requires a `Management` API key."""
set_default_hand_off_target(
client=self.http_client,
params=params,
)

def delete_hand_off_target(self, *, params: DeleteHandOffTargetParams) -> None:
"""delete_hand_off_target deletes a hand-off target. This will fail if the hand off target
is in use - either in a procedure, or in an intent.
Expand Down