diff --git a/pyproject.toml b/pyproject.toml index 6ee1bd8..c03f7b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/gradient_labs/_handoff_target_set_default.py b/src/gradient_labs/_handoff_target_set_default.py new file mode 100644 index 0000000..b3c3a43 --- /dev/null +++ b/src/gradient_labs/_handoff_target_set_default.py @@ -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(), + ) diff --git a/src/gradient_labs/client.py b/src/gradient_labs/client.py index 5302dd4..3312b72 100644 --- a/src/gradient_labs/client.py +++ b/src/gradient_labs/client.py @@ -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 @@ -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.