blaxel 0.1.22rc70__py3-none-any.whl → 0.2.0rc2__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 +6 -3
- blaxel/core/__init__.py +44 -0
- blaxel/{agents → core/agents}/__init__.py +30 -50
- blaxel/{authentication → core/authentication}/apikey.py +1 -0
- blaxel/{authentication → core/authentication}/clientcredentials.py +6 -2
- blaxel/{client → core/client}/api/agents/create_agent.py +1 -1
- blaxel/{client → core/client}/api/agents/update_agent.py +1 -1
- blaxel/{client → core/client}/api/compute/create_sandbox.py +1 -1
- blaxel/{client → core/client}/api/compute/create_sandbox_preview.py +1 -1
- blaxel/{client → core/client}/api/compute/create_sandbox_preview_token.py +1 -1
- blaxel/{client → core/client}/api/compute/update_sandbox.py +1 -1
- blaxel/{client → core/client}/api/compute/update_sandbox_preview.py +1 -1
- blaxel/{client → core/client}/api/functions/create_function.py +1 -1
- blaxel/{client → core/client}/api/functions/update_function.py +1 -1
- blaxel/{client → core/client}/api/integrations/create_integration_connection.py +1 -1
- blaxel/{client → core/client}/api/integrations/update_integration_connection.py +1 -1
- blaxel/{client → core/client}/api/jobs/create_job.py +1 -1
- blaxel/{client → core/client}/api/jobs/update_job.py +1 -1
- blaxel/{client → core/client}/api/knowledgebases/create_knowledgebase.py +1 -1
- blaxel/{client → core/client}/api/knowledgebases/update_knowledgebase.py +1 -1
- blaxel/{client → core/client}/api/models/create_model.py +1 -1
- blaxel/{client → core/client}/api/models/update_model.py +1 -1
- blaxel/{client → core/client}/api/policies/create_policy.py +1 -1
- blaxel/{client → core/client}/api/policies/update_policy.py +1 -1
- blaxel/{client → core/client}/api/service_accounts/create_api_key_for_service_account.py +1 -1
- blaxel/{client → core/client}/api/service_accounts/create_workspace_service_account.py +1 -1
- blaxel/{client → core/client}/api/service_accounts/update_workspace_service_account.py +1 -1
- blaxel/{client → core/client}/api/workspaces/check_workspace_availability.py +1 -1
- blaxel/{client → core/client}/api/workspaces/create_worspace.py +1 -1
- blaxel/{client → core/client}/api/workspaces/invite_workspace_user.py +1 -1
- blaxel/{client → core/client}/api/workspaces/update_workspace.py +1 -1
- blaxel/{client → core/client}/api/workspaces/update_workspace_user_role.py +1 -1
- blaxel/{client → core/client}/models/agent.py +1 -1
- blaxel/{client → core/client}/models/agent_spec.py +2 -2
- blaxel/{client → core/client}/models/core_spec.py +1 -1
- blaxel/{client → core/client}/models/function.py +1 -1
- blaxel/{client → core/client}/models/function_schema_properties.py +1 -1
- blaxel/{client → core/client}/models/function_spec.py +2 -2
- blaxel/{client → core/client}/models/integration.py +2 -2
- blaxel/{client → core/client}/models/integration_endpoints.py +1 -1
- blaxel/{client → core/client}/models/job.py +1 -1
- blaxel/{client → core/client}/models/job_spec.py +1 -1
- blaxel/{client → core/client}/models/knowledgebase.py +1 -1
- blaxel/{client → core/client}/models/location_response.py +1 -1
- blaxel/{client → core/client}/models/model.py +1 -1
- blaxel/{client → core/client}/models/model_spec.py +1 -1
- blaxel/{client → core/client}/models/policy_spec.py +2 -2
- blaxel/{client → core/client}/models/resource_metrics.py +3 -3
- blaxel/{client → core/client}/models/runtime.py +1 -1
- blaxel/{client → core/client}/models/sandbox.py +1 -1
- blaxel/{client → core/client}/models/sandbox_definition.py +1 -1
- blaxel/{client → core/client}/models/sandbox_spec.py +1 -1
- blaxel/{client → core/client}/models/store_agent.py +1 -1
- blaxel/{client → core/client}/models/store_configuration.py +1 -1
- blaxel/{client → core/client}/models/template.py +1 -1
- blaxel/core/common/__init__.py +6 -0
- blaxel/core/common/autoload.py +21 -0
- blaxel/{common → core/common}/internal.py +33 -62
- blaxel/core/common/logger.py +131 -0
- blaxel/{jobs → core/jobs}/__init__.py +40 -60
- blaxel/core/mcp/__init__.py +4 -0
- blaxel/{mcp → core/mcp}/client.py +13 -7
- blaxel/{mcp → core/mcp}/server.py +4 -30
- blaxel/core/models/__init__.py +52 -0
- blaxel/core/sandbox/__init__.py +29 -0
- blaxel/core/sandbox/action.py +79 -0
- blaxel/{sandbox → core/sandbox}/client/api/filesystem/put_filesystem_path.py +1 -1
- blaxel/{sandbox → core/sandbox}/client/api/network/post_network_process_pid_monitor.py +1 -1
- blaxel/core/sandbox/client/api/process/__init__.py +0 -0
- blaxel/{sandbox → core/sandbox}/client/api/process/post_process.py +1 -1
- blaxel/{sandbox → core/sandbox}/client/models/directory.py +2 -2
- blaxel/core/sandbox/filesystem.py +280 -0
- blaxel/core/sandbox/network.py +10 -0
- blaxel/{sandbox → core/sandbox}/preview.py +45 -17
- blaxel/core/sandbox/process.py +159 -0
- blaxel/{sandbox → core/sandbox}/sandbox.py +62 -5
- blaxel/core/sandbox/session.py +124 -0
- blaxel/core/sandbox/types.py +103 -0
- blaxel/{tools → core/tools}/__init__.py +62 -90
- blaxel/crewai/__init__.py +4 -0
- blaxel/{models/crewai.py → crewai/model.py} +4 -2
- blaxel/crewai/py.typed +0 -0
- blaxel/crewai/tools.py +26 -0
- blaxel/googleadk/__init__.py +4 -0
- blaxel/{models/googleadk.py → googleadk/model.py} +8 -2
- blaxel/googleadk/py.typed +0 -0
- blaxel/googleadk/tools.py +72 -0
- blaxel/langgraph/__init__.py +4 -0
- blaxel/{models/langchain.py → langgraph/model.py} +8 -4
- blaxel/langgraph/py.typed +0 -0
- blaxel/{tools/langchain.py → langgraph/tools.py} +7 -3
- blaxel/livekit/__init__.py +4 -0
- blaxel/{models/livekit.py → livekit/model.py} +7 -1
- blaxel/livekit/py.typed +0 -0
- blaxel/{tools/livekit.py → livekit/tools.py} +8 -1
- blaxel/llamaindex/__init__.py +4 -0
- blaxel/{models/llamaindex.py → llamaindex/model.py} +6 -3
- blaxel/llamaindex/py.typed +0 -0
- blaxel/{tools/llamaindex.py → llamaindex/tools.py} +7 -4
- blaxel/openai/__init__.py +4 -0
- blaxel/{models/openai.py → openai/model.py} +4 -2
- blaxel/openai/py.typed +0 -0
- blaxel/{tools/openai.py → openai/tools.py} +7 -3
- blaxel/pydantic/__init__.py +4 -0
- blaxel/{models/custom/pydantic → pydantic/custom}/gemini.py +0 -1
- blaxel/{models/pydantic.py → pydantic/model.py} +6 -4
- blaxel/pydantic/py.typed +0 -0
- blaxel/{tools/pydantic.py → pydantic/tools.py} +6 -3
- blaxel/telemetry/__init__.py +6 -0
- blaxel/telemetry/instrumentation/blaxel_core.py +124 -0
- blaxel/telemetry/instrumentation/blaxel_langgraph.py +74 -0
- blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py +360 -0
- blaxel/telemetry/instrumentation/blaxel_llamaindex.py +89 -0
- blaxel/telemetry/instrumentation/map.py +61 -0
- blaxel/telemetry/instrumentation/utils.py +74 -0
- blaxel/{common → telemetry/log}/logger.py +6 -12
- blaxel/{instrumentation → telemetry}/manager.py +20 -12
- blaxel/telemetry/py.typed +0 -0
- blaxel/{instrumentation → telemetry}/span.py +12 -1
- blaxel-0.2.0rc2.dist-info/METADATA +224 -0
- blaxel-0.2.0rc2.dist-info/RECORD +408 -0
- blaxel/common/autoload.py +0 -9
- blaxel/instrumentation/map.py +0 -49
- blaxel/mcp/__init__.py +0 -3
- blaxel/models/__init__.py +0 -104
- blaxel/sandbox/base.py +0 -67
- blaxel/sandbox/filesystem.py +0 -104
- blaxel/sandbox/process.py +0 -56
- blaxel/tools/crewai.py +0 -22
- blaxel/tools/googleadk.py +0 -66
- blaxel-0.1.22rc70.dist-info/METADATA +0 -169
- blaxel-0.1.22rc70.dist-info/RECORD +0 -379
- /blaxel/{authentication → core/authentication}/__init__.py +0 -0
- /blaxel/{authentication → core/authentication}/devicemode.py +0 -0
- /blaxel/{authentication → core/authentication}/oauth.py +0 -0
- /blaxel/{authentication → core/authentication}/types.py +0 -0
- /blaxel/{cache → core/cache}/__init__.py +0 -0
- /blaxel/{cache → core/cache}/cache.py +0 -0
- /blaxel/{client → core/client}/__init__.py +0 -0
- /blaxel/{client → core/client}/api/__init__.py +0 -0
- /blaxel/{client → core/client}/api/agents/__init__.py +0 -0
- /blaxel/{client → core/client}/api/agents/delete_agent.py +0 -0
- /blaxel/{client → core/client}/api/agents/get_agent.py +0 -0
- /blaxel/{client → core/client}/api/agents/list_agent_revisions.py +0 -0
- /blaxel/{client → core/client}/api/agents/list_agents.py +0 -0
- /blaxel/{client → core/client}/api/compute/__init__.py +0 -0
- /blaxel/{client → core/client}/api/compute/delete_sandbox.py +0 -0
- /blaxel/{client → core/client}/api/compute/delete_sandbox_preview.py +0 -0
- /blaxel/{client → core/client}/api/compute/delete_sandbox_preview_token.py +0 -0
- /blaxel/{client → core/client}/api/compute/get_sandbox.py +0 -0
- /blaxel/{client → core/client}/api/compute/get_sandbox_preview.py +0 -0
- /blaxel/{client → core/client}/api/compute/list_sandbox_preview_tokens.py +0 -0
- /blaxel/{client → core/client}/api/compute/list_sandbox_previews.py +0 -0
- /blaxel/{client → core/client}/api/compute/list_sandboxes.py +0 -0
- /blaxel/{client → core/client}/api/compute/start_sandbox.py +0 -0
- /blaxel/{client → core/client}/api/compute/stop_sandbox.py +0 -0
- /blaxel/{client → core/client}/api/configurations/__init__.py +0 -0
- /blaxel/{client → core/client}/api/configurations/get_configuration.py +0 -0
- /blaxel/{client → core/client}/api/default/__init__.py +0 -0
- /blaxel/{client → core/client}/api/default/get_template.py +0 -0
- /blaxel/{client → core/client}/api/default/list_mcp_hub_definitions.py +0 -0
- /blaxel/{client → core/client}/api/default/list_sandbox_hub_definitions.py +0 -0
- /blaxel/{client → core/client}/api/functions/__init__.py +0 -0
- /blaxel/{client → core/client}/api/functions/delete_function.py +0 -0
- /blaxel/{client → core/client}/api/functions/get_function.py +0 -0
- /blaxel/{client → core/client}/api/functions/list_function_revisions.py +0 -0
- /blaxel/{client → core/client}/api/functions/list_functions.py +0 -0
- /blaxel/{client → core/client}/api/integrations/__init__.py +0 -0
- /blaxel/{client → core/client}/api/integrations/delete_integration_connection.py +0 -0
- /blaxel/{client → core/client}/api/integrations/get_integration.py +0 -0
- /blaxel/{client → core/client}/api/integrations/get_integration_connection.py +0 -0
- /blaxel/{client → core/client}/api/integrations/get_integration_connection_model.py +0 -0
- /blaxel/{client → core/client}/api/integrations/get_integration_connection_model_endpoint_configurations.py +0 -0
- /blaxel/{client → core/client}/api/integrations/list_integration_connection_models.py +0 -0
- /blaxel/{client → core/client}/api/integrations/list_integration_connections.py +0 -0
- /blaxel/{client → core/client}/api/invitations/__init__.py +0 -0
- /blaxel/{client → core/client}/api/invitations/list_all_pending_invitations.py +0 -0
- /blaxel/{client → core/client}/api/jobs/__init__.py +0 -0
- /blaxel/{client → core/client}/api/jobs/delete_job.py +0 -0
- /blaxel/{client → core/client}/api/jobs/get_job.py +0 -0
- /blaxel/{client → core/client}/api/jobs/list_job_revisions.py +0 -0
- /blaxel/{client → core/client}/api/jobs/list_jobs.py +0 -0
- /blaxel/{client → core/client}/api/knowledgebases/__init__.py +0 -0
- /blaxel/{client → core/client}/api/knowledgebases/delete_knowledgebase.py +0 -0
- /blaxel/{client → core/client}/api/knowledgebases/get_knowledgebase.py +0 -0
- /blaxel/{client → core/client}/api/knowledgebases/list_knowledgebase_revisions.py +0 -0
- /blaxel/{client → core/client}/api/knowledgebases/list_knowledgebases.py +0 -0
- /blaxel/{client → core/client}/api/locations/__init__.py +0 -0
- /blaxel/{client → core/client}/api/locations/list_locations.py +0 -0
- /blaxel/{client → core/client}/api/models/__init__.py +0 -0
- /blaxel/{client → core/client}/api/models/delete_model.py +0 -0
- /blaxel/{client → core/client}/api/models/get_model.py +0 -0
- /blaxel/{client → core/client}/api/models/list_model_revisions.py +0 -0
- /blaxel/{client → core/client}/api/models/list_models.py +0 -0
- /blaxel/{client → core/client}/api/policies/__init__.py +0 -0
- /blaxel/{client → core/client}/api/policies/delete_policy.py +0 -0
- /blaxel/{client → core/client}/api/policies/get_policy.py +0 -0
- /blaxel/{client → core/client}/api/policies/list_policies.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/__init__.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/create_private_cluster.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/delete_private_cluster.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/get_private_cluster.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/get_private_cluster_health.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/list_private_clusters.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/update_private_cluster.py +0 -0
- /blaxel/{client → core/client}/api/privateclusters/update_private_cluster_health.py +0 -0
- /blaxel/{client → core/client}/api/service_accounts/__init__.py +0 -0
- /blaxel/{client → core/client}/api/service_accounts/delete_api_key_for_service_account.py +0 -0
- /blaxel/{client → core/client}/api/service_accounts/delete_workspace_service_account.py +0 -0
- /blaxel/{client → core/client}/api/service_accounts/get_workspace_service_accounts.py +0 -0
- /blaxel/{client → core/client}/api/service_accounts/list_api_keys_for_service_account.py +0 -0
- /blaxel/{client → core/client}/api/templates/__init__.py +0 -0
- /blaxel/{client → core/client}/api/templates/list_templates.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/__init__.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/accept_workspace_invitation.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/decline_workspace_invitation.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/delete_workspace.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/get_workspace.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/leave_workspace.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/list_workspace_users.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/list_workspaces.py +0 -0
- /blaxel/{client → core/client}/api/workspaces/remove_workspace_user.py +0 -0
- /blaxel/{client → core/client}/client.py +0 -0
- /blaxel/{client → core/client}/errors.py +0 -0
- /blaxel/{client → core/client}/models/__init__.py +0 -0
- /blaxel/{client → core/client}/models/acl.py +0 -0
- /blaxel/{client → core/client}/models/api_key.py +0 -0
- /blaxel/{client → core/client}/models/billable_time_metric.py +0 -0
- /blaxel/{client → core/client}/models/check_workspace_availability_body.py +0 -0
- /blaxel/{client → core/client}/models/configuration.py +0 -0
- /blaxel/{client → core/client}/models/continent.py +0 -0
- /blaxel/{client → core/client}/models/core_event.py +0 -0
- /blaxel/{client → core/client}/models/core_spec_configurations.py +0 -0
- /blaxel/{client → core/client}/models/country.py +0 -0
- /blaxel/{client → core/client}/models/create_api_key_for_service_account_body.py +0 -0
- /blaxel/{client → core/client}/models/create_workspace_service_account_body.py +0 -0
- /blaxel/{client → core/client}/models/create_workspace_service_account_response_200.py +0 -0
- /blaxel/{client → core/client}/models/delete_sandbox_preview_token_response_200.py +0 -0
- /blaxel/{client → core/client}/models/delete_workspace_service_account_response_200.py +0 -0
- /blaxel/{client → core/client}/models/entrypoint.py +0 -0
- /blaxel/{client → core/client}/models/entrypoint_env.py +0 -0
- /blaxel/{client → core/client}/models/flavor.py +0 -0
- /blaxel/{client → core/client}/models/form.py +0 -0
- /blaxel/{client → core/client}/models/form_config.py +0 -0
- /blaxel/{client → core/client}/models/form_oauth.py +0 -0
- /blaxel/{client → core/client}/models/form_secrets.py +0 -0
- /blaxel/{client → core/client}/models/function_kit.py +0 -0
- /blaxel/{client → core/client}/models/function_schema.py +0 -0
- /blaxel/{client → core/client}/models/function_schema_not.py +0 -0
- /blaxel/{client → core/client}/models/function_schema_or_bool.py +0 -0
- /blaxel/{client → core/client}/models/get_workspace_service_accounts_response_200_item.py +0 -0
- /blaxel/{client → core/client}/models/histogram_bucket.py +0 -0
- /blaxel/{client → core/client}/models/histogram_stats.py +0 -0
- /blaxel/{client → core/client}/models/integration_additional_infos.py +0 -0
- /blaxel/{client → core/client}/models/integration_connection.py +0 -0
- /blaxel/{client → core/client}/models/integration_connection_spec.py +0 -0
- /blaxel/{client → core/client}/models/integration_connection_spec_config.py +0 -0
- /blaxel/{client → core/client}/models/integration_connection_spec_secret.py +0 -0
- /blaxel/{client → core/client}/models/integration_endpoint.py +0 -0
- /blaxel/{client → core/client}/models/integration_endpoint_token.py +0 -0
- /blaxel/{client → core/client}/models/integration_headers.py +0 -0
- /blaxel/{client → core/client}/models/integration_model.py +0 -0
- /blaxel/{client → core/client}/models/integration_organization.py +0 -0
- /blaxel/{client → core/client}/models/integration_query_params.py +0 -0
- /blaxel/{client → core/client}/models/integration_repository.py +0 -0
- /blaxel/{client → core/client}/models/invite_workspace_user_body.py +0 -0
- /blaxel/{client → core/client}/models/job_execution_config.py +0 -0
- /blaxel/{client → core/client}/models/job_metrics.py +0 -0
- /blaxel/{client → core/client}/models/job_metrics_executions_chart.py +0 -0
- /blaxel/{client → core/client}/models/job_metrics_executions_total.py +0 -0
- /blaxel/{client → core/client}/models/job_metrics_tasks_chart.py +0 -0
- /blaxel/{client → core/client}/models/job_metrics_tasks_total.py +0 -0
- /blaxel/{client → core/client}/models/jobs_chart.py +0 -0
- /blaxel/{client → core/client}/models/jobs_chart_value.py +0 -0
- /blaxel/{client → core/client}/models/jobs_executions.py +0 -0
- /blaxel/{client → core/client}/models/jobs_network_chart.py +0 -0
- /blaxel/{client → core/client}/models/jobs_success_failed_chart.py +0 -0
- /blaxel/{client → core/client}/models/jobs_tasks.py +0 -0
- /blaxel/{client → core/client}/models/jobs_total.py +0 -0
- /blaxel/{client → core/client}/models/knowledgebase_spec.py +0 -0
- /blaxel/{client → core/client}/models/knowledgebase_spec_options.py +0 -0
- /blaxel/{client → core/client}/models/last_n_requests_metric.py +0 -0
- /blaxel/{client → core/client}/models/latency_metric.py +0 -0
- /blaxel/{client → core/client}/models/logs_response.py +0 -0
- /blaxel/{client → core/client}/models/logs_response_data.py +0 -0
- /blaxel/{client → core/client}/models/mcp_definition.py +0 -0
- /blaxel/{client → core/client}/models/mcp_definition_entrypoint.py +0 -0
- /blaxel/{client → core/client}/models/mcp_definition_form.py +0 -0
- /blaxel/{client → core/client}/models/memory_allocation_by_name.py +0 -0
- /blaxel/{client → core/client}/models/memory_allocation_metric.py +0 -0
- /blaxel/{client → core/client}/models/metadata.py +0 -0
- /blaxel/{client → core/client}/models/metadata_labels.py +0 -0
- /blaxel/{client → core/client}/models/metric.py +0 -0
- /blaxel/{client → core/client}/models/metrics.py +0 -0
- /blaxel/{client → core/client}/models/metrics_models.py +0 -0
- /blaxel/{client → core/client}/models/metrics_request_total_per_code.py +0 -0
- /blaxel/{client → core/client}/models/metrics_rps_per_code.py +0 -0
- /blaxel/{client → core/client}/models/model_private_cluster.py +0 -0
- /blaxel/{client → core/client}/models/o_auth.py +0 -0
- /blaxel/{client → core/client}/models/owner_fields.py +0 -0
- /blaxel/{client → core/client}/models/pending_invitation.py +0 -0
- /blaxel/{client → core/client}/models/pending_invitation_accept.py +0 -0
- /blaxel/{client → core/client}/models/pending_invitation_render.py +0 -0
- /blaxel/{client → core/client}/models/pending_invitation_render_invited_by.py +0 -0
- /blaxel/{client → core/client}/models/pending_invitation_render_workspace.py +0 -0
- /blaxel/{client → core/client}/models/pending_invitation_workspace_details.py +0 -0
- /blaxel/{client → core/client}/models/pod_template_spec.py +0 -0
- /blaxel/{client → core/client}/models/policy.py +0 -0
- /blaxel/{client → core/client}/models/policy_location.py +0 -0
- /blaxel/{client → core/client}/models/policy_max_tokens.py +0 -0
- /blaxel/{client → core/client}/models/port.py +0 -0
- /blaxel/{client → core/client}/models/preview.py +0 -0
- /blaxel/{client → core/client}/models/preview_metadata.py +0 -0
- /blaxel/{client → core/client}/models/preview_spec.py +0 -0
- /blaxel/{client → core/client}/models/preview_spec_request_headers.py +0 -0
- /blaxel/{client → core/client}/models/preview_spec_response_headers.py +0 -0
- /blaxel/{client → core/client}/models/preview_token.py +0 -0
- /blaxel/{client → core/client}/models/preview_token_metadata.py +0 -0
- /blaxel/{client → core/client}/models/preview_token_spec.py +0 -0
- /blaxel/{client → core/client}/models/private_cluster.py +0 -0
- /blaxel/{client → core/client}/models/private_location.py +0 -0
- /blaxel/{client → core/client}/models/repository.py +0 -0
- /blaxel/{client → core/client}/models/request_duration_over_time_metric.py +0 -0
- /blaxel/{client → core/client}/models/request_duration_over_time_metrics.py +0 -0
- /blaxel/{client → core/client}/models/request_total_by_origin_metric.py +0 -0
- /blaxel/{client → core/client}/models/request_total_by_origin_metric_request_total_by_origin.py +0 -0
- /blaxel/{client → core/client}/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +0 -0
- /blaxel/{client → core/client}/models/request_total_metric.py +0 -0
- /blaxel/{client → core/client}/models/request_total_metric_request_total_per_code.py +0 -0
- /blaxel/{client → core/client}/models/request_total_metric_rps_per_code.py +0 -0
- /blaxel/{client → core/client}/models/request_total_response_data.py +0 -0
- /blaxel/{client → core/client}/models/resource.py +0 -0
- /blaxel/{client → core/client}/models/resource_log.py +0 -0
- /blaxel/{client → core/client}/models/resource_log_chart.py +0 -0
- /blaxel/{client → core/client}/models/resource_log_response.py +0 -0
- /blaxel/{client → core/client}/models/resource_metrics_request_total_per_code.py +0 -0
- /blaxel/{client → core/client}/models/resource_metrics_request_total_per_code_previous.py +0 -0
- /blaxel/{client → core/client}/models/resource_metrics_rps_per_code.py +0 -0
- /blaxel/{client → core/client}/models/resource_metrics_rps_per_code_previous.py +0 -0
- /blaxel/{client → core/client}/models/resource_trace.py +0 -0
- /blaxel/{client → core/client}/models/revision_configuration.py +0 -0
- /blaxel/{client → core/client}/models/revision_metadata.py +0 -0
- /blaxel/{client → core/client}/models/runtime_configuration.py +0 -0
- /blaxel/{client → core/client}/models/runtime_startup_probe.py +0 -0
- /blaxel/{client → core/client}/models/serverless_config.py +0 -0
- /blaxel/{client → core/client}/models/serverless_config_configuration.py +0 -0
- /blaxel/{client → core/client}/models/spec_configuration.py +0 -0
- /blaxel/{client → core/client}/models/start_sandbox.py +0 -0
- /blaxel/{client → core/client}/models/stop_sandbox.py +0 -0
- /blaxel/{client → core/client}/models/store_agent_labels.py +0 -0
- /blaxel/{client → core/client}/models/store_configuration_option.py +0 -0
- /blaxel/{client → core/client}/models/template_variable.py +0 -0
- /blaxel/{client → core/client}/models/time_fields.py +0 -0
- /blaxel/{client → core/client}/models/time_to_first_token_over_time_metrics.py +0 -0
- /blaxel/{client → core/client}/models/token_rate_metric.py +0 -0
- /blaxel/{client → core/client}/models/token_rate_metrics.py +0 -0
- /blaxel/{client → core/client}/models/token_total_metric.py +0 -0
- /blaxel/{client → core/client}/models/trace_ids_response.py +0 -0
- /blaxel/{client → core/client}/models/trigger.py +0 -0
- /blaxel/{client → core/client}/models/trigger_configuration.py +0 -0
- /blaxel/{client → core/client}/models/update_workspace_service_account_body.py +0 -0
- /blaxel/{client → core/client}/models/update_workspace_service_account_response_200.py +0 -0
- /blaxel/{client → core/client}/models/update_workspace_user_role_body.py +0 -0
- /blaxel/{client → core/client}/models/websocket_channel.py +0 -0
- /blaxel/{client → core/client}/models/websocket_message.py +0 -0
- /blaxel/{client → core/client}/models/workspace.py +0 -0
- /blaxel/{client → core/client}/models/workspace_labels.py +0 -0
- /blaxel/{client → core/client}/models/workspace_runtime.py +0 -0
- /blaxel/{client → core/client}/models/workspace_user.py +0 -0
- /blaxel/{client → core/client}/py.typed +0 -0
- /blaxel/{client → core/client}/types.py +0 -0
- /blaxel/{common → core/common}/env.py +0 -0
- /blaxel/{common → core/common}/settings.py +0 -0
- /blaxel/{sandbox/client/api/filesystem/__init__.py → core/py.typed} +0 -0
- /blaxel/{sandbox → core/sandbox}/client/__init__.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/__init__.py +0 -0
- /blaxel/{sandbox/client/api/network → core/sandbox/client/api/filesystem}/__init__.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/filesystem/delete_filesystem_path.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/filesystem/get_filesystem_path.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/filesystem/get_watch_filesystem_path.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/filesystem/get_ws_watch_filesystem_path.py +0 -0
- /blaxel/{sandbox/client/api/process → core/sandbox/client/api/network}/__init__.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/network/delete_network_process_pid_monitor.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/network/get_network_process_pid_ports.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/delete_process_identifier.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/delete_process_identifier_kill.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/get_process.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/get_process_identifier.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/get_process_identifier_logs.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/get_process_identifier_logs_stream.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/api/process/get_ws_process_identifier_logs_stream.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/client.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/errors.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/__init__.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/delete_network_process_pid_monitor_response_200.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/error_response.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/file.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/file_request.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/file_with_content.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/get_network_process_pid_ports_response_200.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/port_monitor_request.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/post_network_process_pid_monitor_response_200.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/process_logs.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/process_request.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/process_request_env.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/process_response.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/process_response_status.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/subdirectory.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/models/success_response.py +0 -0
- /blaxel/{sandbox → core/sandbox}/client/py.typed +0 -0
- /blaxel/{sandbox → core/sandbox}/client/types.py +0 -0
- /blaxel/{tools → core/tools}/common.py +0 -0
- /blaxel/{tools → core/tools}/types.py +0 -0
- /blaxel/{models/custom/langchain → langgraph/custom}/gemini.py +0 -0
- /blaxel/{models/custom/llamaindex → llamaindex/custom}/cohere.py +0 -0
- /blaxel/{instrumentation → telemetry}/exporters.py +0 -0
- /blaxel/{instrumentation → telemetry/log}/log.py +0 -0
- {blaxel-0.1.22rc70.dist-info → blaxel-0.2.0rc2.dist-info}/WHEEL +0 -0
- {blaxel-0.1.22rc70.dist-info → blaxel-0.2.0rc2.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,4 @@
|
|
1
1
|
import asyncio
|
2
|
-
import json
|
3
2
|
import os
|
4
3
|
import traceback
|
5
4
|
from contextlib import AsyncExitStack
|
@@ -12,7 +11,6 @@ from mcp.types import Tool as MCPTool
|
|
12
11
|
|
13
12
|
from ..common.internal import get_forced_url, get_global_unique_hash
|
14
13
|
from ..common.settings import settings
|
15
|
-
from ..instrumentation.span import SpanManager
|
16
14
|
from ..mcp.client import websocket_client
|
17
15
|
from .types import Tool
|
18
16
|
|
@@ -22,8 +20,11 @@ DEFAULT_TIMEOUT = 1
|
|
22
20
|
if os.getenv("BL_SERVER_PORT"):
|
23
21
|
DEFAULT_TIMEOUT = 5
|
24
22
|
|
23
|
+
|
25
24
|
class PersistentWebSocket:
|
26
|
-
def __init__(
|
25
|
+
def __init__(
|
26
|
+
self, url: str, name: str, timeout: int = DEFAULT_TIMEOUT, timeout_enabled: bool = True
|
27
|
+
):
|
27
28
|
self.url = url
|
28
29
|
self.name = name
|
29
30
|
self.timeout = timeout
|
@@ -58,32 +59,30 @@ class PersistentWebSocket:
|
|
58
59
|
except Exception as e:
|
59
60
|
logger.error(f"Error calling tool {tool_name}: {e}\n{traceback.format_exc()}")
|
60
61
|
return CallToolResult(
|
61
|
-
content=[
|
62
|
+
content=[
|
63
|
+
{
|
64
|
+
"type": "text",
|
65
|
+
"text": f"Error calling tool {tool_name}: {e}\n{traceback.format_exc()}",
|
66
|
+
}
|
67
|
+
],
|
62
68
|
isError=True,
|
63
69
|
)
|
64
70
|
|
65
71
|
async def list_tools(self):
|
66
72
|
logger.debug(f"Listing tools for {self.name}")
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
logger.debug(f"Tools listed: {list_tools_result}")
|
81
|
-
if self.timeout_enabled:
|
82
|
-
self._reset_timer()
|
83
|
-
else:
|
84
|
-
await self._close()
|
85
|
-
span.set_attribute("tool.list.result", list_tools_result.model_dump_json())
|
86
|
-
return list_tools_result
|
73
|
+
await self._initialize()
|
74
|
+
logger.debug(f"Initialized websocket for {self.name}")
|
75
|
+
if self.timeout_enabled:
|
76
|
+
self._remove_timer()
|
77
|
+
logger.debug("Listing tools")
|
78
|
+
list_tools_result = await self.session.list_tools()
|
79
|
+
self.tools_cache = list_tools_result.tools
|
80
|
+
logger.debug(f"Tools listed: {list_tools_result}")
|
81
|
+
if self.timeout_enabled:
|
82
|
+
self._reset_timer()
|
83
|
+
else:
|
84
|
+
await self._close()
|
85
|
+
return list_tools_result
|
87
86
|
|
88
87
|
def get_tools(self):
|
89
88
|
return self.tools_cache
|
@@ -91,8 +90,13 @@ class PersistentWebSocket:
|
|
91
90
|
async def _initialize(self):
|
92
91
|
if not self.session:
|
93
92
|
logger.debug(f"Initializing websocket client for {self.url}")
|
94
|
-
read, write = await self.client_exit_stack.enter_async_context(
|
95
|
-
|
93
|
+
read, write = await self.client_exit_stack.enter_async_context(
|
94
|
+
websocket_client(self.url, settings.headers)
|
95
|
+
)
|
96
|
+
self.session = cast(
|
97
|
+
ClientSession,
|
98
|
+
await self.session_exit_stack.enter_async_context(ClientSession(read, write)),
|
99
|
+
)
|
96
100
|
await self.session.initialize()
|
97
101
|
|
98
102
|
def _reset_timer(self):
|
@@ -108,7 +112,6 @@ class PersistentWebSocket:
|
|
108
112
|
await self._close()
|
109
113
|
self.session = None
|
110
114
|
|
111
|
-
|
112
115
|
async def _close(self):
|
113
116
|
logger.debug(f"Closing websocket client {self.url}")
|
114
117
|
if self.session:
|
@@ -123,6 +126,7 @@ class PersistentWebSocket:
|
|
123
126
|
logger.debug(f"Error closing client exit stack: {e}")
|
124
127
|
logger.debug("WebSocket connection closed due to inactivity.")
|
125
128
|
|
129
|
+
|
126
130
|
def convert_mcp_tool_to_blaxel_tool(
|
127
131
|
websocket_client: PersistentWebSocket,
|
128
132
|
name: str,
|
@@ -145,18 +149,10 @@ def convert_mcp_tool_to_blaxel_tool(
|
|
145
149
|
*args: Any,
|
146
150
|
**arguments: dict[str, Any],
|
147
151
|
) -> CallToolResult:
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
"tool.server_name": name,
|
153
|
-
"span.type": "tool.call",
|
154
|
-
}
|
155
|
-
with SpanManager("blaxel-tracer").create_active_span("blaxel-tool-call", span_attributes):
|
156
|
-
logger.debug(f"Calling tool {tool.name} with arguments {arguments}")
|
157
|
-
call_tool_result = await websocket_client.call_tool(tool.name, arguments)
|
158
|
-
logger.debug(f"Tool {tool.name} returned {call_tool_result}")
|
159
|
-
return call_tool_result
|
152
|
+
logger.debug(f"Calling tool {tool.name} with arguments {arguments}")
|
153
|
+
call_tool_result = await websocket_client.call_tool(tool.name, arguments)
|
154
|
+
logger.debug(f"Tool {tool.name} returned {call_tool_result}")
|
155
|
+
return call_tool_result
|
160
156
|
|
161
157
|
async def call_tool(
|
162
158
|
*args: Any,
|
@@ -180,10 +176,18 @@ def convert_mcp_tool_to_blaxel_tool(
|
|
180
176
|
response_format="content_and_artifact",
|
181
177
|
)
|
182
178
|
|
179
|
+
|
183
180
|
toolPersistances: dict[str, PersistentWebSocket] = {}
|
184
181
|
|
182
|
+
|
185
183
|
class BlTools:
|
186
|
-
def __init__(
|
184
|
+
def __init__(
|
185
|
+
self,
|
186
|
+
functions: list[str],
|
187
|
+
metas: dict[str, Any] = {},
|
188
|
+
timeout: int = DEFAULT_TIMEOUT,
|
189
|
+
timeout_enabled: bool = True,
|
190
|
+
):
|
187
191
|
self.functions = functions
|
188
192
|
self.metas = metas
|
189
193
|
self.timeout = timeout
|
@@ -224,52 +228,13 @@ class BlTools:
|
|
224
228
|
toolPersistances.get(name).with_metas(self.metas)
|
225
229
|
websocket = toolPersistances.get(name)
|
226
230
|
tools = websocket.get_tools()
|
227
|
-
converted_tools = [
|
231
|
+
converted_tools = [
|
232
|
+
convert_mcp_tool_to_blaxel_tool(websocket, name, self._url(name), tool)
|
233
|
+
for tool in tools
|
234
|
+
]
|
228
235
|
all_tools.extend(converted_tools)
|
229
236
|
return all_tools
|
230
237
|
|
231
|
-
async def to_langchain(self):
|
232
|
-
from .langchain import get_langchain_tools
|
233
|
-
|
234
|
-
await self.initialize()
|
235
|
-
return get_langchain_tools(self.get_tools())
|
236
|
-
|
237
|
-
async def to_llamaindex(self):
|
238
|
-
from .llamaindex import get_llamaindex_tools
|
239
|
-
|
240
|
-
await self.initialize()
|
241
|
-
return get_llamaindex_tools(self.get_tools())
|
242
|
-
|
243
|
-
async def to_crewai(self):
|
244
|
-
from .crewai import get_crewai_tools
|
245
|
-
|
246
|
-
await self.initialize()
|
247
|
-
return get_crewai_tools(self.get_tools())
|
248
|
-
|
249
|
-
async def to_openai(self):
|
250
|
-
from .openai import get_openai_tools
|
251
|
-
|
252
|
-
await self.initialize()
|
253
|
-
return get_openai_tools(self.get_tools())
|
254
|
-
|
255
|
-
async def to_pydantic(self):
|
256
|
-
from .pydantic import get_pydantic_tools
|
257
|
-
|
258
|
-
await self.initialize()
|
259
|
-
return get_pydantic_tools(self.get_tools())
|
260
|
-
|
261
|
-
async def to_google_adk(self):
|
262
|
-
from .googleadk import get_google_adk_tools
|
263
|
-
|
264
|
-
await self.initialize()
|
265
|
-
return get_google_adk_tools(self.get_tools())
|
266
|
-
|
267
|
-
async def to_livekit(self):
|
268
|
-
from .livekit import get_livekit_tools
|
269
|
-
|
270
|
-
await self.initialize()
|
271
|
-
return get_livekit_tools(self.get_tools())
|
272
|
-
|
273
238
|
async def connect(self, name: str):
|
274
239
|
# Create and store the connection
|
275
240
|
try:
|
@@ -283,12 +248,12 @@ class BlTools:
|
|
283
248
|
try:
|
284
249
|
await self.connect_with_url(name, url)
|
285
250
|
except Exception as e:
|
286
|
-
logger.error(
|
251
|
+
logger.error(
|
252
|
+
f"Error connecting to {name} with fallback URL: {e}\n{traceback.format_exc()}"
|
253
|
+
)
|
287
254
|
raise e
|
288
255
|
|
289
|
-
async def connect_with_url(
|
290
|
-
self, name: str, url: str
|
291
|
-
) -> None:
|
256
|
+
async def connect_with_url(self, name: str, url: str) -> None:
|
292
257
|
"""Initialize a session and load tools from it.
|
293
258
|
|
294
259
|
Args:
|
@@ -299,17 +264,24 @@ class BlTools:
|
|
299
264
|
|
300
265
|
if not toolPersistances.get(name):
|
301
266
|
logger.debug(f"Creating new persistent websocket for {name}")
|
302
|
-
toolPersistances[name] = PersistentWebSocket(
|
267
|
+
toolPersistances[name] = PersistentWebSocket(
|
268
|
+
url, name, timeout=self.timeout, timeout_enabled=self.timeout_enabled
|
269
|
+
)
|
303
270
|
await toolPersistances[name].list_tools()
|
304
271
|
logger.debug(f"Loaded {len(toolPersistances[name].get_tools())} tools from {url}")
|
305
272
|
return toolPersistances[name].with_metas(self.metas)
|
306
273
|
|
307
274
|
async def initialize(self) -> "BlTools":
|
308
275
|
for i in range(0, len(self.functions), 10):
|
309
|
-
batch = self.functions[i:i+10]
|
276
|
+
batch = self.functions[i : i + 10]
|
310
277
|
await asyncio.gather(*(self.connect(name) for name in batch))
|
311
278
|
return self
|
312
279
|
|
313
280
|
|
314
|
-
def bl_tools(
|
281
|
+
def bl_tools(
|
282
|
+
functions: list[str],
|
283
|
+
metas: dict[str, Any] = {},
|
284
|
+
timeout: int = DEFAULT_TIMEOUT,
|
285
|
+
timeout_enabled: bool = True,
|
286
|
+
) -> BlTools:
|
315
287
|
return BlTools(functions, metas=metas, timeout=timeout, timeout_enabled=timeout_enabled)
|
@@ -2,11 +2,13 @@ from logging import getLogger
|
|
2
2
|
|
3
3
|
from crewai import LLM
|
4
4
|
|
5
|
-
from
|
5
|
+
from blaxel.core import bl_model as bl_model_core
|
6
|
+
from blaxel.core import settings
|
6
7
|
|
7
8
|
logger = getLogger(__name__)
|
8
9
|
|
9
|
-
async def
|
10
|
+
async def bl_model(name: str, **kwargs):
|
11
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
10
12
|
if type == 'mistral':
|
11
13
|
return LLM(
|
12
14
|
model=f"mistral/{model}",
|
blaxel/crewai/py.typed
ADDED
File without changes
|
blaxel/crewai/tools.py
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
from crewai.tools import BaseTool
|
2
|
+
|
3
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
4
|
+
from blaxel.core.tools.common import create_model_from_json_schema
|
5
|
+
from blaxel.core.tools.types import Tool
|
6
|
+
|
7
|
+
|
8
|
+
class CrewAITool(BaseTool):
|
9
|
+
_tool: Tool
|
10
|
+
|
11
|
+
def __init__(self, tool: Tool):
|
12
|
+
super().__init__(
|
13
|
+
name=tool.name,
|
14
|
+
description=tool.description,
|
15
|
+
args_schema=create_model_from_json_schema(tool.input_schema),
|
16
|
+
)
|
17
|
+
self._tool = tool
|
18
|
+
|
19
|
+
def _run(self, *args, **kwargs):
|
20
|
+
return self._tool.sync_coroutine(**kwargs)
|
21
|
+
|
22
|
+
async def bl_tools(tools_names: list[str], **kwargs) -> list[BaseTool]:
|
23
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
24
|
+
await tools.initialize()
|
25
|
+
return [CrewAITool(tool) for tool in tools.get_tools()]
|
26
|
+
return [CrewAITool(tool) for tool in tools.get_tools()]
|
@@ -2,7 +2,8 @@ from logging import getLogger
|
|
2
2
|
|
3
3
|
from google.adk.models.lite_llm import LiteLlm
|
4
4
|
|
5
|
-
from
|
5
|
+
from blaxel.core import bl_model as bl_model_core
|
6
|
+
from blaxel.core import settings
|
6
7
|
|
7
8
|
logger = getLogger(__name__)
|
8
9
|
|
@@ -64,4 +65,9 @@ async def get_google_adk_model(url: str, type: str, model: str, **kwargs):
|
|
64
65
|
api_key=settings.auth.token,
|
65
66
|
api_base=f"{url}/v1",
|
66
67
|
**kwargs
|
67
|
-
)
|
68
|
+
)
|
69
|
+
|
70
|
+
async def bl_model(name: str, **kwargs):
|
71
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
72
|
+
return await get_google_adk_model(url, type, model, **kwargs)
|
73
|
+
return await get_google_adk_model(url, type, model, **kwargs)
|
File without changes
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import inspect
|
2
|
+
from typing import Any, Optional, override
|
3
|
+
|
4
|
+
from google.adk.tools import BaseTool, ToolContext
|
5
|
+
from google.genai import types
|
6
|
+
|
7
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
8
|
+
from blaxel.core.tools.types import Tool
|
9
|
+
|
10
|
+
|
11
|
+
class GoogleADKTool(BaseTool):
|
12
|
+
_tool: Tool
|
13
|
+
|
14
|
+
def __init__(self, tool: Tool):
|
15
|
+
super().__init__(
|
16
|
+
name=tool.name,
|
17
|
+
description=tool.description,
|
18
|
+
)
|
19
|
+
self._tool = tool
|
20
|
+
|
21
|
+
def _clean_schema(self, schema: dict) -> dict:
|
22
|
+
if not isinstance(schema, dict):
|
23
|
+
return schema
|
24
|
+
|
25
|
+
# Create a copy of the schema
|
26
|
+
cleaned_schema = schema.copy()
|
27
|
+
|
28
|
+
# Remove $schema and additionalProperties at current level
|
29
|
+
if "$schema" in cleaned_schema:
|
30
|
+
del cleaned_schema["$schema"]
|
31
|
+
if "additionalProperties" in cleaned_schema:
|
32
|
+
del cleaned_schema["additionalProperties"]
|
33
|
+
|
34
|
+
# Recursively clean properties if they exist
|
35
|
+
if "properties" in cleaned_schema:
|
36
|
+
cleaned_schema["properties"] = {
|
37
|
+
k: self._clean_schema(v) for k, v in cleaned_schema["properties"].items()
|
38
|
+
}
|
39
|
+
|
40
|
+
return cleaned_schema
|
41
|
+
|
42
|
+
@override
|
43
|
+
def _get_declaration(self) -> Optional[types.FunctionDeclaration]:
|
44
|
+
# Clean the schema recursively
|
45
|
+
schema = self._clean_schema(self._tool.input_schema)
|
46
|
+
|
47
|
+
function_decl = types.FunctionDeclaration.model_validate(
|
48
|
+
types.FunctionDeclaration(
|
49
|
+
name=self._tool.name,
|
50
|
+
description=self._tool.description,
|
51
|
+
parameters=schema,
|
52
|
+
)
|
53
|
+
)
|
54
|
+
|
55
|
+
return function_decl
|
56
|
+
|
57
|
+
@override
|
58
|
+
async def run_async(
|
59
|
+
self, *, args: dict[str, Any], tool_context: ToolContext
|
60
|
+
) -> Any:
|
61
|
+
args_to_call = args.copy()
|
62
|
+
signature = inspect.signature(self._tool.coroutine)
|
63
|
+
if 'tool_context' in signature.parameters:
|
64
|
+
args_to_call['tool_context'] = tool_context
|
65
|
+
return await self._tool.coroutine(**args_to_call) or {}
|
66
|
+
|
67
|
+
|
68
|
+
async def bl_tools(tools_names: list[str], **kwargs: Any) -> list[BaseTool]:
|
69
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
70
|
+
await tools.initialize()
|
71
|
+
return [GoogleADKTool(tool) for tool in tools.get_tools()]
|
72
|
+
return [GoogleADKTool(tool) for tool in tools.get_tools()]
|
@@ -7,12 +7,16 @@ from langchain_deepseek import ChatDeepSeek
|
|
7
7
|
from langchain_openai import ChatOpenAI
|
8
8
|
from langchain_xai import ChatXAI
|
9
9
|
|
10
|
-
from
|
11
|
-
from .
|
10
|
+
from blaxel.core import bl_model as bl_model_core
|
11
|
+
from blaxel.core import settings
|
12
|
+
|
13
|
+
from .custom.gemini import ChatGoogleGenerativeAI
|
12
14
|
|
13
15
|
logger = getLogger(__name__)
|
14
16
|
|
15
|
-
|
17
|
+
|
18
|
+
async def bl_model(name: str, **kwargs):
|
19
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
16
20
|
if type == 'mistral':
|
17
21
|
return ChatOpenAI(
|
18
22
|
api_key=settings.auth.token,
|
@@ -72,4 +76,4 @@ async def get_langchain_model(url: str,type: str, model: str, **kwargs):
|
|
72
76
|
model=model,
|
73
77
|
base_url=f"{url}/v1",
|
74
78
|
**kwargs
|
75
|
-
)
|
79
|
+
)
|
File without changes
|
@@ -3,7 +3,8 @@ from typing import Any
|
|
3
3
|
from langchain_core.tools import StructuredTool
|
4
4
|
from mcp.types import CallToolResult, EmbeddedResource, ImageContent, TextContent
|
5
5
|
|
6
|
-
from .
|
6
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
7
|
+
from blaxel.core.tools.types import Tool, ToolException
|
7
8
|
|
8
9
|
NonTextContent = ImageContent | EmbeddedResource
|
9
10
|
|
@@ -37,5 +38,8 @@ def get_langchain_tool(tool: Tool) -> StructuredTool:
|
|
37
38
|
sync_coroutine=tool.sync_coroutine,
|
38
39
|
)
|
39
40
|
|
40
|
-
|
41
|
-
|
41
|
+
|
42
|
+
async def bl_tools(tools_names: list[str], **kwargs) -> list[StructuredTool]:
|
43
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
44
|
+
await tools.initialize()
|
45
|
+
return [get_langchain_tool(tool) for tool in tools.get_tools()]
|
@@ -2,7 +2,8 @@ from logging import getLogger
|
|
2
2
|
|
3
3
|
from livekit.plugins import groq, openai
|
4
4
|
|
5
|
-
from
|
5
|
+
from blaxel.core import bl_model as bl_model_core
|
6
|
+
from blaxel.core import settings
|
6
7
|
|
7
8
|
logger = getLogger(__name__)
|
8
9
|
|
@@ -23,3 +24,8 @@ async def get_livekit_model(url: str, type: str, model: str, **kwargs):
|
|
23
24
|
base_url=f"{url}/v1",
|
24
25
|
**kwargs
|
25
26
|
)
|
27
|
+
|
28
|
+
async def bl_model(name: str, **kwargs):
|
29
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
30
|
+
return await get_livekit_model(url, type, model, **kwargs)
|
31
|
+
return await get_livekit_model(url, type, model, **kwargs)
|
blaxel/livekit/py.typed
ADDED
File without changes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from livekit.agents import function_tool, llm
|
2
2
|
|
3
|
-
from .
|
3
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
4
|
+
from blaxel.core.tools.types import Tool
|
4
5
|
|
5
6
|
|
6
7
|
def livekit_coroutine(tool: Tool):
|
@@ -21,3 +22,9 @@ def get_livekit_tools(tools: list[Tool]) -> list[llm.FunctionTool]:
|
|
21
22
|
},
|
22
23
|
))
|
23
24
|
return livekit_tools
|
25
|
+
|
26
|
+
async def bl_tools(tools_names: list[str], **kwargs) -> list[llm.FunctionTool]:
|
27
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
28
|
+
await tools.initialize()
|
29
|
+
return get_livekit_tools(tools.get_tools())
|
30
|
+
return get_livekit_tools(tools.get_tools())
|
@@ -14,12 +14,15 @@ from llama_index.llms.groq import Groq
|
|
14
14
|
from llama_index.llms.mistralai import MistralAI
|
15
15
|
from llama_index.llms.openai import OpenAI
|
16
16
|
|
17
|
-
from
|
18
|
-
from .
|
17
|
+
from blaxel.core import bl_model as bl_model_core
|
18
|
+
from blaxel.core import settings
|
19
|
+
|
20
|
+
from .custom.cohere import Cohere
|
19
21
|
|
20
22
|
logger = getLogger(__name__)
|
21
23
|
|
22
|
-
async def
|
24
|
+
async def bl_model(name, **kwargs):
|
25
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
23
26
|
if type == 'anthropic':
|
24
27
|
return Anthropic(
|
25
28
|
model=model,
|
File without changes
|
@@ -3,8 +3,9 @@
|
|
3
3
|
from llama_index.core.tools import FunctionTool
|
4
4
|
from llama_index.core.tools.types import ToolMetadata
|
5
5
|
|
6
|
-
from .
|
7
|
-
from .
|
6
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
7
|
+
from blaxel.core.tools.common import create_model_from_json_schema
|
8
|
+
from blaxel.core.tools.types import Tool
|
8
9
|
|
9
10
|
|
10
11
|
def get_llamaindex_tool(tool: Tool) -> FunctionTool:
|
@@ -21,5 +22,7 @@ def get_llamaindex_tool(tool: Tool) -> FunctionTool:
|
|
21
22
|
),
|
22
23
|
)
|
23
24
|
|
24
|
-
def
|
25
|
-
|
25
|
+
async def bl_tools(tools_names: list[str], **kwargs) -> list[FunctionTool]:
|
26
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
27
|
+
await tools.initialize()
|
28
|
+
return [get_llamaindex_tool(tool) for tool in tools.get_tools()]
|
@@ -1,9 +1,11 @@
|
|
1
1
|
from agents import AsyncOpenAI, OpenAIChatCompletionsModel
|
2
2
|
|
3
|
-
from
|
3
|
+
from blaxel.core import bl_model as bl_model_core
|
4
|
+
from blaxel.core import settings
|
4
5
|
|
5
6
|
|
6
|
-
async def
|
7
|
+
async def bl_model(name, **kwargs):
|
8
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
7
9
|
if type != "openai":
|
8
10
|
raise ValueError(f"Invalid model type: {type}")
|
9
11
|
external_client = AsyncOpenAI(
|
blaxel/openai/py.typed
ADDED
File without changes
|
@@ -3,7 +3,8 @@ from typing import Any
|
|
3
3
|
|
4
4
|
from agents import FunctionTool, RunContextWrapper
|
5
5
|
|
6
|
-
from .
|
6
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
7
|
+
from blaxel.core.tools.types import Tool
|
7
8
|
|
8
9
|
|
9
10
|
def get_openai_tool(tool: Tool) -> FunctionTool:
|
@@ -21,5 +22,8 @@ def get_openai_tool(tool: Tool) -> FunctionTool:
|
|
21
22
|
on_invoke_tool=openai_coroutine,
|
22
23
|
)
|
23
24
|
|
24
|
-
def
|
25
|
-
|
25
|
+
async def bl_tools(tools_names: list[str], **kwargs) -> list[FunctionTool]:
|
26
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
27
|
+
await tools.initialize()
|
28
|
+
return [get_openai_tool(tool) for tool in tools.get_tools()]
|
29
|
+
return [get_openai_tool(tool) for tool in tools.get_tools()]
|
@@ -14,13 +14,15 @@ from pydantic_ai.providers.cohere import CohereProvider
|
|
14
14
|
from pydantic_ai.providers.mistral import MistralProvider
|
15
15
|
from pydantic_ai.providers.openai import OpenAIProvider
|
16
16
|
|
17
|
-
from blaxel.
|
17
|
+
from blaxel.core import bl_model as bl_model_core
|
18
|
+
from blaxel.core import settings
|
19
|
+
from blaxel.core.client import client
|
18
20
|
|
19
|
-
from
|
20
|
-
from .custom.pydantic.gemini import GoogleGLAProvider
|
21
|
+
from .custom.gemini import GoogleGLAProvider
|
21
22
|
|
22
23
|
logger = logging.getLogger(__name__)
|
23
|
-
async def
|
24
|
+
async def bl_model(name: str, **kwargs) -> Model:
|
25
|
+
url, type, model = await bl_model_core(name).get_parameters()
|
24
26
|
if type == 'mistral':
|
25
27
|
return MistralModel(
|
26
28
|
model_name=model,
|
blaxel/pydantic/py.typed
ADDED
File without changes
|
@@ -2,7 +2,8 @@ from pydantic_ai import RunContext
|
|
2
2
|
from pydantic_ai.tools import Tool as PydanticTool
|
3
3
|
from pydantic_ai.tools import ToolDefinition
|
4
4
|
|
5
|
-
from .
|
5
|
+
from blaxel.core.tools import Tool
|
6
|
+
from blaxel.core.tools import bl_tools as bl_tools_core
|
6
7
|
|
7
8
|
|
8
9
|
def get_pydantic_tool(tool: Tool) -> PydanticTool:
|
@@ -44,5 +45,7 @@ def get_pydantic_tool(tool: Tool) -> PydanticTool:
|
|
44
45
|
)
|
45
46
|
|
46
47
|
|
47
|
-
def
|
48
|
-
|
48
|
+
async def bl_tools(tools_names: list[str], **kwargs) -> list[PydanticTool]:
|
49
|
+
tools = bl_tools_core(tools_names, **kwargs)
|
50
|
+
await tools.initialize()
|
51
|
+
return [get_pydantic_tool(tool) for tool in tools.get_tools()]
|