blaxel 0.2.31__py3-none-any.whl → 0.2.31rc120__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- blaxel/__init__.py +3 -3
- blaxel/core/agents/__init__.py +6 -13
- blaxel/core/authentication/__init__.py +1 -2
- blaxel/core/authentication/devicemode.py +1 -9
- blaxel/core/authentication/oauth.py +6 -13
- blaxel/core/authentication/types.py +0 -1
- blaxel/core/cache/cache.py +3 -10
- blaxel/core/client/api/agents/list_agent_revisions.py +1 -3
- blaxel/core/client/api/compute/delete_sandbox_preview_token.py +2 -6
- blaxel/core/client/api/compute/start_sandbox.py +1 -3
- blaxel/core/client/api/compute/stop_sandbox.py +1 -3
- blaxel/core/client/api/default/list_sandbox_hub_definitions.py +2 -6
- blaxel/core/client/api/functions/list_function_revisions.py +1 -3
- blaxel/core/client/api/images/cleanup_images.py +1 -3
- blaxel/core/client/api/integrations/list_integration_connections.py +2 -6
- blaxel/core/client/api/invitations/list_all_pending_invitations.py +1 -3
- blaxel/core/client/api/jobs/create_job_execution.py +1 -3
- blaxel/core/client/api/jobs/delete_job_execution.py +1 -3
- blaxel/core/client/api/jobs/get_job_execution.py +1 -3
- blaxel/core/client/api/jobs/list_job_executions.py +2 -6
- blaxel/core/client/api/jobs/list_job_revisions.py +1 -3
- blaxel/core/client/api/locations/list_locations.py +1 -3
- blaxel/core/client/api/models/list_model_revisions.py +1 -3
- blaxel/core/client/api/service_accounts/create_workspace_service_account.py +2 -6
- blaxel/core/client/api/service_accounts/delete_workspace_service_account.py +2 -6
- blaxel/core/client/api/service_accounts/get_workspace_service_accounts.py +1 -3
- blaxel/core/client/api/service_accounts/update_workspace_service_account.py +2 -6
- blaxel/core/client/api/volume_templates/list_volume_templates.py +1 -3
- blaxel/core/client/api/workspaces/accept_workspace_invitation.py +2 -6
- blaxel/core/client/api/workspaces/invite_workspace_user.py +2 -6
- blaxel/core/client/api/workspaces/update_workspace_user_role.py +2 -6
- blaxel/core/client/client.py +19 -5
- blaxel/core/client/models/agent.py +4 -11
- blaxel/core/client/models/agent_spec.py +5 -18
- blaxel/core/client/models/billable_time_metric.py +1 -0
- blaxel/core/client/models/configuration.py +1 -0
- blaxel/core/client/models/core_spec.py +3 -10
- blaxel/core/client/models/core_spec_configurations.py +1 -0
- blaxel/core/client/models/create_job_execution_request.py +1 -0
- blaxel/core/client/models/create_job_execution_response.py +1 -0
- blaxel/core/client/models/custom_domain.py +2 -5
- blaxel/core/client/models/custom_domain_metadata.py +1 -0
- blaxel/core/client/models/custom_domain_spec.py +2 -5
- blaxel/core/client/models/delete_volume_template_version_response_200.py +2 -5
- blaxel/core/client/models/entrypoint.py +1 -0
- blaxel/core/client/models/form.py +2 -5
- blaxel/core/client/models/function.py +4 -11
- blaxel/core/client/models/function_spec.py +4 -13
- blaxel/core/client/models/image.py +2 -5
- blaxel/core/client/models/image_spec.py +1 -0
- blaxel/core/client/models/integration.py +3 -10
- blaxel/core/client/models/integration_connection.py +2 -5
- blaxel/core/client/models/integration_connection_spec.py +1 -0
- blaxel/core/client/models/integration_endpoint.py +2 -5
- blaxel/core/client/models/integration_endpoints.py +2 -0
- blaxel/core/client/models/job.py +4 -11
- blaxel/core/client/models/job_execution.py +2 -5
- blaxel/core/client/models/job_execution_spec.py +1 -0
- blaxel/core/client/models/job_execution_task.py +2 -5
- blaxel/core/client/models/job_metrics.py +2 -5
- blaxel/core/client/models/job_spec.py +4 -13
- blaxel/core/client/models/jobs_network_chart.py +1 -0
- blaxel/core/client/models/jobs_success_failed_chart.py +3 -10
- blaxel/core/client/models/latency_metric.py +2 -5
- blaxel/core/client/models/location_response.py +1 -0
- blaxel/core/client/models/mcp_definition.py +2 -5
- blaxel/core/client/models/metadata.py +1 -0
- blaxel/core/client/models/metrics.py +4 -11
- blaxel/core/client/models/model.py +4 -11
- blaxel/core/client/models/model_spec.py +3 -10
- blaxel/core/client/models/pending_invitation_accept.py +2 -5
- blaxel/core/client/models/pending_invitation_render.py +3 -10
- blaxel/core/client/models/policy.py +2 -5
- blaxel/core/client/models/policy_spec.py +4 -11
- blaxel/core/client/models/preview.py +2 -5
- blaxel/core/client/models/preview_spec.py +1 -0
- blaxel/core/client/models/preview_token.py +2 -5
- blaxel/core/client/models/public_ips.py +1 -0
- blaxel/core/client/models/request_duration_over_time_metrics.py +1 -0
- blaxel/core/client/models/request_total_by_origin_metric.py +7 -16
- blaxel/core/client/models/request_total_metric.py +3 -8
- blaxel/core/client/models/resource_metrics.py +17 -58
- blaxel/core/client/models/runtime.py +1 -0
- blaxel/core/client/models/sandbox.py +4 -11
- blaxel/core/client/models/sandbox_definition.py +1 -0
- blaxel/core/client/models/sandbox_lifecycle.py +1 -0
- blaxel/core/client/models/sandbox_spec.py +6 -21
- blaxel/core/client/models/serverless_config.py +1 -0
- blaxel/core/client/models/start_sandbox.py +2 -5
- blaxel/core/client/models/stop_sandbox.py +2 -5
- blaxel/core/client/models/store_agent.py +1 -0
- blaxel/core/client/models/store_configuration.py +1 -0
- blaxel/core/client/models/template.py +1 -0
- blaxel/core/client/models/time_to_first_token_over_time_metrics.py +2 -3
- blaxel/core/client/models/token_rate_metrics.py +1 -0
- blaxel/core/client/models/trigger.py +1 -0
- blaxel/core/client/models/trigger_configuration.py +1 -0
- blaxel/core/client/models/volume.py +4 -11
- blaxel/core/client/models/volume_template.py +2 -5
- blaxel/core/client/models/workspace.py +2 -5
- blaxel/core/client/response_interceptor.py +1 -3
- blaxel/core/common/autoload.py +11 -9
- blaxel/core/common/env.py +8 -10
- blaxel/core/common/settings.py +2 -4
- blaxel/core/common/webhook.py +1 -0
- blaxel/core/jobs/__init__.py +3 -13
- blaxel/core/mcp/client.py +2 -8
- blaxel/core/mcp/server.py +2 -8
- blaxel/core/models/__init__.py +5 -6
- blaxel/core/sandbox/__init__.py +1 -1
- blaxel/core/sandbox/client/api/codegen/get_codegen_reranking_path.py +2 -6
- blaxel/core/sandbox/client/api/fastapply/put_codegen_fastapply_path.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/delete_filesystem_multipart_upload_id_abort.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/delete_filesystem_path.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +1 -3
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/get_watch_filesystem_path.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/post_filesystem_multipart_upload_id_complete.py +2 -6
- blaxel/core/sandbox/client/api/filesystem/put_filesystem_path.py +2 -6
- blaxel/core/sandbox/client/api/process/delete_process_identifier.py +2 -6
- blaxel/core/sandbox/client/api/process/delete_process_identifier_kill.py +2 -6
- blaxel/core/sandbox/client/api/process/get_process.py +1 -3
- blaxel/core/sandbox/client/api/process/get_process_identifier.py +2 -6
- blaxel/core/sandbox/client/api/process/get_process_identifier_logs.py +2 -6
- blaxel/core/sandbox/client/api/process/get_process_identifier_logs_stream.py +2 -6
- blaxel/core/sandbox/client/api/process/post_process.py +2 -6
- blaxel/core/sandbox/client/client.py +1 -3
- blaxel/core/sandbox/client/models/filesystem_multipart_upload_parts.py +1 -3
- blaxel/core/sandbox/default/__init__.py +1 -0
- blaxel/core/sandbox/default/action.py +3 -3
- blaxel/core/sandbox/default/codegen.py +4 -2
- blaxel/core/sandbox/default/filesystem.py +82 -38
- blaxel/core/sandbox/default/interpreter.py +10 -17
- blaxel/core/sandbox/default/preview.py +2 -6
- blaxel/core/sandbox/default/process.py +7 -25
- blaxel/core/sandbox/default/sandbox.py +2 -7
- blaxel/core/sandbox/sync/__init__.py +2 -0
- blaxel/core/sandbox/sync/action.py +3 -2
- blaxel/core/sandbox/sync/codegen.py +5 -1
- blaxel/core/sandbox/sync/filesystem.py +6 -17
- blaxel/core/sandbox/sync/interpreter.py +6 -10
- blaxel/core/sandbox/sync/network.py +2 -0
- blaxel/core/sandbox/sync/preview.py +9 -21
- blaxel/core/sandbox/sync/process.py +8 -32
- blaxel/core/sandbox/sync/sandbox.py +6 -13
- blaxel/core/sandbox/sync/session.py +4 -6
- blaxel/core/sandbox/types.py +1 -2
- blaxel/core/tools/__init__.py +6 -30
- blaxel/core/tools/common.py +1 -1
- blaxel/core/tools/types.py +1 -2
- blaxel/crewai/model.py +5 -20
- blaxel/googleadk/__init__.py +1 -1
- blaxel/googleadk/tools.py +5 -3
- blaxel/langgraph/custom/gemini.py +133 -126
- blaxel/langgraph/model.py +50 -54
- blaxel/langgraph/tools.py +3 -9
- blaxel/llamaindex/custom/cohere.py +16 -25
- blaxel/llamaindex/model.py +57 -44
- blaxel/llamaindex/tools.py +3 -2
- blaxel/pydantic/custom/gemini.py +3 -3
- blaxel/pydantic/tools.py +4 -2
- blaxel/telemetry/exporters.py +3 -10
- blaxel/telemetry/instrumentation/blaxel_langgraph.py +2 -4
- blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py +5 -22
- blaxel/telemetry/instrumentation/utils.py +3 -3
- blaxel/telemetry/log/log.py +3 -2
- blaxel/telemetry/log/logger.py +15 -21
- blaxel/telemetry/span.py +6 -10
- {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/METADATA +2 -2
- {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/RECORD +174 -174
- {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/WHEEL +0 -0
- {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/licenses/LICENSE +0 -0
blaxel/__init__.py
CHANGED
|
@@ -4,9 +4,9 @@ from .core.common.autoload import autoload
|
|
|
4
4
|
from .core.common.env import env
|
|
5
5
|
from .core.common.settings import settings
|
|
6
6
|
|
|
7
|
-
__version__ = "0.2.31"
|
|
8
|
-
__commit__ = "
|
|
7
|
+
__version__ = "0.2.31.pre-120"
|
|
8
|
+
__commit__ = "a23256023f1d955467e2ee297a96b3d321172acf"
|
|
9
9
|
__sentry_dsn__ = "https://9711de13cd02b285ca4378c01de8dc30@o4508714045276160.ingest.us.sentry.io/4510461121462272"
|
|
10
10
|
__all__ = ["autoload", "settings", "env"]
|
|
11
11
|
|
|
12
|
-
autoload()
|
|
12
|
+
autoload()
|
blaxel/core/agents/__init__.py
CHANGED
|
@@ -51,13 +51,11 @@ class BlAgent:
|
|
|
51
51
|
body = json.dumps(body)
|
|
52
52
|
|
|
53
53
|
# Merge settings headers with provided headers
|
|
54
|
-
merged_headers = {
|
|
55
|
-
**settings.headers,
|
|
56
|
-
"Content-Type": "application/json",
|
|
57
|
-
**headers,
|
|
58
|
-
}
|
|
54
|
+
merged_headers = {**settings.headers, "Content-Type": "application/json", **headers}
|
|
59
55
|
|
|
60
|
-
return client.get_httpx_client().post(
|
|
56
|
+
return client.get_httpx_client().post(
|
|
57
|
+
url, headers=merged_headers, data=body, params=params
|
|
58
|
+
)
|
|
61
59
|
|
|
62
60
|
async def acall(self, url, input_data, headers: dict = {}, params: dict = {}):
|
|
63
61
|
logger.debug(f"Agent Calling: {self.name}")
|
|
@@ -66,11 +64,7 @@ class BlAgent:
|
|
|
66
64
|
body = json.dumps(body)
|
|
67
65
|
|
|
68
66
|
# Merge settings headers with provided headers
|
|
69
|
-
merged_headers = {
|
|
70
|
-
**settings.headers,
|
|
71
|
-
"Content-Type": "application/json",
|
|
72
|
-
**headers,
|
|
73
|
-
}
|
|
67
|
+
merged_headers = {**settings.headers, "Content-Type": "application/json", **headers}
|
|
74
68
|
|
|
75
69
|
return await client.get_async_httpx_client().post(
|
|
76
70
|
url, headers=merged_headers, data=body, params=params
|
|
@@ -126,5 +120,4 @@ async def get_agent_metadata(name):
|
|
|
126
120
|
except Exception:
|
|
127
121
|
return None
|
|
128
122
|
|
|
129
|
-
|
|
130
|
-
__all__ = ["BlAgent", "bl_agent", "get_agent_metadata"]
|
|
123
|
+
__all__ = ["BlAgent", "bl_agent", "get_agent_metadata"]
|
|
@@ -34,8 +34,7 @@ def get_credentials() -> CredentialsType | None:
|
|
|
34
34
|
|
|
35
35
|
if os.environ.get("BL_CLIENT_CREDENTIALS"):
|
|
36
36
|
return CredentialsType(
|
|
37
|
-
client_credentials=os.environ.get("BL_CLIENT_CREDENTIALS"),
|
|
38
|
-
workspace=get_workspace(),
|
|
37
|
+
client_credentials=os.environ.get("BL_CLIENT_CREDENTIALS"), workspace=get_workspace()
|
|
39
38
|
)
|
|
40
39
|
|
|
41
40
|
try:
|
|
@@ -24,7 +24,6 @@ class DeviceLogin:
|
|
|
24
24
|
client_id (str): The client ID for the device.
|
|
25
25
|
scope (str): The scope of the authentication.
|
|
26
26
|
"""
|
|
27
|
-
|
|
28
27
|
client_id: str
|
|
29
28
|
scope: str
|
|
30
29
|
|
|
@@ -43,7 +42,6 @@ class DeviceLoginResponse:
|
|
|
43
42
|
verification_uri (str): URI for user to verify device login.
|
|
44
43
|
verification_uri_complete (str): Complete URI including the user code for verification.
|
|
45
44
|
"""
|
|
46
|
-
|
|
47
45
|
client_id: str
|
|
48
46
|
device_code: str
|
|
49
47
|
user_code: str
|
|
@@ -63,7 +61,6 @@ class DeviceLoginFinalizeRequest:
|
|
|
63
61
|
client_id (str): The client ID for finalizing the device login.
|
|
64
62
|
device_code (str): The device code to finalize login.
|
|
65
63
|
"""
|
|
66
|
-
|
|
67
64
|
grant_type: str
|
|
68
65
|
client_id: str
|
|
69
66
|
device_code: str
|
|
@@ -81,7 +78,6 @@ class DeviceMode(BlaxelAuth):
|
|
|
81
78
|
"""
|
|
82
79
|
DeviceMode auth that authenticates requests using a device code.
|
|
83
80
|
"""
|
|
84
|
-
|
|
85
81
|
def get_headers(self) -> Dict[str, str]:
|
|
86
82
|
"""
|
|
87
83
|
Retrieves the authentication headers containing the Bearer token and workspace information.
|
|
@@ -165,11 +161,7 @@ class DeviceMode(BlaxelAuth):
|
|
|
165
161
|
}
|
|
166
162
|
|
|
167
163
|
try:
|
|
168
|
-
response = post(
|
|
169
|
-
url,
|
|
170
|
-
json=refresh_data,
|
|
171
|
-
headers={"Content-Type": "application/json"},
|
|
172
|
-
)
|
|
164
|
+
response = post(url, json=refresh_data, headers={"Content-Type": "application/json"})
|
|
173
165
|
response.raise_for_status()
|
|
174
166
|
finalize_response = DeviceLoginFinalizeResponse(**response.json())
|
|
175
167
|
|
|
@@ -11,7 +11,6 @@ class OauthTokenData:
|
|
|
11
11
|
headers: dict[str, str] = field(default_factory=dict)
|
|
12
12
|
authenticated: bool | None = False
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
@dataclass
|
|
16
15
|
class OauthTokenResponse:
|
|
17
16
|
access_token: str
|
|
@@ -19,16 +18,14 @@ class OauthTokenResponse:
|
|
|
19
18
|
expires_in: int
|
|
20
19
|
token_type: str
|
|
21
20
|
|
|
22
|
-
|
|
23
21
|
@dataclass
|
|
24
22
|
class OauthTokenError:
|
|
25
23
|
error: str
|
|
26
24
|
|
|
27
|
-
|
|
28
25
|
async def oauth_token(
|
|
29
26
|
options: OauthTokenData,
|
|
30
27
|
client: Client | None = None,
|
|
31
|
-
throw_on_error: bool = False
|
|
28
|
+
throw_on_error: bool = False
|
|
32
29
|
) -> Union[OauthTokenResponse, OauthTokenError]:
|
|
33
30
|
"""
|
|
34
31
|
Get a new OAuth token.
|
|
@@ -41,17 +38,13 @@ async def oauth_token(
|
|
|
41
38
|
Returns:
|
|
42
39
|
The OAuth token response or error
|
|
43
40
|
"""
|
|
44
|
-
response = (
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
.
|
|
48
|
-
url="/oauth/token",
|
|
49
|
-
json=options.body or {},
|
|
50
|
-
headers=options.headers or {},
|
|
51
|
-
)
|
|
41
|
+
response = await (client or default_client).get_async_httpx_client().post(
|
|
42
|
+
url="/oauth/token",
|
|
43
|
+
json=options.body or {},
|
|
44
|
+
headers=options.headers or {},
|
|
52
45
|
)
|
|
53
46
|
if response.status_code >= 400:
|
|
54
47
|
if throw_on_error:
|
|
55
48
|
raise Exception(f"Failed to get OAuth token: {response.text}")
|
|
56
49
|
return OauthTokenError(error=response.text)
|
|
57
|
-
return OauthTokenResponse(**response.json())
|
|
50
|
+
return OauthTokenResponse(**response.json())
|
|
@@ -17,7 +17,6 @@ class CredentialsType(BaseModel):
|
|
|
17
17
|
expires_in: int | None = Field(default=None, description="The expiration time")
|
|
18
18
|
workspace: str | None = Field(default=None, description="The workspace")
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
class BlaxelAuth(Auth):
|
|
22
21
|
def __init__(self, credentials: CredentialsType, workspace_name: str, base_url: str):
|
|
23
22
|
"""
|
blaxel/core/cache/cache.py
CHANGED
|
@@ -14,26 +14,19 @@ def _load_cache() -> None:
|
|
|
14
14
|
Load cache data from .cache.yaml file if it exists.
|
|
15
15
|
"""
|
|
16
16
|
try:
|
|
17
|
-
if os.path.exists(
|
|
18
|
-
with open(
|
|
17
|
+
if os.path.exists('.cache.yaml'):
|
|
18
|
+
with open('.cache.yaml', encoding='utf-8') as file:
|
|
19
19
|
cache_string = file.read()
|
|
20
20
|
cache_data = yaml.safe_load_all(cache_string)
|
|
21
21
|
|
|
22
22
|
for doc in cache_data:
|
|
23
|
-
if (
|
|
24
|
-
doc
|
|
25
|
-
and isinstance(doc, dict)
|
|
26
|
-
and "kind" in doc
|
|
27
|
-
and "metadata" in doc
|
|
28
|
-
and "name" in doc["metadata"]
|
|
29
|
-
):
|
|
23
|
+
if doc and isinstance(doc, dict) and 'kind' in doc and 'metadata' in doc and 'name' in doc['metadata']:
|
|
30
24
|
cache_key = f"{doc['kind']}/{doc['metadata']['name']}"
|
|
31
25
|
_cache[cache_key] = doc
|
|
32
26
|
except Exception:
|
|
33
27
|
# Silently fail if cache file doesn't exist or is invalid
|
|
34
28
|
pass
|
|
35
29
|
|
|
36
|
-
|
|
37
30
|
# Initialize cache on module import
|
|
38
31
|
_load_cache()
|
|
39
32
|
|
|
@@ -36,9 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Revisi
|
|
|
36
36
|
return None
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[list["RevisionMetadata"]]:
|
|
39
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["RevisionMetadata"]]:
|
|
42
40
|
return Response(
|
|
43
41
|
status_code=HTTPStatus(response.status_code),
|
|
44
42
|
content=response.content,
|
|
@@ -22,9 +22,7 @@ def _get_kwargs(
|
|
|
22
22
|
return _kwargs
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def _parse_response(
|
|
26
|
-
*, client: Client, response: httpx.Response
|
|
27
|
-
) -> DeleteSandboxPreviewTokenResponse200 | None:
|
|
25
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> DeleteSandboxPreviewTokenResponse200 | None:
|
|
28
26
|
if response.status_code == 200:
|
|
29
27
|
response_200 = DeleteSandboxPreviewTokenResponse200.from_dict(response.json())
|
|
30
28
|
|
|
@@ -35,9 +33,7 @@ def _parse_response(
|
|
|
35
33
|
return None
|
|
36
34
|
|
|
37
35
|
|
|
38
|
-
def _build_response(
|
|
39
|
-
*, client: Client, response: httpx.Response
|
|
40
|
-
) -> Response[DeleteSandboxPreviewTokenResponse200]:
|
|
36
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[DeleteSandboxPreviewTokenResponse200]:
|
|
41
37
|
return Response(
|
|
42
38
|
status_code=HTTPStatus(response.status_code),
|
|
43
39
|
content=response.content,
|
|
@@ -34,9 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, S
|
|
|
34
34
|
return None
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def _build_response(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Response[Union[Any, StartSandbox]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StartSandbox]]:
|
|
40
38
|
return Response(
|
|
41
39
|
status_code=HTTPStatus(response.status_code),
|
|
42
40
|
content=response.content,
|
|
@@ -34,9 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, S
|
|
|
34
34
|
return None
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def _build_response(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Response[Union[Any, StopSandbox]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StopSandbox]]:
|
|
40
38
|
return Response(
|
|
41
39
|
status_code=HTTPStatus(response.status_code),
|
|
42
40
|
content=response.content,
|
|
@@ -18,9 +18,7 @@ def _get_kwargs() -> dict[str, Any]:
|
|
|
18
18
|
return _kwargs
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def _parse_response(
|
|
22
|
-
*, client: Client, response: httpx.Response
|
|
23
|
-
) -> list["SandboxDefinition"] | None:
|
|
21
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> list["SandboxDefinition"] | None:
|
|
24
22
|
if response.status_code == 200:
|
|
25
23
|
response_200 = []
|
|
26
24
|
_response_200 = response.json()
|
|
@@ -36,9 +34,7 @@ def _parse_response(
|
|
|
36
34
|
return None
|
|
37
35
|
|
|
38
36
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[list["SandboxDefinition"]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["SandboxDefinition"]]:
|
|
42
38
|
return Response(
|
|
43
39
|
status_code=HTTPStatus(response.status_code),
|
|
44
40
|
content=response.content,
|
|
@@ -36,9 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Revisi
|
|
|
36
36
|
return None
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[list["RevisionMetadata"]]:
|
|
39
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["RevisionMetadata"]]:
|
|
42
40
|
return Response(
|
|
43
41
|
status_code=HTTPStatus(response.status_code),
|
|
44
42
|
content=response.content,
|
|
@@ -29,9 +29,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> CleanupImage
|
|
|
29
29
|
return None
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def _build_response(
|
|
33
|
-
*, client: Client, response: httpx.Response
|
|
34
|
-
) -> Response[CleanupImagesResponse200]:
|
|
32
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[CleanupImagesResponse200]:
|
|
35
33
|
return Response(
|
|
36
34
|
status_code=HTTPStatus(response.status_code),
|
|
37
35
|
content=response.content,
|
|
@@ -18,9 +18,7 @@ def _get_kwargs() -> dict[str, Any]:
|
|
|
18
18
|
return _kwargs
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def _parse_response(
|
|
22
|
-
*, client: Client, response: httpx.Response
|
|
23
|
-
) -> list["IntegrationConnection"] | None:
|
|
21
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> list["IntegrationConnection"] | None:
|
|
24
22
|
if response.status_code == 200:
|
|
25
23
|
response_200 = []
|
|
26
24
|
_response_200 = response.json()
|
|
@@ -36,9 +34,7 @@ def _parse_response(
|
|
|
36
34
|
return None
|
|
37
35
|
|
|
38
36
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[list["IntegrationConnection"]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["IntegrationConnection"]]:
|
|
42
38
|
return Response(
|
|
43
39
|
status_code=HTTPStatus(response.status_code),
|
|
44
40
|
content=response.content,
|
|
@@ -18,9 +18,7 @@ def _get_kwargs() -> dict[str, Any]:
|
|
|
18
18
|
return _kwargs
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def _parse_response(
|
|
22
|
-
*, client: Client, response: httpx.Response
|
|
23
|
-
) -> Union[Any, list["PendingInvitationRender"]] | None:
|
|
21
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, list["PendingInvitationRender"]] | None:
|
|
24
22
|
if response.status_code == 200:
|
|
25
23
|
response_200 = []
|
|
26
24
|
_response_200 = response.json()
|
|
@@ -51,9 +51,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, J
|
|
|
51
51
|
return None
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
def _build_response(
|
|
55
|
-
*, client: Client, response: httpx.Response
|
|
56
|
-
) -> Response[Union[Any, JobExecution]]:
|
|
54
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, JobExecution]]:
|
|
57
55
|
return Response(
|
|
58
56
|
status_code=HTTPStatus(response.status_code),
|
|
59
57
|
content=response.content,
|
|
@@ -41,9 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, J
|
|
|
41
41
|
return None
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def _build_response(
|
|
45
|
-
*, client: Client, response: httpx.Response
|
|
46
|
-
) -> Response[Union[Any, JobExecution]]:
|
|
44
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, JobExecution]]:
|
|
47
45
|
return Response(
|
|
48
46
|
status_code=HTTPStatus(response.status_code),
|
|
49
47
|
content=response.content,
|
|
@@ -41,9 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, J
|
|
|
41
41
|
return None
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def _build_response(
|
|
45
|
-
*, client: Client, response: httpx.Response
|
|
46
|
-
) -> Response[Union[Any, JobExecution]]:
|
|
44
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, JobExecution]]:
|
|
47
45
|
return Response(
|
|
48
46
|
status_code=HTTPStatus(response.status_code),
|
|
49
47
|
content=response.content,
|
|
@@ -32,9 +32,7 @@ def _get_kwargs(
|
|
|
32
32
|
return _kwargs
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def _parse_response(
|
|
36
|
-
*, client: Client, response: httpx.Response
|
|
37
|
-
) -> Union[Any, list["JobExecution"]] | None:
|
|
35
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, list["JobExecution"]] | None:
|
|
38
36
|
if response.status_code == 200:
|
|
39
37
|
response_200 = []
|
|
40
38
|
_response_200 = response.json()
|
|
@@ -56,9 +54,7 @@ def _parse_response(
|
|
|
56
54
|
return None
|
|
57
55
|
|
|
58
56
|
|
|
59
|
-
def _build_response(
|
|
60
|
-
*, client: Client, response: httpx.Response
|
|
61
|
-
) -> Response[Union[Any, list["JobExecution"]]]:
|
|
57
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, list["JobExecution"]]]:
|
|
62
58
|
return Response(
|
|
63
59
|
status_code=HTTPStatus(response.status_code),
|
|
64
60
|
content=response.content,
|
|
@@ -36,9 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Revisi
|
|
|
36
36
|
return None
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[list["RevisionMetadata"]]:
|
|
39
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["RevisionMetadata"]]:
|
|
42
40
|
return Response(
|
|
43
41
|
status_code=HTTPStatus(response.status_code),
|
|
44
42
|
content=response.content,
|
|
@@ -34,9 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Locati
|
|
|
34
34
|
return None
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def _build_response(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Response[list["LocationResponse"]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["LocationResponse"]]:
|
|
40
38
|
return Response(
|
|
41
39
|
status_code=HTTPStatus(response.status_code),
|
|
42
40
|
content=response.content,
|
|
@@ -36,9 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Revisi
|
|
|
36
36
|
return None
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[list["RevisionMetadata"]]:
|
|
39
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["RevisionMetadata"]]:
|
|
42
40
|
return Response(
|
|
43
41
|
status_code=HTTPStatus(response.status_code),
|
|
44
42
|
content=response.content,
|
|
@@ -35,9 +35,7 @@ def _get_kwargs(
|
|
|
35
35
|
return _kwargs
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
def _parse_response(
|
|
39
|
-
*, client: Client, response: httpx.Response
|
|
40
|
-
) -> CreateWorkspaceServiceAccountResponse200 | None:
|
|
38
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> CreateWorkspaceServiceAccountResponse200 | None:
|
|
41
39
|
if response.status_code == 200:
|
|
42
40
|
response_200 = CreateWorkspaceServiceAccountResponse200.from_dict(response.json())
|
|
43
41
|
|
|
@@ -48,9 +46,7 @@ def _parse_response(
|
|
|
48
46
|
return None
|
|
49
47
|
|
|
50
48
|
|
|
51
|
-
def _build_response(
|
|
52
|
-
*, client: Client, response: httpx.Response
|
|
53
|
-
) -> Response[CreateWorkspaceServiceAccountResponse200]:
|
|
49
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[CreateWorkspaceServiceAccountResponse200]:
|
|
54
50
|
return Response(
|
|
55
51
|
status_code=HTTPStatus(response.status_code),
|
|
56
52
|
content=response.content,
|
|
@@ -22,9 +22,7 @@ def _get_kwargs(
|
|
|
22
22
|
return _kwargs
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def _parse_response(
|
|
26
|
-
*, client: Client, response: httpx.Response
|
|
27
|
-
) -> DeleteWorkspaceServiceAccountResponse200 | None:
|
|
25
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> DeleteWorkspaceServiceAccountResponse200 | None:
|
|
28
26
|
if response.status_code == 200:
|
|
29
27
|
response_200 = DeleteWorkspaceServiceAccountResponse200.from_dict(response.json())
|
|
30
28
|
|
|
@@ -35,9 +33,7 @@ def _parse_response(
|
|
|
35
33
|
return None
|
|
36
34
|
|
|
37
35
|
|
|
38
|
-
def _build_response(
|
|
39
|
-
*, client: Client, response: httpx.Response
|
|
40
|
-
) -> Response[DeleteWorkspaceServiceAccountResponse200]:
|
|
36
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[DeleteWorkspaceServiceAccountResponse200]:
|
|
41
37
|
return Response(
|
|
42
38
|
status_code=HTTPStatus(response.status_code),
|
|
43
39
|
content=response.content,
|
|
@@ -27,9 +27,7 @@ def _parse_response(
|
|
|
27
27
|
response_200 = []
|
|
28
28
|
_response_200 = response.json()
|
|
29
29
|
for response_200_item_data in _response_200:
|
|
30
|
-
response_200_item = GetWorkspaceServiceAccountsResponse200Item.from_dict(
|
|
31
|
-
response_200_item_data
|
|
32
|
-
)
|
|
30
|
+
response_200_item = GetWorkspaceServiceAccountsResponse200Item.from_dict(response_200_item_data)
|
|
33
31
|
|
|
34
32
|
response_200.append(response_200_item)
|
|
35
33
|
|
|
@@ -36,9 +36,7 @@ def _get_kwargs(
|
|
|
36
36
|
return _kwargs
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def _parse_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> UpdateWorkspaceServiceAccountResponse200 | None:
|
|
39
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> UpdateWorkspaceServiceAccountResponse200 | None:
|
|
42
40
|
if response.status_code == 200:
|
|
43
41
|
response_200 = UpdateWorkspaceServiceAccountResponse200.from_dict(response.json())
|
|
44
42
|
|
|
@@ -49,9 +47,7 @@ def _parse_response(
|
|
|
49
47
|
return None
|
|
50
48
|
|
|
51
49
|
|
|
52
|
-
def _build_response(
|
|
53
|
-
*, client: Client, response: httpx.Response
|
|
54
|
-
) -> Response[UpdateWorkspaceServiceAccountResponse200]:
|
|
50
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[UpdateWorkspaceServiceAccountResponse200]:
|
|
55
51
|
return Response(
|
|
56
52
|
status_code=HTTPStatus(response.status_code),
|
|
57
53
|
content=response.content,
|
|
@@ -34,9 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Volume
|
|
|
34
34
|
return None
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def _build_response(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Response[list["VolumeTemplate"]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["VolumeTemplate"]]:
|
|
40
38
|
return Response(
|
|
41
39
|
status_code=HTTPStatus(response.status_code),
|
|
42
40
|
content=response.content,
|
|
@@ -20,9 +20,7 @@ def _get_kwargs(
|
|
|
20
20
|
return _kwargs
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def _parse_response(
|
|
24
|
-
*, client: Client, response: httpx.Response
|
|
25
|
-
) -> Union[Any, PendingInvitationAccept] | None:
|
|
23
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, PendingInvitationAccept] | None:
|
|
26
24
|
if response.status_code == 200:
|
|
27
25
|
response_200 = PendingInvitationAccept.from_dict(response.json())
|
|
28
26
|
|
|
@@ -36,9 +34,7 @@ def _parse_response(
|
|
|
36
34
|
return None
|
|
37
35
|
|
|
38
36
|
|
|
39
|
-
def _build_response(
|
|
40
|
-
*, client: Client, response: httpx.Response
|
|
41
|
-
) -> Response[Union[Any, PendingInvitationAccept]]:
|
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PendingInvitationAccept]]:
|
|
42
38
|
return Response(
|
|
43
39
|
status_code=HTTPStatus(response.status_code),
|
|
44
40
|
content=response.content,
|
|
@@ -33,9 +33,7 @@ def _get_kwargs(
|
|
|
33
33
|
return _kwargs
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def _parse_response(
|
|
37
|
-
*, client: Client, response: httpx.Response
|
|
38
|
-
) -> Union[Any, PendingInvitation] | None:
|
|
36
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, PendingInvitation] | None:
|
|
39
37
|
if response.status_code == 200:
|
|
40
38
|
response_200 = PendingInvitation.from_dict(response.json())
|
|
41
39
|
|
|
@@ -52,9 +50,7 @@ def _parse_response(
|
|
|
52
50
|
return None
|
|
53
51
|
|
|
54
52
|
|
|
55
|
-
def _build_response(
|
|
56
|
-
*, client: Client, response: httpx.Response
|
|
57
|
-
) -> Response[Union[Any, PendingInvitation]]:
|
|
53
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PendingInvitation]]:
|
|
58
54
|
return Response(
|
|
59
55
|
status_code=HTTPStatus(response.status_code),
|
|
60
56
|
content=response.content,
|
|
@@ -34,9 +34,7 @@ def _get_kwargs(
|
|
|
34
34
|
return _kwargs
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def _parse_response(
|
|
38
|
-
*, client: Client, response: httpx.Response
|
|
39
|
-
) -> Union[Any, WorkspaceUser] | None:
|
|
37
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, WorkspaceUser] | None:
|
|
40
38
|
if response.status_code == 200:
|
|
41
39
|
response_200 = WorkspaceUser.from_dict(response.json())
|
|
42
40
|
|
|
@@ -53,9 +51,7 @@ def _parse_response(
|
|
|
53
51
|
return None
|
|
54
52
|
|
|
55
53
|
|
|
56
|
-
def _build_response(
|
|
57
|
-
*, client: Client, response: httpx.Response
|
|
58
|
-
) -> Response[Union[Any, WorkspaceUser]]:
|
|
54
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, WorkspaceUser]]:
|
|
59
55
|
return Response(
|
|
60
56
|
status_code=HTTPStatus(response.status_code),
|
|
61
57
|
content=response.content,
|
blaxel/core/client/client.py
CHANGED
|
@@ -43,9 +43,7 @@ class Client:
|
|
|
43
43
|
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
44
44
|
_auth: httpx.Auth = field(default=None, alias="auth")
|
|
45
45
|
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
46
|
-
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(
|
|
47
|
-
default=True, kw_only=True, alias="verify_ssl"
|
|
48
|
-
)
|
|
46
|
+
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
49
47
|
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
50
48
|
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
51
49
|
_client: httpx.Client | None = field(default=None, init=False)
|
|
@@ -107,6 +105,12 @@ class Client:
|
|
|
107
105
|
def get_httpx_client(self) -> httpx.Client:
|
|
108
106
|
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
109
107
|
if self._client is None:
|
|
108
|
+
# Set default limits if not provided in httpx_args to prevent TLS handshake issues
|
|
109
|
+
limits = self._httpx_args.get("limits")
|
|
110
|
+
if limits is None:
|
|
111
|
+
limits = httpx.Limits(max_connections=100, max_keepalive_connections=20)
|
|
112
|
+
# Disable HTTP/2 to prevent TLS handshake issues in certain environments
|
|
113
|
+
http2 = self._httpx_args.get("http2", False)
|
|
110
114
|
self._client = httpx.Client(
|
|
111
115
|
base_url=self._base_url,
|
|
112
116
|
cookies=self._cookies,
|
|
@@ -115,7 +119,9 @@ class Client:
|
|
|
115
119
|
verify=self._verify_ssl,
|
|
116
120
|
follow_redirects=self._follow_redirects,
|
|
117
121
|
auth=self._auth,
|
|
118
|
-
|
|
122
|
+
limits=limits,
|
|
123
|
+
http2=http2,
|
|
124
|
+
**{k: v for k, v in self._httpx_args.items() if k not in ("limits", "http2")},
|
|
119
125
|
)
|
|
120
126
|
return self._client
|
|
121
127
|
|
|
@@ -139,6 +145,12 @@ class Client:
|
|
|
139
145
|
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
140
146
|
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
141
147
|
if self._async_client is None:
|
|
148
|
+
# Set default limits if not provided in httpx_args to prevent TLS handshake issues
|
|
149
|
+
limits = self._httpx_args.get("limits")
|
|
150
|
+
if limits is None:
|
|
151
|
+
limits = httpx.Limits(max_connections=100, max_keepalive_connections=20)
|
|
152
|
+
# Disable HTTP/2 to prevent TLS handshake issues in certain environments
|
|
153
|
+
http2 = self._httpx_args.get("http2", False)
|
|
142
154
|
self._async_client = httpx.AsyncClient(
|
|
143
155
|
base_url=self._base_url,
|
|
144
156
|
cookies=self._cookies,
|
|
@@ -147,7 +159,9 @@ class Client:
|
|
|
147
159
|
verify=self._verify_ssl,
|
|
148
160
|
follow_redirects=self._follow_redirects,
|
|
149
161
|
auth=self._auth,
|
|
150
|
-
|
|
162
|
+
limits=limits,
|
|
163
|
+
http2=http2,
|
|
164
|
+
**{k: v for k, v in self._httpx_args.items() if k not in ("limits", "http2")},
|
|
151
165
|
)
|
|
152
166
|
return self._async_client
|
|
153
167
|
|