blaxel 0.2.31rc120__py3-none-any.whl → 0.2.32__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.
Files changed (432) hide show
  1. blaxel/__init__.py +3 -3
  2. blaxel/core/agents/__init__.py +16 -7
  3. blaxel/core/authentication/__init__.py +2 -1
  4. blaxel/core/authentication/devicemode.py +9 -1
  5. blaxel/core/authentication/oauth.py +13 -6
  6. blaxel/core/authentication/types.py +1 -0
  7. blaxel/core/cache/cache.py +10 -3
  8. blaxel/core/client/api/agents/create_agent.py +5 -5
  9. blaxel/core/client/api/agents/delete_agent.py +5 -5
  10. blaxel/core/client/api/agents/get_agent.py +4 -4
  11. blaxel/core/client/api/agents/list_agent_revisions.py +8 -6
  12. blaxel/core/client/api/agents/list_agents.py +5 -5
  13. blaxel/core/client/api/agents/update_agent.py +5 -5
  14. blaxel/core/client/api/compute/create_sandbox.py +5 -5
  15. blaxel/core/client/api/compute/create_sandbox_preview.py +5 -5
  16. blaxel/core/client/api/compute/create_sandbox_preview_token.py +5 -5
  17. blaxel/core/client/api/compute/delete_sandbox.py +5 -5
  18. blaxel/core/client/api/compute/delete_sandbox_preview.py +5 -5
  19. blaxel/core/client/api/compute/delete_sandbox_preview_token.py +11 -7
  20. blaxel/core/client/api/compute/get_sandbox.py +4 -4
  21. blaxel/core/client/api/compute/get_sandbox_preview.py +5 -5
  22. blaxel/core/client/api/compute/list_sandbox_preview_tokens.py +5 -5
  23. blaxel/core/client/api/compute/list_sandbox_previews.py +5 -5
  24. blaxel/core/client/api/compute/list_sandboxes.py +5 -5
  25. blaxel/core/client/api/compute/update_sandbox.py +5 -5
  26. blaxel/core/client/api/compute/update_sandbox_preview.py +5 -5
  27. blaxel/core/client/api/configurations/get_configuration.py +5 -5
  28. blaxel/core/client/api/customdomains/create_custom_domain.py +5 -5
  29. blaxel/core/client/api/customdomains/delete_custom_domain.py +5 -5
  30. blaxel/core/client/api/customdomains/get_custom_domain.py +5 -5
  31. blaxel/core/client/api/customdomains/list_custom_domains.py +5 -5
  32. blaxel/core/client/api/customdomains/update_custom_domain.py +5 -5
  33. blaxel/core/client/api/customdomains/verify_custom_domain.py +5 -5
  34. blaxel/core/client/api/default/get_template.py +5 -5
  35. blaxel/core/client/api/default/list_mcp_hub_definitions.py +5 -5
  36. blaxel/core/client/api/default/list_sandbox_hub_definitions.py +11 -7
  37. blaxel/core/client/api/functions/create_function.py +5 -5
  38. blaxel/core/client/api/functions/delete_function.py +5 -5
  39. blaxel/core/client/api/functions/get_function.py +4 -4
  40. blaxel/core/client/api/functions/list_function_revisions.py +8 -6
  41. blaxel/core/client/api/functions/list_functions.py +5 -5
  42. blaxel/core/client/api/functions/update_function.py +5 -5
  43. blaxel/core/client/api/images/cleanup_images.py +8 -6
  44. blaxel/core/client/api/images/delete_image.py +4 -4
  45. blaxel/core/client/api/images/delete_image_tag.py +4 -4
  46. blaxel/core/client/api/images/get_image.py +5 -5
  47. blaxel/core/client/api/images/list_images.py +5 -5
  48. blaxel/core/client/api/integrations/create_integration_connection.py +5 -5
  49. blaxel/core/client/api/integrations/delete_integration_connection.py +5 -5
  50. blaxel/core/client/api/integrations/get_integration.py +5 -5
  51. blaxel/core/client/api/integrations/get_integration_connection.py +5 -5
  52. blaxel/core/client/api/integrations/get_integration_connection_model.py +3 -3
  53. blaxel/core/client/api/integrations/get_integration_connection_model_endpoint_configurations.py +3 -3
  54. blaxel/core/client/api/integrations/list_integration_connection_models.py +3 -3
  55. blaxel/core/client/api/integrations/list_integration_connections.py +11 -7
  56. blaxel/core/client/api/integrations/update_integration_connection.py +5 -5
  57. blaxel/core/client/api/invitations/list_all_pending_invitations.py +7 -5
  58. blaxel/core/client/api/jobs/create_job.py +5 -5
  59. blaxel/core/client/api/jobs/create_job_execution.py +7 -5
  60. blaxel/core/client/api/jobs/delete_job.py +5 -5
  61. blaxel/core/client/api/jobs/delete_job_execution.py +7 -5
  62. blaxel/core/client/api/jobs/get_job.py +4 -4
  63. blaxel/core/client/api/jobs/get_job_execution.py +7 -5
  64. blaxel/core/client/api/jobs/list_job_executions.py +10 -6
  65. blaxel/core/client/api/jobs/list_job_revisions.py +8 -6
  66. blaxel/core/client/api/jobs/list_jobs.py +5 -5
  67. blaxel/core/client/api/jobs/update_job.py +5 -5
  68. blaxel/core/client/api/locations/list_locations.py +8 -6
  69. blaxel/core/client/api/models/create_model.py +5 -5
  70. blaxel/core/client/api/models/delete_model.py +5 -5
  71. blaxel/core/client/api/models/get_model.py +5 -5
  72. blaxel/core/client/api/models/list_model_revisions.py +8 -6
  73. blaxel/core/client/api/models/list_models.py +5 -5
  74. blaxel/core/client/api/models/update_model.py +5 -5
  75. blaxel/core/client/api/policies/create_policy.py +5 -5
  76. blaxel/core/client/api/policies/delete_policy.py +5 -5
  77. blaxel/core/client/api/policies/get_policy.py +5 -5
  78. blaxel/core/client/api/policies/list_policies.py +5 -5
  79. blaxel/core/client/api/policies/update_policy.py +5 -5
  80. blaxel/core/client/api/public_ipslist/list_public_ips.py +5 -5
  81. blaxel/core/client/api/service_accounts/create_api_key_for_service_account.py +5 -5
  82. blaxel/core/client/api/service_accounts/create_workspace_service_account.py +11 -7
  83. blaxel/core/client/api/service_accounts/delete_api_key_for_service_account.py +3 -3
  84. blaxel/core/client/api/service_accounts/delete_workspace_service_account.py +11 -7
  85. blaxel/core/client/api/service_accounts/get_workspace_service_accounts.py +8 -6
  86. blaxel/core/client/api/service_accounts/list_api_keys_for_service_account.py +5 -5
  87. blaxel/core/client/api/service_accounts/update_workspace_service_account.py +11 -7
  88. blaxel/core/client/api/templates/list_templates.py +5 -5
  89. blaxel/core/client/api/volume_templates/create_volume_template.py +4 -4
  90. blaxel/core/client/api/volume_templates/delete_volume_template.py +5 -5
  91. blaxel/core/client/api/volume_templates/delete_volume_template_version.py +4 -4
  92. blaxel/core/client/api/volume_templates/get_volume_template.py +5 -5
  93. blaxel/core/client/api/volume_templates/list_volume_templates.py +8 -6
  94. blaxel/core/client/api/volume_templates/update_volume_template.py +4 -4
  95. blaxel/core/client/api/volumes/create_volume.py +5 -5
  96. blaxel/core/client/api/volumes/delete_volume.py +5 -5
  97. blaxel/core/client/api/volumes/get_volume.py +5 -5
  98. blaxel/core/client/api/volumes/list_volumes.py +5 -5
  99. blaxel/core/client/api/workspaces/accept_workspace_invitation.py +10 -6
  100. blaxel/core/client/api/workspaces/check_workspace_availability.py +5 -5
  101. blaxel/core/client/api/workspaces/create_workspace.py +5 -5
  102. blaxel/core/client/api/workspaces/decline_workspace_invitation.py +5 -5
  103. blaxel/core/client/api/workspaces/delete_workspace.py +5 -5
  104. blaxel/core/client/api/workspaces/get_workspace.py +5 -5
  105. blaxel/core/client/api/workspaces/invite_workspace_user.py +10 -6
  106. blaxel/core/client/api/workspaces/leave_workspace.py +4 -4
  107. blaxel/core/client/api/workspaces/list_workspace_users.py +5 -5
  108. blaxel/core/client/api/workspaces/list_workspaces.py +5 -5
  109. blaxel/core/client/api/workspaces/remove_workspace_user.py +3 -3
  110. blaxel/core/client/api/workspaces/update_workspace.py +5 -5
  111. blaxel/core/client/api/workspaces/update_workspace_user_role.py +10 -6
  112. blaxel/core/client/client.py +5 -19
  113. blaxel/core/client/models/acl.py +3 -3
  114. blaxel/core/client/models/agent.py +12 -5
  115. blaxel/core/client/models/agent_spec.py +22 -7
  116. blaxel/core/client/models/api_key.py +6 -6
  117. blaxel/core/client/models/billable_time_metric.py +3 -4
  118. blaxel/core/client/models/check_workspace_availability_body.py +1 -1
  119. blaxel/core/client/models/cleanup_images_response_200.py +1 -1
  120. blaxel/core/client/models/configuration.py +2 -3
  121. blaxel/core/client/models/continent.py +2 -2
  122. blaxel/core/client/models/core_event.py +3 -3
  123. blaxel/core/client/models/core_spec.py +14 -5
  124. blaxel/core/client/models/core_spec_configurations.py +1 -2
  125. blaxel/core/client/models/country.py +2 -2
  126. blaxel/core/client/models/create_api_key_for_service_account_body.py +1 -1
  127. blaxel/core/client/models/create_job_execution_request.py +4 -5
  128. blaxel/core/client/models/create_job_execution_request_tasks_item.py +1 -1
  129. blaxel/core/client/models/create_job_execution_response.py +4 -5
  130. blaxel/core/client/models/create_job_execution_response_tasks_item.py +1 -1
  131. blaxel/core/client/models/create_workspace_service_account_body.py +1 -1
  132. blaxel/core/client/models/create_workspace_service_account_response_200.py +1 -1
  133. blaxel/core/client/models/custom_domain.py +6 -3
  134. blaxel/core/client/models/custom_domain_metadata.py +6 -7
  135. blaxel/core/client/models/custom_domain_spec.py +10 -7
  136. blaxel/core/client/models/custom_domain_spec_txt_records.py +1 -1
  137. blaxel/core/client/models/delete_sandbox_preview_token_response_200.py +1 -1
  138. blaxel/core/client/models/delete_volume_template_version_response_200.py +6 -3
  139. blaxel/core/client/models/delete_workspace_service_account_response_200.py +1 -1
  140. blaxel/core/client/models/entrypoint.py +4 -3
  141. blaxel/core/client/models/entrypoint_env.py +1 -1
  142. blaxel/core/client/models/expiration_policy.py +2 -2
  143. blaxel/core/client/models/flavor.py +2 -2
  144. blaxel/core/client/models/form.py +6 -3
  145. blaxel/core/client/models/form_config.py +1 -1
  146. blaxel/core/client/models/form_oauth.py +1 -1
  147. blaxel/core/client/models/form_secrets.py +1 -1
  148. blaxel/core/client/models/function.py +12 -5
  149. blaxel/core/client/models/function_spec.py +17 -6
  150. blaxel/core/client/models/get_workspace_service_accounts_response_200_item.py +1 -1
  151. blaxel/core/client/models/histogram_bucket.py +1 -1
  152. blaxel/core/client/models/histogram_stats.py +1 -1
  153. blaxel/core/client/models/image.py +6 -3
  154. blaxel/core/client/models/image_metadata.py +6 -6
  155. blaxel/core/client/models/image_spec.py +1 -2
  156. blaxel/core/client/models/image_tag.py +3 -3
  157. blaxel/core/client/models/integration.py +12 -5
  158. blaxel/core/client/models/integration_additional_infos.py +1 -1
  159. blaxel/core/client/models/integration_connection.py +6 -3
  160. blaxel/core/client/models/integration_connection_spec.py +1 -2
  161. blaxel/core/client/models/integration_connection_spec_config.py +1 -1
  162. blaxel/core/client/models/integration_connection_spec_secret.py +1 -1
  163. blaxel/core/client/models/integration_endpoint.py +9 -6
  164. blaxel/core/client/models/integration_endpoint_token.py +1 -1
  165. blaxel/core/client/models/integration_endpoints.py +1 -3
  166. blaxel/core/client/models/integration_headers.py +1 -1
  167. blaxel/core/client/models/integration_model.py +1 -1
  168. blaxel/core/client/models/integration_organization.py +2 -2
  169. blaxel/core/client/models/integration_query_params.py +1 -1
  170. blaxel/core/client/models/integration_repository.py +2 -2
  171. blaxel/core/client/models/invite_workspace_user_body.py +1 -1
  172. blaxel/core/client/models/job.py +12 -5
  173. blaxel/core/client/models/job_execution.py +6 -3
  174. blaxel/core/client/models/job_execution_config.py +3 -3
  175. blaxel/core/client/models/job_execution_metadata.py +7 -7
  176. blaxel/core/client/models/job_execution_spec.py +1 -2
  177. blaxel/core/client/models/job_execution_stats.py +1 -1
  178. blaxel/core/client/models/job_execution_task.py +6 -3
  179. blaxel/core/client/models/job_execution_task_condition.py +3 -3
  180. blaxel/core/client/models/job_execution_task_metadata.py +6 -6
  181. blaxel/core/client/models/job_execution_task_spec.py +2 -2
  182. blaxel/core/client/models/job_metrics.py +15 -12
  183. blaxel/core/client/models/job_metrics_executions_total.py +1 -1
  184. blaxel/core/client/models/job_metrics_tasks_total.py +1 -1
  185. blaxel/core/client/models/job_spec.py +17 -6
  186. blaxel/core/client/models/jobs_chart_value.py +1 -1
  187. blaxel/core/client/models/jobs_network_chart.py +1 -2
  188. blaxel/core/client/models/jobs_success_failed_chart.py +11 -4
  189. blaxel/core/client/models/jobs_total.py +1 -1
  190. blaxel/core/client/models/last_n_requests_metric.py +4 -4
  191. blaxel/core/client/models/latency_metric.py +10 -7
  192. blaxel/core/client/models/location_response.py +1 -2
  193. blaxel/core/client/models/logs_response.py +1 -1
  194. blaxel/core/client/models/logs_response_data.py +4 -4
  195. blaxel/core/client/models/mcp_definition.py +11 -8
  196. blaxel/core/client/models/mcp_definition_entrypoint.py +1 -1
  197. blaxel/core/client/models/mcp_definition_form.py +1 -1
  198. blaxel/core/client/models/memory_allocation_by_name.py +1 -1
  199. blaxel/core/client/models/memory_allocation_metric.py +2 -2
  200. blaxel/core/client/models/metadata.py +6 -7
  201. blaxel/core/client/models/metadata_labels.py +1 -1
  202. blaxel/core/client/models/metric.py +2 -2
  203. blaxel/core/client/models/metrics.py +24 -11
  204. blaxel/core/client/models/metrics_models.py +1 -1
  205. blaxel/core/client/models/metrics_request_total_per_code.py +1 -1
  206. blaxel/core/client/models/metrics_rps_per_code.py +1 -1
  207. blaxel/core/client/models/model.py +12 -5
  208. blaxel/core/client/models/model_spec.py +14 -5
  209. blaxel/core/client/models/o_auth.py +2 -2
  210. blaxel/core/client/models/owner_fields.py +3 -3
  211. blaxel/core/client/models/pending_invitation.py +6 -6
  212. blaxel/core/client/models/pending_invitation_accept.py +6 -3
  213. blaxel/core/client/models/pending_invitation_render.py +14 -7
  214. blaxel/core/client/models/pending_invitation_render_invited_by.py +1 -1
  215. blaxel/core/client/models/pending_invitation_render_workspace.py +2 -2
  216. blaxel/core/client/models/pending_invitation_workspace_details.py +1 -1
  217. blaxel/core/client/models/pod_template_spec.py +1 -1
  218. blaxel/core/client/models/policy.py +6 -3
  219. blaxel/core/client/models/policy_location.py +2 -2
  220. blaxel/core/client/models/policy_max_tokens.py +5 -3
  221. blaxel/core/client/models/policy_spec.py +15 -8
  222. blaxel/core/client/models/port.py +1 -1
  223. blaxel/core/client/models/preview.py +6 -3
  224. blaxel/core/client/models/preview_metadata.py +8 -8
  225. blaxel/core/client/models/preview_spec.py +5 -6
  226. blaxel/core/client/models/preview_spec_request_headers.py +1 -1
  227. blaxel/core/client/models/preview_spec_response_headers.py +1 -1
  228. blaxel/core/client/models/preview_token.py +6 -3
  229. blaxel/core/client/models/preview_token_metadata.py +4 -4
  230. blaxel/core/client/models/preview_token_spec.py +2 -2
  231. blaxel/core/client/models/private_location.py +1 -1
  232. blaxel/core/client/models/public_ip.py +3 -3
  233. blaxel/core/client/models/public_ips.py +1 -2
  234. blaxel/core/client/models/region.py +2 -2
  235. blaxel/core/client/models/repository.py +2 -2
  236. blaxel/core/client/models/request_duration_over_time_metric.py +1 -1
  237. blaxel/core/client/models/request_duration_over_time_metrics.py +4 -3
  238. blaxel/core/client/models/request_total_by_origin_metric.py +23 -10
  239. blaxel/core/client/models/request_total_by_origin_metric_request_total_by_origin.py +1 -1
  240. blaxel/core/client/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +1 -1
  241. blaxel/core/client/models/request_total_metric.py +14 -7
  242. blaxel/core/client/models/request_total_metric_request_total_per_code.py +1 -1
  243. blaxel/core/client/models/request_total_metric_rps_per_code.py +1 -1
  244. blaxel/core/client/models/request_total_response_data.py +5 -5
  245. blaxel/core/client/models/resource.py +6 -4
  246. blaxel/core/client/models/resource_log.py +1 -1
  247. blaxel/core/client/models/resource_log_chart.py +1 -1
  248. blaxel/core/client/models/resource_log_response.py +2 -2
  249. blaxel/core/client/models/resource_metrics.py +95 -40
  250. blaxel/core/client/models/resource_metrics_request_total_per_code.py +1 -1
  251. blaxel/core/client/models/resource_metrics_request_total_per_code_previous.py +1 -1
  252. blaxel/core/client/models/resource_metrics_rps_per_code.py +1 -1
  253. blaxel/core/client/models/resource_metrics_rps_per_code_previous.py +1 -1
  254. blaxel/core/client/models/resource_trace.py +5 -5
  255. blaxel/core/client/models/revision_configuration.py +3 -3
  256. blaxel/core/client/models/revision_metadata.py +5 -5
  257. blaxel/core/client/models/runtime.py +9 -10
  258. blaxel/core/client/models/runtime_configuration.py +1 -1
  259. blaxel/core/client/models/runtime_startup_probe.py +1 -1
  260. blaxel/core/client/models/sandbox.py +13 -6
  261. blaxel/core/client/models/sandbox_definition.py +3 -4
  262. blaxel/core/client/models/sandbox_lifecycle.py +2 -3
  263. blaxel/core/client/models/sandbox_metrics.py +1 -1
  264. blaxel/core/client/models/sandbox_spec.py +25 -8
  265. blaxel/core/client/models/serverless_config.py +4 -5
  266. blaxel/core/client/models/serverless_config_configuration.py +1 -1
  267. blaxel/core/client/models/spec_configuration.py +1 -1
  268. blaxel/core/client/models/start_sandbox.py +6 -3
  269. blaxel/core/client/models/stop_sandbox.py +6 -3
  270. blaxel/core/client/models/store_agent.py +6 -7
  271. blaxel/core/client/models/store_agent_labels.py +1 -1
  272. blaxel/core/client/models/store_configuration.py +7 -6
  273. blaxel/core/client/models/store_configuration_option.py +2 -2
  274. blaxel/core/client/models/template.py +6 -7
  275. blaxel/core/client/models/template_variable.py +1 -1
  276. blaxel/core/client/models/time_fields.py +3 -3
  277. blaxel/core/client/models/time_to_first_token_over_time_metrics.py +7 -4
  278. blaxel/core/client/models/token_rate_metric.py +3 -3
  279. blaxel/core/client/models/token_rate_metrics.py +4 -5
  280. blaxel/core/client/models/token_total_metric.py +13 -7
  281. blaxel/core/client/models/trace_ids_response.py +1 -1
  282. blaxel/core/client/models/trigger.py +2 -3
  283. blaxel/core/client/models/trigger_configuration.py +4 -5
  284. blaxel/core/client/models/trigger_configuration_task.py +1 -1
  285. blaxel/core/client/models/update_workspace_service_account_body.py +1 -1
  286. blaxel/core/client/models/update_workspace_service_account_response_200.py +1 -1
  287. blaxel/core/client/models/update_workspace_user_role_body.py +1 -1
  288. blaxel/core/client/models/volume.py +13 -6
  289. blaxel/core/client/models/volume_attachment.py +3 -3
  290. blaxel/core/client/models/volume_spec.py +2 -2
  291. blaxel/core/client/models/volume_state.py +2 -2
  292. blaxel/core/client/models/volume_template.py +6 -3
  293. blaxel/core/client/models/volume_template_spec.py +2 -2
  294. blaxel/core/client/models/volume_template_state.py +6 -4
  295. blaxel/core/client/models/volume_template_version.py +4 -4
  296. blaxel/core/client/models/websocket_channel.py +4 -4
  297. blaxel/core/client/models/websocket_message.py +3 -3
  298. blaxel/core/client/models/workspace.py +13 -10
  299. blaxel/core/client/models/workspace_labels.py +1 -1
  300. blaxel/core/client/models/workspace_runtime.py +1 -1
  301. blaxel/core/client/models/workspace_user.py +1 -1
  302. blaxel/core/client/response_interceptor.py +3 -1
  303. blaxel/core/common/autoload.py +9 -11
  304. blaxel/core/common/env.py +10 -8
  305. blaxel/core/common/settings.py +7 -5
  306. blaxel/core/common/webhook.py +0 -1
  307. blaxel/core/jobs/__init__.py +13 -3
  308. blaxel/core/mcp/client.py +8 -2
  309. blaxel/core/mcp/server.py +8 -2
  310. blaxel/core/models/__init__.py +6 -5
  311. blaxel/core/sandbox/__init__.py +1 -1
  312. blaxel/core/sandbox/client/api/codegen/get_codegen_reranking_path.py +10 -6
  313. blaxel/core/sandbox/client/api/fastapply/put_codegen_fastapply_path.py +10 -6
  314. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_multipart_upload_id_abort.py +10 -6
  315. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_path.py +10 -6
  316. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +10 -6
  317. blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +7 -5
  318. blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +10 -6
  319. blaxel/core/sandbox/client/api/filesystem/get_filesystem_multipart.py +4 -4
  320. blaxel/core/sandbox/client/api/filesystem/get_filesystem_multipart_upload_id_parts.py +4 -4
  321. blaxel/core/sandbox/client/api/filesystem/get_filesystem_path.py +4 -4
  322. blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +10 -6
  323. blaxel/core/sandbox/client/api/filesystem/get_filesystem_tree_path.py +4 -4
  324. blaxel/core/sandbox/client/api/filesystem/get_watch_filesystem_path.py +10 -6
  325. blaxel/core/sandbox/client/api/filesystem/post_filesystem_multipart_initiate_path.py +4 -4
  326. blaxel/core/sandbox/client/api/filesystem/post_filesystem_multipart_upload_id_complete.py +10 -6
  327. blaxel/core/sandbox/client/api/filesystem/put_filesystem_multipart_upload_id_part.py +4 -4
  328. blaxel/core/sandbox/client/api/filesystem/put_filesystem_path.py +10 -6
  329. blaxel/core/sandbox/client/api/filesystem/put_filesystem_tree_path.py +4 -4
  330. blaxel/core/sandbox/client/api/network/delete_network_process_pid_monitor.py +4 -4
  331. blaxel/core/sandbox/client/api/network/get_network_process_pid_ports.py +4 -4
  332. blaxel/core/sandbox/client/api/network/post_network_process_pid_monitor.py +4 -4
  333. blaxel/core/sandbox/client/api/process/delete_process_identifier.py +10 -6
  334. blaxel/core/sandbox/client/api/process/delete_process_identifier_kill.py +10 -6
  335. blaxel/core/sandbox/client/api/process/get_process.py +8 -6
  336. blaxel/core/sandbox/client/api/process/get_process_identifier.py +10 -6
  337. blaxel/core/sandbox/client/api/process/get_process_identifier_logs.py +10 -6
  338. blaxel/core/sandbox/client/api/process/get_process_identifier_logs_stream.py +10 -6
  339. blaxel/core/sandbox/client/api/process/post_process.py +10 -6
  340. blaxel/core/sandbox/client/api/root/delete.py +5 -5
  341. blaxel/core/sandbox/client/api/root/get.py +5 -5
  342. blaxel/core/sandbox/client/api/root/options.py +5 -5
  343. blaxel/core/sandbox/client/api/root/patch.py +5 -5
  344. blaxel/core/sandbox/client/api/root/post.py +5 -5
  345. blaxel/core/sandbox/client/api/root/put.py +5 -5
  346. blaxel/core/sandbox/client/client.py +3 -1
  347. blaxel/core/sandbox/client/models/apply_edit_request.py +2 -2
  348. blaxel/core/sandbox/client/models/apply_edit_response.py +3 -3
  349. blaxel/core/sandbox/client/models/content_search_match.py +1 -1
  350. blaxel/core/sandbox/client/models/content_search_response.py +1 -1
  351. blaxel/core/sandbox/client/models/delete_network_process_pid_monitor_response_200.py +1 -1
  352. blaxel/core/sandbox/client/models/directory.py +1 -1
  353. blaxel/core/sandbox/client/models/error_response.py +1 -1
  354. blaxel/core/sandbox/client/models/file.py +2 -2
  355. blaxel/core/sandbox/client/models/file_request.py +2 -2
  356. blaxel/core/sandbox/client/models/file_with_content.py +2 -2
  357. blaxel/core/sandbox/client/models/filesystem_multipart_upload.py +3 -3
  358. blaxel/core/sandbox/client/models/filesystem_multipart_upload_parts.py +4 -2
  359. blaxel/core/sandbox/client/models/filesystem_uploaded_part.py +3 -3
  360. blaxel/core/sandbox/client/models/find_match.py +2 -2
  361. blaxel/core/sandbox/client/models/find_response.py +1 -1
  362. blaxel/core/sandbox/client/models/fuzzy_search_match.py +2 -2
  363. blaxel/core/sandbox/client/models/fuzzy_search_response.py +1 -1
  364. blaxel/core/sandbox/client/models/get_network_process_pid_ports_response_200.py +1 -1
  365. blaxel/core/sandbox/client/models/multipart_complete_request.py +1 -1
  366. blaxel/core/sandbox/client/models/multipart_initiate_request.py +1 -1
  367. blaxel/core/sandbox/client/models/multipart_initiate_response.py +2 -2
  368. blaxel/core/sandbox/client/models/multipart_list_parts_response.py +2 -2
  369. blaxel/core/sandbox/client/models/multipart_list_uploads_response.py +1 -1
  370. blaxel/core/sandbox/client/models/multipart_part_info.py +2 -2
  371. blaxel/core/sandbox/client/models/multipart_upload_part_response.py +2 -2
  372. blaxel/core/sandbox/client/models/port_monitor_request.py +1 -1
  373. blaxel/core/sandbox/client/models/post_network_process_pid_monitor_response_200.py +1 -1
  374. blaxel/core/sandbox/client/models/process_logs.py +1 -1
  375. blaxel/core/sandbox/client/models/process_request.py +6 -6
  376. blaxel/core/sandbox/client/models/process_request_env.py +1 -1
  377. blaxel/core/sandbox/client/models/process_response.py +8 -8
  378. blaxel/core/sandbox/client/models/put_filesystem_multipart_upload_id_part_body.py +1 -1
  379. blaxel/core/sandbox/client/models/ranked_file.py +1 -1
  380. blaxel/core/sandbox/client/models/reranking_response.py +1 -1
  381. blaxel/core/sandbox/client/models/subdirectory.py +1 -1
  382. blaxel/core/sandbox/client/models/success_response.py +1 -1
  383. blaxel/core/sandbox/client/models/tree_request.py +1 -1
  384. blaxel/core/sandbox/client/models/tree_request_files.py +1 -1
  385. blaxel/core/sandbox/client/models/welcome_response.py +1 -1
  386. blaxel/core/sandbox/default/__init__.py +0 -1
  387. blaxel/core/sandbox/default/action.py +3 -3
  388. blaxel/core/sandbox/default/codegen.py +2 -4
  389. blaxel/core/sandbox/default/filesystem.py +38 -82
  390. blaxel/core/sandbox/default/interpreter.py +17 -10
  391. blaxel/core/sandbox/default/preview.py +6 -2
  392. blaxel/core/sandbox/default/process.py +20 -11
  393. blaxel/core/sandbox/default/sandbox.py +24 -14
  394. blaxel/core/sandbox/sync/__init__.py +0 -2
  395. blaxel/core/sandbox/sync/action.py +2 -3
  396. blaxel/core/sandbox/sync/codegen.py +1 -5
  397. blaxel/core/sandbox/sync/filesystem.py +17 -6
  398. blaxel/core/sandbox/sync/interpreter.py +10 -6
  399. blaxel/core/sandbox/sync/network.py +0 -2
  400. blaxel/core/sandbox/sync/preview.py +76 -33
  401. blaxel/core/sandbox/sync/process.py +27 -12
  402. blaxel/core/sandbox/sync/sandbox.py +30 -18
  403. blaxel/core/sandbox/sync/session.py +6 -4
  404. blaxel/core/sandbox/types.py +2 -1
  405. blaxel/core/tools/__init__.py +30 -6
  406. blaxel/core/tools/common.py +1 -1
  407. blaxel/core/tools/types.py +2 -1
  408. blaxel/crewai/model.py +20 -5
  409. blaxel/googleadk/__init__.py +1 -1
  410. blaxel/googleadk/tools.py +3 -5
  411. blaxel/langgraph/custom/gemini.py +126 -133
  412. blaxel/langgraph/model.py +54 -50
  413. blaxel/langgraph/tools.py +9 -3
  414. blaxel/llamaindex/custom/cohere.py +25 -16
  415. blaxel/llamaindex/model.py +44 -57
  416. blaxel/llamaindex/tools.py +2 -3
  417. blaxel/pydantic/custom/gemini.py +3 -3
  418. blaxel/pydantic/tools.py +2 -4
  419. blaxel/telemetry/exporters.py +10 -3
  420. blaxel/telemetry/instrumentation/blaxel_langgraph.py +4 -2
  421. blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py +22 -5
  422. blaxel/telemetry/instrumentation/utils.py +3 -3
  423. blaxel/telemetry/log/log.py +2 -3
  424. blaxel/telemetry/log/logger.py +21 -15
  425. blaxel/telemetry/span.py +10 -6
  426. {blaxel-0.2.31rc120.dist-info → blaxel-0.2.32.dist-info}/METADATA +2 -2
  427. blaxel-0.2.32.dist-info/RECORD +506 -0
  428. blaxel/core/client/api/compute/start_sandbox.py +0 -157
  429. blaxel/core/client/api/compute/stop_sandbox.py +0 -157
  430. blaxel-0.2.31rc120.dist-info/RECORD +0 -508
  431. {blaxel-0.2.31rc120.dist-info → blaxel-0.2.32.dist-info}/WHEEL +0 -0
  432. {blaxel-0.2.31rc120.dist-info → blaxel-0.2.32.dist-info}/licenses/LICENSE +0 -0
blaxel/langgraph/model.py CHANGED
@@ -23,70 +23,69 @@ logger = getLogger(__name__)
23
23
 
24
24
  class TokenRefreshingWrapper:
25
25
  """Base wrapper class that refreshes token before each call."""
26
-
26
+
27
27
  def __init__(self, model_config: dict):
28
28
  self.model_config = model_config
29
29
  self.wrapped_model = self._create_model()
30
-
30
+
31
31
  def _create_model(self):
32
32
  """Create the model instance with current token."""
33
33
  config = self.model_config
34
- model_type = config['type']
35
- model = config['model']
36
- url = config['url']
37
- kwargs = config.get('kwargs', {})
38
-
39
-
40
- if model_type == 'mistral':
34
+ model_type = config["type"]
35
+ model = config["model"]
36
+ url = config["url"]
37
+ kwargs = config.get("kwargs", {})
38
+
39
+ if model_type == "mistral":
41
40
  return ChatOpenAI(
42
41
  api_key=settings.auth.token,
43
42
  model=model,
44
43
  base_url=f"{url}/v1",
45
- **kwargs
44
+ **kwargs,
46
45
  )
47
- elif model_type == 'cohere':
46
+ elif model_type == "cohere":
48
47
  return ChatCohere(
49
48
  cohere_api_key=settings.auth.token,
50
49
  model=model,
51
50
  base_url=url,
52
- **kwargs
51
+ **kwargs,
53
52
  )
54
- elif model_type == 'xai':
53
+ elif model_type == "xai":
55
54
  return ChatXAI(
56
55
  model=model,
57
56
  api_key=settings.auth.token,
58
57
  xai_api_base=f"{url}/v1",
59
- **kwargs
58
+ **kwargs,
60
59
  )
61
- elif model_type == 'deepseek':
60
+ elif model_type == "deepseek":
62
61
  return ChatDeepSeek(
63
62
  api_key=settings.auth.token,
64
63
  model=model,
65
64
  api_base=f"{url}/v1",
66
- **kwargs
65
+ **kwargs,
67
66
  )
68
- elif model_type == 'anthropic':
67
+ elif model_type == "anthropic":
69
68
  return ChatAnthropic(
70
69
  api_key=settings.auth.token,
71
70
  anthropic_api_url=url,
72
71
  model=model,
73
72
  default_headers=settings.auth.get_headers(),
74
- **kwargs
73
+ **kwargs,
75
74
  )
76
- elif model_type == 'gemini':
75
+ elif model_type == "gemini":
77
76
  return ChatGoogleGenerativeAI(
78
77
  model=model,
79
78
  client_options={"api_endpoint": url},
80
79
  additional_headers=settings.auth.get_headers(),
81
80
  transport="rest",
82
- **kwargs
81
+ **kwargs,
83
82
  )
84
83
  elif model_type == "cerebras":
85
84
  return ChatCerebras(
86
85
  api_key=settings.auth.token,
87
86
  model=model,
88
87
  base_url=f"{url}/v1",
89
- **kwargs
88
+ **kwargs,
90
89
  )
91
90
  else:
92
91
  if model_type != "openai":
@@ -95,24 +94,24 @@ class TokenRefreshingWrapper:
95
94
  api_key=settings.auth.token,
96
95
  model=model,
97
96
  base_url=f"{url}/v1",
98
- **kwargs
97
+ **kwargs,
99
98
  )
100
-
99
+
101
100
  def _refresh_token(self):
102
101
  """Refresh the token and recreate the model if needed."""
103
102
  # Only refresh if using ClientCredentials (which has get_token method)
104
103
  current_token = settings.auth.token
105
-
106
- if hasattr(settings.auth, 'get_token'):
104
+
105
+ if hasattr(settings.auth, "get_token"):
107
106
  # This will trigger token refresh if needed
108
107
  settings.auth.get_token()
109
-
108
+
110
109
  new_token = settings.auth.token
111
-
110
+
112
111
  # If token changed, recreate the model
113
112
  if current_token != new_token:
114
113
  self.wrapped_model = self._create_model()
115
-
114
+
116
115
  def __getattr__(self, name):
117
116
  """Delegate attribute access to wrapped model."""
118
117
  return getattr(self.wrapped_model, name)
@@ -120,7 +119,7 @@ class TokenRefreshingWrapper:
120
119
 
121
120
  class TokenRefreshingChatModel(TokenRefreshingWrapper):
122
121
  """Wrapper for chat models that refreshes token before each call."""
123
-
122
+
124
123
  async def ainvoke(
125
124
  self,
126
125
  input: LanguageModelInput,
@@ -132,7 +131,7 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
132
131
  """Async invoke with token refresh."""
133
132
  self._refresh_token()
134
133
  return await self.wrapped_model.ainvoke(input, config, stop=stop, **kwargs)
135
-
134
+
136
135
  def invoke(
137
136
  self,
138
137
  input: LanguageModelInput,
@@ -144,7 +143,7 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
144
143
  """Sync invoke with token refresh."""
145
144
  self._refresh_token()
146
145
  return self.wrapped_model.invoke(input, config, stop=stop, **kwargs)
147
-
146
+
148
147
  async def astream(
149
148
  self,
150
149
  input: LanguageModelInput,
@@ -157,7 +156,7 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
157
156
  self._refresh_token()
158
157
  async for chunk in self.wrapped_model.astream(input, config, stop=stop, **kwargs):
159
158
  yield chunk
160
-
159
+
161
160
  def stream(
162
161
  self,
163
162
  input: LanguageModelInput,
@@ -170,7 +169,7 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
170
169
  self._refresh_token()
171
170
  for chunk in self.wrapped_model.stream(input, config, stop=stop, **kwargs):
172
171
  yield chunk
173
-
172
+
174
173
  async def agenerate(
175
174
  self,
176
175
  messages: List[List[BaseMessage]],
@@ -185,10 +184,15 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
185
184
  """Async generate with token refresh."""
186
185
  self._refresh_token()
187
186
  return await self.wrapped_model.agenerate(
188
- messages, stop=stop, callbacks=callbacks, tags=tags,
189
- metadata=metadata, run_name=run_name, **kwargs
187
+ messages,
188
+ stop=stop,
189
+ callbacks=callbacks,
190
+ tags=tags,
191
+ metadata=metadata,
192
+ run_name=run_name,
193
+ **kwargs,
190
194
  )
191
-
195
+
192
196
  def generate(
193
197
  self,
194
198
  messages: List[List[BaseMessage]],
@@ -203,21 +207,26 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
203
207
  """Sync generate with token refresh."""
204
208
  self._refresh_token()
205
209
  return self.wrapped_model.generate(
206
- messages, stop=stop, callbacks=callbacks, tags=tags,
207
- metadata=metadata, run_name=run_name, **kwargs
210
+ messages,
211
+ stop=stop,
212
+ callbacks=callbacks,
213
+ tags=tags,
214
+ metadata=metadata,
215
+ run_name=run_name,
216
+ **kwargs,
208
217
  )
209
-
218
+
210
219
  async def astream_events(self, *args, **kwargs):
211
220
  """Async stream events with token refresh."""
212
221
  self._refresh_token()
213
222
  async for event in self.wrapped_model.astream_events(*args, **kwargs):
214
223
  yield event
215
-
224
+
216
225
  def batch(self, *args, **kwargs):
217
226
  """Batch with token refresh."""
218
227
  self._refresh_token()
219
228
  return self.wrapped_model.batch(*args, **kwargs)
220
-
229
+
221
230
  async def abatch(self, *args, **kwargs):
222
231
  """Async batch with token refresh."""
223
232
  self._refresh_token()
@@ -226,14 +235,9 @@ class TokenRefreshingChatModel(TokenRefreshingWrapper):
226
235
 
227
236
  async def bl_model(name: str, **kwargs):
228
237
  url, type, model = await bl_model_core(name).get_parameters()
229
-
238
+
230
239
  # Store model configuration for recreation
231
- model_config = {
232
- 'type': type,
233
- 'model': model,
234
- 'url': url,
235
- 'kwargs': kwargs
236
- }
237
-
240
+ model_config = {"type": type, "model": model, "url": url, "kwargs": kwargs}
241
+
238
242
  # Create and return the wrapper
239
- return TokenRefreshingChatModel(model_config)
243
+ return TokenRefreshingChatModel(model_config)
blaxel/langgraph/tools.py CHANGED
@@ -1,16 +1,22 @@
1
1
  from typing import Any
2
2
 
3
3
  from langchain_core.tools import StructuredTool
4
- from mcp.types import CallToolResult, EmbeddedResource, ImageContent, TextContent
4
+ from mcp.types import (
5
+ CallToolResult,
6
+ EmbeddedResource,
7
+ ImageContent,
8
+ TextContent,
9
+ )
5
10
 
6
11
  from blaxel.core.tools import bl_tools as bl_tools_core
7
12
  from blaxel.core.tools.types import Tool, ToolException
8
13
 
9
14
  NonTextContent = ImageContent | EmbeddedResource
10
15
 
16
+
11
17
  def get_langchain_tool(tool: Tool) -> StructuredTool:
12
18
  async def langchain_coroutine(
13
- **arguments: dict[str, Any],
19
+ **arguments: dict[str, Any],
14
20
  ) -> tuple[str | list[str], list[NonTextContent] | None]:
15
21
  result: CallToolResult = await tool.coroutine(**arguments)
16
22
  text_contents: list[TextContent] = []
@@ -42,4 +48,4 @@ def get_langchain_tool(tool: Tool) -> StructuredTool:
42
48
  async def bl_tools(tools_names: list[str], **kwargs) -> list[StructuredTool]:
43
49
  tools = bl_tools_core(tools_names, **kwargs)
44
50
  await tools.initialize()
45
- return [get_langchain_tool(tool) for tool in tools.get_tools()]
51
+ return [get_langchain_tool(tool) for tool in tools.get_tools()]
@@ -17,7 +17,10 @@ from llama_index.core.base.llms.types import (
17
17
  )
18
18
  from llama_index.core.bridge.pydantic import Field, PrivateAttr
19
19
  from llama_index.core.callbacks import CallbackManager
20
- from llama_index.core.llms.callbacks import llm_chat_callback, llm_completion_callback
20
+ from llama_index.core.llms.callbacks import (
21
+ llm_chat_callback,
22
+ llm_completion_callback,
23
+ )
21
24
  from llama_index.core.llms.function_calling import FunctionCallingLLM
22
25
  from llama_index.core.llms.llm import ToolSelection
23
26
  from llama_index.core.tools.types import BaseTool
@@ -56,7 +59,8 @@ class Cohere(FunctionCallingLLM):
56
59
  )
57
60
  max_retries: int = Field(default=10, description="The maximum number of API retries.")
58
61
  additional_kwargs: Dict[str, Any] = Field(
59
- default_factory=dict, description="Additional kwargs for the Cohere API."
62
+ default_factory=dict,
63
+ description="Additional kwargs for the Cohere API.",
60
64
  )
61
65
  max_tokens: int = Field(description="The maximum number of tokens to generate.")
62
66
 
@@ -213,9 +217,9 @@ class Cohere(FunctionCallingLLM):
213
217
 
214
218
  messages, documents = remove_documents_from_messages(messages)
215
219
 
216
- tool_results: List[Dict[str, Any]] | None = (
217
- _messages_to_cohere_tool_results_curr_chat_turn(messages) or kwargs.get("tool_results")
218
- )
220
+ tool_results: List[Dict[str, Any]] | None = _messages_to_cohere_tool_results_curr_chat_turn(
221
+ messages
222
+ ) or kwargs.get("tool_results")
219
223
  if not tool_results:
220
224
  tool_results = None
221
225
 
@@ -285,12 +289,14 @@ class Cohere(FunctionCallingLLM):
285
289
 
286
290
  if "stream" in all_kwargs:
287
291
  warnings.warn(
288
- "Parameter `stream` is not supported by the `chat` method."
289
- "Use the `stream_chat` method instead"
292
+ "Parameter `stream` is not supported by the `chat` method.Use the `stream_chat` method instead"
290
293
  )
291
294
 
292
295
  response = completion_with_retry(
293
- client=self._client, max_retries=self.max_retries, chat=True, **chat_request
296
+ client=self._client,
297
+ max_retries=self.max_retries,
298
+ chat=True,
299
+ **chat_request,
294
300
  )
295
301
  if not isinstance(response, cohere.NonStreamedChatResponse):
296
302
  tool_calls = response.get("tool_calls")
@@ -316,8 +322,7 @@ class Cohere(FunctionCallingLLM):
316
322
  all_kwargs = self._get_all_kwargs(**kwargs)
317
323
  if "stream" in all_kwargs:
318
324
  warnings.warn(
319
- "Parameter `stream` is not supported by the `chat` method."
320
- "Use the `stream_chat` method instead"
325
+ "Parameter `stream` is not supported by the `chat` method.Use the `stream_chat` method instead"
321
326
  )
322
327
 
323
328
  response = completion_with_retry(
@@ -343,7 +348,10 @@ class Cohere(FunctionCallingLLM):
343
348
  chat_request = self.get_cohere_chat_request(messages=messages, **all_kwargs)
344
349
 
345
350
  response = completion_with_retry(
346
- client=self._client, max_retries=self.max_retries, chat=True, **chat_request
351
+ client=self._client,
352
+ max_retries=self.max_retries,
353
+ chat=True,
354
+ **chat_request,
347
355
  )
348
356
 
349
357
  def gen() -> ChatResponseGen:
@@ -394,8 +402,7 @@ class Cohere(FunctionCallingLLM):
394
402
  raise ValueError(f"{all_kwargs['model']} not supported for chat")
395
403
  if "stream" in all_kwargs:
396
404
  warnings.warn(
397
- "Parameter `stream` is not supported by the `chat` method."
398
- "Use the `stream_chat` method instead"
405
+ "Parameter `stream` is not supported by the `chat` method.Use the `stream_chat` method instead"
399
406
  )
400
407
 
401
408
  chat_request = self.get_cohere_chat_request(messages=messages, **all_kwargs)
@@ -443,8 +450,7 @@ class Cohere(FunctionCallingLLM):
443
450
  all_kwargs = self._get_all_kwargs(**kwargs)
444
451
  if "stream" in all_kwargs:
445
452
  warnings.warn(
446
- "Parameter `stream` is not supported by the `chat` method."
447
- "Use the `stream_chat` method instead"
453
+ "Parameter `stream` is not supported by the `chat` method.Use the `stream_chat` method instead"
448
454
  )
449
455
 
450
456
  response = await acompletion_with_retry(
@@ -472,7 +478,10 @@ class Cohere(FunctionCallingLLM):
472
478
  chat_request = self.get_cohere_chat_request(messages, **all_kwargs)
473
479
 
474
480
  response = completion_with_retry(
475
- client=self._client, max_retries=self.max_retries, chat=True, **chat_request
481
+ client=self._client,
482
+ max_retries=self.max_retries,
483
+ chat=True,
484
+ **chat_request,
476
485
  )
477
486
 
478
487
  async def gen() -> ChatResponseAsyncGen:
@@ -34,35 +34,35 @@ logger = getLogger(__name__)
34
34
 
35
35
  class TokenRefreshingWrapper:
36
36
  """Base wrapper class that refreshes token before each call."""
37
-
37
+
38
38
  def __init__(self, model_config: dict):
39
39
  self.model_config = model_config
40
40
  self.wrapped_model = self._create_model()
41
-
41
+
42
42
  def _create_model(self):
43
43
  """Create the model instance with current token."""
44
44
  config = self.model_config
45
- model_type = config['type']
46
- model = config['model']
47
- url = config['url']
48
- kwargs = config.get('kwargs', {})
49
-
50
- if model_type == 'anthropic':
45
+ model_type = config["type"]
46
+ model = config["model"]
47
+ url = config["url"]
48
+ kwargs = config.get("kwargs", {})
49
+
50
+ if model_type == "anthropic":
51
51
  return Anthropic(
52
52
  model=model,
53
53
  api_key=settings.auth.token,
54
54
  base_url=url,
55
55
  default_headers=settings.auth.get_headers(),
56
- **kwargs
56
+ **kwargs,
57
57
  )
58
- elif model_type == 'xai':
58
+ elif model_type == "xai":
59
59
  return Groq(
60
60
  model=model,
61
61
  api_key=settings.auth.token,
62
62
  api_base=f"{url}/v1",
63
- **kwargs
63
+ **kwargs,
64
64
  )
65
- elif model_type == 'gemini':
65
+ elif model_type == "gemini":
66
66
  return GoogleGenAI(
67
67
  api_key=settings.auth.token,
68
68
  model=model,
@@ -71,62 +71,54 @@ class TokenRefreshingWrapper:
71
71
  base_url=url,
72
72
  headers=settings.auth.get_headers(),
73
73
  ),
74
- **kwargs
74
+ **kwargs,
75
75
  )
76
- elif model_type == 'cohere':
77
- return Cohere(
78
- model=model,
79
- api_key=settings.auth.token,
80
- api_base=url,
81
- **kwargs
82
- )
83
- elif model_type == 'deepseek':
76
+ elif model_type == "cohere":
77
+ return Cohere(model=model, api_key=settings.auth.token, api_base=url, **kwargs)
78
+ elif model_type == "deepseek":
84
79
  return DeepSeek(
85
80
  model=model,
86
81
  api_key=settings.auth.token,
87
82
  api_base=f"{url}/v1",
88
- **kwargs
83
+ **kwargs,
89
84
  )
90
- elif model_type == 'mistral':
91
- return MistralAI(
92
- model=model,
93
- api_key=settings.auth.token,
94
- endpoint=url,
95
- **kwargs
96
- )
97
- elif model_type == 'cerebras':
85
+ elif model_type == "mistral":
86
+ return MistralAI(model=model, api_key=settings.auth.token, endpoint=url, **kwargs)
87
+ elif model_type == "cerebras":
98
88
  return Cerebras(
99
89
  model=model,
100
90
  api_key=settings.auth.token,
101
91
  api_base=f"{url}/v1",
102
- **kwargs
92
+ **kwargs,
103
93
  )
104
94
  else:
105
95
  if model_type != "openai":
106
- logger.warning(f"Model {model} is not supported by LlamaIndex, defaulting to OpenAI")
107
-
96
+ logger.warning(
97
+ f"Model {model} is not supported by LlamaIndex, defaulting to OpenAI"
98
+ )
99
+
108
100
  return OpenAI(
109
101
  model=model,
110
102
  api_key=settings.auth.token,
111
103
  api_base=f"{url}/v1",
112
- **kwargs
104
+ **kwargs,
113
105
  )
114
-
106
+
115
107
  def _refresh_token(self):
116
108
  """Refresh the token and recreate the model if needed."""
117
109
  # Only refresh if using ClientCredentials (which has get_token method)
118
110
  current_token = settings.auth.token
119
-
120
- if hasattr(settings.auth, 'get_token'):
111
+
112
+ if hasattr(settings.auth, "get_token"):
121
113
  # This will trigger token refresh if needed
122
114
  settings.auth.get_token()
123
-
115
+
124
116
  new_token = settings.auth.token
125
-
117
+
126
118
  # If token changed, recreate the model
127
119
  if current_token != new_token:
128
120
  self.wrapped_model = self._create_model()
129
-
121
+
130
122
  def __getattr__(self, name):
131
123
  """Delegate attribute access to wrapped model."""
132
124
  return getattr(self.wrapped_model, name)
@@ -134,7 +126,7 @@ class TokenRefreshingWrapper:
134
126
 
135
127
  class TokenRefreshingLLM(TokenRefreshingWrapper):
136
128
  """Wrapper for LlamaIndex LLMs that refreshes token before each call."""
137
-
129
+
138
130
  async def achat(
139
131
  self,
140
132
  messages: Sequence[ChatMessage],
@@ -143,7 +135,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
143
135
  """Async chat with token refresh."""
144
136
  self._refresh_token()
145
137
  return await self.wrapped_model.achat(messages, **kwargs)
146
-
138
+
147
139
  def chat(
148
140
  self,
149
141
  messages: Sequence[ChatMessage],
@@ -152,7 +144,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
152
144
  """Sync chat with token refresh."""
153
145
  self._refresh_token()
154
146
  return self.wrapped_model.chat(messages, **kwargs)
155
-
147
+
156
148
  async def astream_chat(
157
149
  self,
158
150
  messages: Sequence[ChatMessage],
@@ -162,7 +154,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
162
154
  self._refresh_token()
163
155
  async for chunk in self.wrapped_model.astream_chat(messages, **kwargs):
164
156
  yield chunk
165
-
157
+
166
158
  def stream_chat(
167
159
  self,
168
160
  messages: Sequence[ChatMessage],
@@ -172,7 +164,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
172
164
  self._refresh_token()
173
165
  for chunk in self.wrapped_model.stream_chat(messages, **kwargs):
174
166
  yield chunk
175
-
167
+
176
168
  async def acomplete(
177
169
  self,
178
170
  prompt: str,
@@ -181,7 +173,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
181
173
  """Async complete with token refresh."""
182
174
  self._refresh_token()
183
175
  return await self.wrapped_model.acomplete(prompt, **kwargs)
184
-
176
+
185
177
  def complete(
186
178
  self,
187
179
  prompt: str,
@@ -190,7 +182,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
190
182
  """Sync complete with token refresh."""
191
183
  self._refresh_token()
192
184
  return self.wrapped_model.complete(prompt, **kwargs)
193
-
185
+
194
186
  async def astream_complete(
195
187
  self,
196
188
  prompt: str,
@@ -200,7 +192,7 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
200
192
  self._refresh_token()
201
193
  async for chunk in self.wrapped_model.astream_complete(prompt, **kwargs):
202
194
  yield chunk
203
-
195
+
204
196
  def stream_complete(
205
197
  self,
206
198
  prompt: str,
@@ -214,14 +206,9 @@ class TokenRefreshingLLM(TokenRefreshingWrapper):
214
206
 
215
207
  async def bl_model(name, **kwargs):
216
208
  url, type, model = await bl_model_core(name).get_parameters()
217
-
209
+
218
210
  # Store model configuration for recreation
219
- model_config = {
220
- 'type': type,
221
- 'model': model,
222
- 'url': url,
223
- 'kwargs': kwargs
224
- }
225
-
211
+ model_config = {"type": type, "model": model, "url": url, "kwargs": kwargs}
212
+
226
213
  # Create and return the wrapper
227
- return TokenRefreshingLLM(model_config)
214
+ return TokenRefreshingLLM(model_config)
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  from llama_index.core.tools import FunctionTool
4
2
  from llama_index.core.tools.types import ToolMetadata
5
3
 
@@ -22,7 +20,8 @@ def get_llamaindex_tool(tool: Tool) -> FunctionTool:
22
20
  ),
23
21
  )
24
22
 
23
+
25
24
  async def bl_tools(tools_names: list[str], **kwargs) -> list[FunctionTool]:
26
25
  tools = bl_tools_core(tools_names, **kwargs)
27
26
  await tools.initialize()
28
- return [get_llamaindex_tool(tool) for tool in tools.get_tools()]
27
+ return [get_llamaindex_tool(tool) for tool in tools.get_tools()]
@@ -8,11 +8,11 @@ class GoogleGLAProvider(Provider[AsyncClient]):
8
8
 
9
9
  @property
10
10
  def name(self):
11
- return 'google-gla'
11
+ return "google-gla"
12
12
 
13
13
  @property
14
14
  def base_url(self) -> str:
15
- return 'https://generativelanguage.googleapis.com/v1beta/models/'
15
+ return "https://generativelanguage.googleapis.com/v1beta/models/"
16
16
 
17
17
  @property
18
18
  def client(self) -> httpx.AsyncClient:
@@ -28,4 +28,4 @@ class GoogleGLAProvider(Provider[AsyncClient]):
28
28
  """
29
29
  self._client = http_client
30
30
  # https://cloud.google.com/docs/authentication/api-keys-use#using-with-rest
31
- self._client.headers['X-Goog-Api-Key'] = api_key
31
+ self._client.headers["X-Goog-Api-Key"] = api_key
blaxel/pydantic/tools.py CHANGED
@@ -23,9 +23,7 @@ def get_pydantic_tool(tool: Tool) -> PydanticTool:
23
23
 
24
24
  # Define the prepare function dynamically to capture the 'tool' object
25
25
  # Assuming RunContext and ToolDefinition types based on the pydantic_ai example
26
- async def prepare_tool(
27
- ctx: RunContext, tool_def: ToolDefinition
28
- ) -> ToolDefinition | None:
26
+ async def prepare_tool(ctx: RunContext, tool_def: ToolDefinition) -> ToolDefinition | None:
29
27
  """Dynamically prepares the ToolDefinition using the custom Tool's attributes."""
30
28
  tool_def.name = tool.name # Override inferred name
31
29
  tool_def.description = tool.description # Override inferred description
@@ -48,4 +46,4 @@ def get_pydantic_tool(tool: Tool) -> PydanticTool:
48
46
  async def bl_tools(tools_names: list[str], **kwargs) -> list[PydanticTool]:
49
47
  tools = bl_tools_core(tools_names, **kwargs)
50
48
  await tools.initialize()
51
- return [get_pydantic_tool(tool) for tool in tools.get_tools()]
49
+ return [get_pydantic_tool(tool) for tool in tools.get_tools()]