diff --git a/pyproject.toml b/pyproject.toml index 9f8570c..595bcc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "credal" [tool.poetry] name = "credal" -version = "0.0.22" +version = "0.0.23" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index d9238e2..17e4f0d 100644 --- a/reference.md +++ b/reference.md @@ -85,7 +85,7 @@ client.actions.invoke_action(
-**human_confirmation_channel:** `HumanConfirmationChannel` — Where we should ask for human confirmation if necessary +**require_human_confirmation:** `bool` — If true, then before executing the action we will ask for a human confirmation in Slack. If false, we may still ask for human confirmation if it's required by your organization admin.
@@ -121,7 +121,7 @@ client.actions.invoke_action(
-**require_human_confirmation:** `typing.Optional[bool]` — If true, then before executing the action we will ask for a human confirmation in Slack. If false, we may still ask for human confirmation if it's required by your organization admin. +**human_confirmation_channel:** `typing.Optional[HumanConfirmationChannel]` — Where we should ask for human confirmation if necessary
diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5f490a0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +httpx>=0.21.2 +httpx-sse==0.4.0 +pydantic>= 1.9.2 +pydantic-core==^2.18.2 +typing_extensions>= 4.0.0 diff --git a/src/credal/actions/client.py b/src/credal/actions/client.py index 34c33f1..c55128e 100644 --- a/src/credal/actions/client.py +++ b/src/credal/actions/client.py @@ -25,11 +25,11 @@ def invoke_action( *, action_id: uuid.UUID, user_email: str, - human_confirmation_channel: HumanConfirmationChannel, + require_human_confirmation: bool, justification: str, audit_log_id: uuid.UUID, action_inputs: typing.Optional[typing.Any] = OMIT, - require_human_confirmation: typing.Optional[bool] = OMIT, + human_confirmation_channel: typing.Optional[HumanConfirmationChannel] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> InvokeActionResponse: """ @@ -43,8 +43,8 @@ def invoke_action( The user who we should take the action on behalf of - human_confirmation_channel : HumanConfirmationChannel - Where we should ask for human confirmation if necessary + require_human_confirmation : bool + If true, then before executing the action we will ask for a human confirmation in Slack. If false, we may still ask for human confirmation if it's required by your organization admin. justification : str @@ -59,8 +59,8 @@ def invoke_action( The inputs needed to execute the action - require_human_confirmation : typing.Optional[bool] - If true, then before executing the action we will ask for a human confirmation in Slack. If false, we may still ask for human confirmation if it's required by your organization admin. + human_confirmation_channel : typing.Optional[HumanConfirmationChannel] + Where we should ask for human confirmation if necessary request_options : typing.Optional[RequestOptions] @@ -140,11 +140,11 @@ async def invoke_action( *, action_id: uuid.UUID, user_email: str, - human_confirmation_channel: HumanConfirmationChannel, + require_human_confirmation: bool, justification: str, audit_log_id: uuid.UUID, action_inputs: typing.Optional[typing.Any] = OMIT, - require_human_confirmation: typing.Optional[bool] = OMIT, + human_confirmation_channel: typing.Optional[HumanConfirmationChannel] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> InvokeActionResponse: """ @@ -158,8 +158,8 @@ async def invoke_action( The user who we should take the action on behalf of - human_confirmation_channel : HumanConfirmationChannel - Where we should ask for human confirmation if necessary + require_human_confirmation : bool + If true, then before executing the action we will ask for a human confirmation in Slack. If false, we may still ask for human confirmation if it's required by your organization admin. justification : str @@ -174,8 +174,8 @@ async def invoke_action( The inputs needed to execute the action - require_human_confirmation : typing.Optional[bool] - If true, then before executing the action we will ask for a human confirmation in Slack. If false, we may still ask for human confirmation if it's required by your organization admin. + human_confirmation_channel : typing.Optional[HumanConfirmationChannel] + Where we should ask for human confirmation if necessary request_options : typing.Optional[RequestOptions] diff --git a/src/credal/core/client_wrapper.py b/src/credal/core/client_wrapper.py index 369413b..6b0da2c 100644 --- a/src/credal/core/client_wrapper.py +++ b/src/credal/core/client_wrapper.py @@ -22,7 +22,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "credal", - "X-Fern-SDK-Version": "0.0.22", + "X-Fern-SDK-Version": "0.0.23", } headers["Authorization"] = f"Bearer {self._get_api_key()}" return headers diff --git a/src/credal/core/http_client.py b/src/credal/core/http_client.py index 1a1a131..275a54c 100644 --- a/src/credal/core/http_client.py +++ b/src/credal/core/http_client.py @@ -85,8 +85,8 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float: def _should_retry(response: httpx.Response) -> bool: - retriable_400s = [429, 408, 409] - return response.status_code >= 500 or response.status_code in retriable_400s + retryable_400s = [429, 408, 409] + return response.status_code >= 500 or response.status_code in retryable_400s def remove_omit_from_dict( @@ -183,7 +183,7 @@ def request( files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 0, + retries: int = 2, omit: typing.Optional[typing.Any] = None, ) -> httpx.Response: base_url = self.get_base_url(base_url) @@ -269,7 +269,7 @@ def stream( files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 0, + retries: int = 2, omit: typing.Optional[typing.Any] = None, ) -> typing.Iterator[httpx.Response]: base_url = self.get_base_url(base_url) @@ -359,7 +359,7 @@ async def request( files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 0, + retries: int = 2, omit: typing.Optional[typing.Any] = None, ) -> httpx.Response: base_url = self.get_base_url(base_url) @@ -445,7 +445,7 @@ async def stream( files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 0, + retries: int = 2, omit: typing.Optional[typing.Any] = None, ) -> typing.AsyncIterator[httpx.Response]: base_url = self.get_base_url(base_url) diff --git a/src/credal/core/pydantic_utilities.py b/src/credal/core/pydantic_utilities.py index ee8f0e4..ca1f479 100644 --- a/src/credal/core/pydantic_utilities.py +++ b/src/credal/core/pydantic_utilities.py @@ -79,7 +79,7 @@ def to_jsonable_with_fallback( class UniversalBaseModel(pydantic.BaseModel): if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( - # Allow fields begining with `model_` to be used in the model + # Allow fields beginning with `model_` to be used in the model protected_namespaces=(), ) # type: ignore # Pydantic v2 @@ -128,7 +128,7 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: Override the default dict method to `exclude_unset` by default. This function patches `exclude_unset` to work include fields within non-None default values. """ - # Note: the logic here is multi-plexed given the levers exposed in Pydantic V1 vs V2 + # Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2 # Pydantic V1's .dict can be extremely slow, so we do not want to call it twice. # # We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models