beamlit 0.0.24rc20__tar.gz → 0.0.25__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/PKG-INFO +1 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/pyproject.toml +1 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/agents/chat.py +37 -11
- beamlit-0.0.25/src/beamlit/agents/decorator.py +185 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/create_agent.py +9 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/delete_agent.py +22 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/delete_agent_history.py +2 -6
- beamlit-0.0.24rc20/src/beamlit/api/agents/update_agent.py → beamlit-0.0.25/src/beamlit/api/agents/get_agent.py +25 -31
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/get_agent_environment_logs.py +11 -11
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/get_agent_history.py +2 -6
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/get_agent_metrics.py +22 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/list_agent_history.py +11 -11
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/list_agents.py +36 -4
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/put_agent_history.py +2 -6
- beamlit-0.0.24rc20/src/beamlit/api/agents/get_agent.py → beamlit-0.0.25/src/beamlit/api/agents/update_agent.py +27 -5
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/create_function.py +9 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/delete_function.py +22 -1
- beamlit-0.0.24rc20/src/beamlit/api/functions/update_function.py → beamlit-0.0.25/src/beamlit/api/functions/get_function.py +25 -31
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/get_function_environment_logs.py +11 -11
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/get_function_metrics.py +22 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/list_functions.py +36 -4
- beamlit-0.0.24rc20/src/beamlit/api/functions/get_function.py → beamlit-0.0.25/src/beamlit/api/functions/update_function.py +27 -5
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/history/get_agents_history.py +12 -12
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/history/list_agents_history.py +12 -12
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/get_integration_connection.py +16 -12
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/get_integration_connection_model.py +8 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/get_integration_model.py +8 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/locations/list_locations.py +12 -12
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/create_model.py +13 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/delete_model.py +22 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/get_model.py +22 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/get_model_environment_logs.py +11 -11
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/get_model_metrics.py +38 -13
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/list_models.py +36 -4
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/update_model.py +13 -14
- beamlit-0.0.25/src/beamlit/api/privateclusters/create_private_cluster.py +132 -0
- beamlit-0.0.25/src/beamlit/api/privateclusters/delete_private_cluster.py +156 -0
- beamlit-0.0.25/src/beamlit/api/privateclusters/get_private_cluster.py +159 -0
- beamlit-0.0.25/src/beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
- beamlit-0.0.25/src/beamlit/api/privateclusters/list_private_clusters.py +140 -0
- beamlit-0.0.24rc20/src/beamlit/api/agents/list_agent_deployments.py → beamlit-0.0.25/src/beamlit/api/privateclusters/update_private_cluster.py +38 -37
- beamlit-0.0.25/src/beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
- beamlit-0.0.25/src/beamlit/api/workspaces/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/authentication/device_mode.py +3 -9
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/common/generate.py +47 -34
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/common/settings.py +29 -27
- beamlit-0.0.25/src/beamlit/deploy/deploy.py +262 -0
- beamlit-0.0.25/src/beamlit/deploy/format.py +70 -0
- beamlit-0.0.25/src/beamlit/deploy/parser.py +175 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/decorator.py +8 -11
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/__init__.py +64 -78
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/acl.py +4 -22
- beamlit-0.0.25/src/beamlit/models/agent.py +92 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/agent_history.py +7 -5
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment_history_event.py → beamlit-0.0.25/src/beamlit/models/agent_history_event.py +5 -5
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/agent_metadata.py +5 -3
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/agent_spec.py +54 -45
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/api_key.py +14 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/configuration.py +11 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/core_spec.py +45 -32
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py → beamlit-0.0.25/src/beamlit/models/core_spec_configurations.py +22 -22
- beamlit-0.0.25/src/beamlit/models/environment.py +92 -0
- beamlit-0.0.25/src/beamlit/models/environment_metadata.py +146 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/environment_spec.py +8 -6
- beamlit-0.0.25/src/beamlit/models/function.py +92 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/function_metadata.py +5 -3
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/function_spec.py +53 -40
- beamlit-0.0.25/src/beamlit/models/integration_connection.py +92 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/integration_connection_spec.py +6 -4
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/metadata.py +5 -3
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/metadata_labels.py +4 -2
- beamlit-0.0.25/src/beamlit/models/model.py +92 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/model_metadata.py +5 -3
- beamlit-0.0.24rc20/src/beamlit/models/function_provider_ref.py → beamlit-0.0.25/src/beamlit/models/model_private_cluster.py +23 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/model_provider.py +27 -43
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/model_spec.py +45 -32
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/owner_fields.py +4 -2
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pending_invitation.py +14 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pod_template_spec.py +4 -2
- beamlit-0.0.25/src/beamlit/models/policy.py +92 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/policy_spec.py +24 -28
- beamlit-0.0.25/src/beamlit/models/private_cluster.py +183 -0
- beamlit-0.0.25/src/beamlit/models/private_location.py +61 -0
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment_metrics.py → beamlit-0.0.25/src/beamlit/models/resource_deployment_metrics.py +27 -25
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics.py → beamlit-0.0.25/src/beamlit/models/resource_environment_metrics.py +37 -37
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics_inference_per_region.py → beamlit-0.0.25/src/beamlit/models/resource_environment_metrics_inference_per_region.py +5 -5
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment_metrics_inference_per_second_per_region.py → beamlit-0.0.25/src/beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +5 -5
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics_query_per_region_per_code.py → beamlit-0.0.25/src/beamlit/models/resource_environment_metrics_query_per_region_per_code.py +5 -5
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/resource_log.py +4 -2
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/runtime.py +20 -2
- beamlit-0.0.24rc20/src/beamlit/models/deployment_serverless_config.py → beamlit-0.0.25/src/beamlit/models/serverless_config.py +17 -17
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/spec_configuration.py +7 -5
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_agent.py +14 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_function.py +14 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/time_fields.py +4 -2
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/websocket_channel.py +4 -2
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/workspace.py +23 -14
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/run.py +0 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/serve/app.py +1 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/serve/middlewares/accesslog.py +3 -1
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/integrationtest/main.py +6 -2
- beamlit-0.0.24rc20/src/beamlit/agents/decorator.py +0 -153
- beamlit-0.0.24rc20/src/beamlit/api/agents/delete_agent_deployment.py +0 -163
- beamlit-0.0.24rc20/src/beamlit/api/agents/delete_agent_deployment_history.py +0 -172
- beamlit-0.0.24rc20/src/beamlit/api/agents/get_agent_deployment.py +0 -163
- beamlit-0.0.24rc20/src/beamlit/api/agents/get_agent_deployment_history.py +0 -172
- beamlit-0.0.24rc20/src/beamlit/api/agents/get_agent_deployment_logs.py +0 -164
- beamlit-0.0.24rc20/src/beamlit/api/agents/get_agent_deployment_metrics.py +0 -159
- beamlit-0.0.24rc20/src/beamlit/api/agents/list_agent_deployment_history.py +0 -164
- beamlit-0.0.24rc20/src/beamlit/api/agents/put_agent_deployment.py +0 -185
- beamlit-0.0.24rc20/src/beamlit/api/agents/put_agent_deployment_history.py +0 -198
- beamlit-0.0.24rc20/src/beamlit/api/functions/delete_function_deployment.py +0 -163
- beamlit-0.0.24rc20/src/beamlit/api/functions/get_function_deployment.py +0 -163
- beamlit-0.0.24rc20/src/beamlit/api/functions/get_function_deployment_logs.py +0 -164
- beamlit-0.0.24rc20/src/beamlit/api/functions/get_function_deployment_metrics.py +0 -159
- beamlit-0.0.24rc20/src/beamlit/api/functions/list_function_deployments.py +0 -155
- beamlit-0.0.24rc20/src/beamlit/api/functions/put_function_deployment.py +0 -185
- beamlit-0.0.24rc20/src/beamlit/api/models/delete_model_deployment.py +0 -171
- beamlit-0.0.24rc20/src/beamlit/api/models/get_model_deployment.py +0 -171
- beamlit-0.0.24rc20/src/beamlit/api/models/get_model_deployment_logs.py +0 -168
- beamlit-0.0.24rc20/src/beamlit/api/models/get_model_deployment_metrics.py +0 -163
- beamlit-0.0.24rc20/src/beamlit/api/models/list_model_deployments.py +0 -163
- beamlit-0.0.24rc20/src/beamlit/api/models/put_model_deployment.py +0 -193
- beamlit-0.0.24rc20/src/beamlit/deploy/deploy.py +0 -503
- beamlit-0.0.24rc20/src/beamlit/models/agent.py +0 -153
- beamlit-0.0.24rc20/src/beamlit/models/agent_configuration.py +0 -70
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment.py +0 -340
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment_configuration.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment_configuration_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment_history.py +0 -185
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment_pod_template.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/agent_history_event.py +0 -131
- beamlit-0.0.24rc20/src/beamlit/models/agent_with_deployments.py +0 -176
- beamlit-0.0.24rc20/src/beamlit/models/authentication_provider_model.py +0 -144
- beamlit-0.0.24rc20/src/beamlit/models/authentication_provider_organization.py +0 -88
- beamlit-0.0.24rc20/src/beamlit/models/deployment_configuration.py +0 -70
- beamlit-0.0.24rc20/src/beamlit/models/deployment_configurations.py +0 -58
- beamlit-0.0.24rc20/src/beamlit/models/deployment_serverless_config_type_0.py +0 -220
- beamlit-0.0.24rc20/src/beamlit/models/environment.py +0 -164
- beamlit-0.0.24rc20/src/beamlit/models/function.py +0 -153
- beamlit-0.0.24rc20/src/beamlit/models/function_configuration.py +0 -70
- beamlit-0.0.24rc20/src/beamlit/models/function_deployment.py +0 -340
- beamlit-0.0.24rc20/src/beamlit/models/function_deployment_configuration.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/function_deployment_configuration_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/function_deployment_pod_template.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/function_deployment_pod_template_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/function_with_deployments.py +0 -176
- beamlit-0.0.24rc20/src/beamlit/models/integration.py +0 -198
- beamlit-0.0.24rc20/src/beamlit/models/integration_config.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/integration_connection.py +0 -198
- beamlit-0.0.24rc20/src/beamlit/models/integration_secret.py +0 -61
- beamlit-0.0.24rc20/src/beamlit/models/labels_type_0.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/location.py +0 -122
- beamlit-0.0.24rc20/src/beamlit/models/model.py +0 -153
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment.py +0 -296
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment_log.py +0 -70
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment_pod_template.py +0 -45
- beamlit-0.0.24rc20/src/beamlit/models/model_deployment_pod_template_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/model_metrics.py +0 -96
- beamlit-0.0.24rc20/src/beamlit/models/model_provider_ref.py +0 -70
- beamlit-0.0.24rc20/src/beamlit/models/model_with_deployments.py +0 -176
- beamlit-0.0.24rc20/src/beamlit/models/policy.py +0 -218
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_log.py +0 -70
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
- beamlit-0.0.24rc20/src/beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
- beamlit-0.0.24rc20/src/beamlit/models/resource_environment_metrics.py +0 -210
- beamlit-0.0.24rc20/src/beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +0 -79
- beamlit-0.0.24rc20/src/beamlit/models/runtime_readiness_probe_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/runtime_type_0.py +0 -111
- beamlit-0.0.24rc20/src/beamlit/models/runtime_type_0_readiness_probe.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/runtime_type_0_resources.py +0 -59
- beamlit-0.0.24rc20/src/beamlit/models/serverless_config.py +0 -124
- beamlit-0.0.24rc20/src/beamlit/models/standard_fields_dynamo_db.py +0 -88
- beamlit-0.0.24rc20/src/beamlit/models/store_agent_configuration.py +0 -97
- beamlit-0.0.24rc20/src/beamlit/models/store_agent_labels_type_0.py +0 -43
- beamlit-0.0.24rc20/src/beamlit/models/store_function_configuration.py +0 -97
- beamlit-0.0.24rc20/src/beamlit/models/store_function_labels_type_0.py +0 -43
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/.gitignore +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/README.md +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/beamlit.yaml +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/agents/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/agents/create_agent_release.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/configurations/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/configurations/get_configuration.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/create_environment.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/delete_environment.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/get_environment.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/get_environment_metrics.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/list_environments.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/environments/update_environment.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/functions/create_function_release.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/history/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/create_integration_connection.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/delete_integration_connection.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/get_integration.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/list_integration_connection_models.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/list_integration_connections.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/list_integration_models.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/integrations/update_integration_connection.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/invitations/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/invitations/list_all_pending_invitations.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/locations/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/metrics/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/metrics/get_metrics.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/model_providers/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/model_providers/create_model_provider.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/model_providers/delete_model_provider.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/model_providers/get_model_provider.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/model_providers/list_model_providers.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/model_providers/update_model_provider.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/models/release_model.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/policies/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/policies/create_policy.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/policies/delete_policy.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/policies/get_policy.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/policies/list_policies.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/policies/update_policy.py +0 -0
- {beamlit-0.0.24rc20/src/beamlit/api/service_accounts → beamlit-0.0.25/src/beamlit/api/privateclusters}/__init__.py +0 -0
- {beamlit-0.0.24rc20/src/beamlit/api/store → beamlit-0.0.25/src/beamlit/api/service_accounts}/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/create_api_key_for_service_account.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/create_workspace_service_account.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/delete_api_key_for_service_account.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/delete_workspace_service_account.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/get_workspace_service_accounts.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/list_api_keys_for_service_account.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/service_accounts/update_workspace_service_account.py +0 -0
- {beamlit-0.0.24rc20/src/beamlit/api/workspaces → beamlit-0.0.25/src/beamlit/api/store}/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/store/get_store_agent.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/store/get_store_function.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/store/list_store_agents.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/store/list_store_functions.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/accept_workspace_invitation.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/create_worspace.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/decline_workspace_invitation.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/delete_workspace.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/get_workspace.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/invite_workspace_user.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/leave_workspace.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/list_workspace_users.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/list_workspaces.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/remove_workspace_user.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/update_workspace.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/api/workspaces/update_workspace_user_role.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/authentication/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/authentication/apikey.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/authentication/authentication.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/authentication/clientcredentials.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/authentication/credentials.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/client.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/common/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/common/logger.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/common/secrets.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/common/utils.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/deploy/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/errors.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/github/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/github/github.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/github/kit/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/github/kit/pull_request.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/math/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/math/math.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/search/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/functions/search/search.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/agent_chain.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/agent_release.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/continent.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/country.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/create_api_key_for_service_account_body.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/create_workspace_service_account_body.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/create_workspace_service_account_response_200.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/delete_workspace_service_account_response_200.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/environment_metrics.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/flavor.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/function_kit.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/function_release.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/get_workspace_service_accounts_response_200_item.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/increase_and_rate_metric.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/integration_connection_config.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/integration_connection_secret.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/integration_model.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/invite_workspace_user_body.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/location_response.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/metric.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/metrics.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/model_release.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pending_invitation_accept.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pending_invitation_render.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pending_invitation_render_invited_by.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pending_invitation_render_workspace.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/pending_invitation_workspace_details.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/policy_location.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/provider_config.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/qps.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/resource_metrics.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/runtime_readiness_probe.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/runtime_resources.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_agent_labels.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_configuration.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_configuration_option.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_function_kit.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_function_labels.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/store_function_parameter.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/update_workspace_service_account_body.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/update_workspace_service_account_response_200.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/update_workspace_user_role_body.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/workspace_labels.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/models/workspace_user.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/py.typed +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/serve/middlewares/__init__.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/serve/middlewares/processtime.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/beamlit/types.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/integrationtest/agent.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/src/integrationtest/functions/helloworld.py +0 -0
- {beamlit-0.0.24rc20 → beamlit-0.0.25}/uv.lock +0 -0
@@ -2,14 +2,14 @@ from logging import getLogger
|
|
2
2
|
|
3
3
|
from beamlit.authentication import get_authentication_headers, new_client
|
4
4
|
from beamlit.common.settings import get_settings
|
5
|
-
from beamlit.models import
|
5
|
+
from beamlit.models import Model
|
6
6
|
|
7
7
|
logger = getLogger(__name__)
|
8
8
|
|
9
9
|
|
10
|
-
def get_base_url(agent_model:
|
10
|
+
def get_base_url(agent_model: Model):
|
11
11
|
settings = get_settings()
|
12
|
-
return f"{settings.run_url}/{settings.workspace}/models/{agent_model.
|
12
|
+
return f"{settings.run_url}/{settings.workspace}/models/{agent_model.metadata.name}/v1"
|
13
13
|
|
14
14
|
|
15
15
|
def get_mistral_chat_model(**kwargs):
|
@@ -29,16 +29,25 @@ def get_anthropic_chat_model(**kwargs):
|
|
29
29
|
|
30
30
|
return ChatAnthropic(**kwargs)
|
31
31
|
|
32
|
+
def get_xai_chat_model(**kwargs):
|
33
|
+
from langchain_xai import ChatXAI # type: ignore
|
32
34
|
|
33
|
-
|
35
|
+
return ChatXAI(**kwargs)
|
36
|
+
|
37
|
+
def get_cohere_chat_model(**kwargs):
|
38
|
+
from langchain_cohere import ChatCohere # type: ignore
|
39
|
+
|
40
|
+
return ChatCohere(**kwargs)
|
41
|
+
|
42
|
+
def get_chat_model(agent_model: Model):
|
34
43
|
settings = get_settings()
|
35
44
|
client = new_client()
|
36
45
|
|
37
46
|
headers = get_authentication_headers(settings)
|
38
|
-
headers["X-Beamlit-Environment"] = agent_model.environment
|
47
|
+
headers["X-Beamlit-Environment"] = agent_model.metadata.environment
|
39
48
|
|
40
49
|
jwt = headers.get("X-Beamlit-Authorization", "").replace("Bearer ", "")
|
41
|
-
params = {"environment": agent_model.environment}
|
50
|
+
params = {"environment": agent_model.metadata.environment}
|
42
51
|
chat_classes = {
|
43
52
|
"openai": {
|
44
53
|
"func": get_openai_chat_model,
|
@@ -57,19 +66,33 @@ def get_chat_model(agent_model: AgentDeployment):
|
|
57
66
|
"api_key": jwt,
|
58
67
|
},
|
59
68
|
},
|
69
|
+
"xai": {
|
70
|
+
"func": get_xai_chat_model,
|
71
|
+
"kwargs": {
|
72
|
+
"api_key": jwt,
|
73
|
+
"xai_api_base": get_base_url(),
|
74
|
+
},
|
75
|
+
"remove_kwargs": ["base_url"],
|
76
|
+
},
|
77
|
+
"cohere": {
|
78
|
+
"func": get_cohere_chat_model,
|
79
|
+
"kwargs": {
|
80
|
+
"cohere_api_key": jwt,
|
81
|
+
},
|
82
|
+
},
|
60
83
|
}
|
61
84
|
|
62
85
|
if agent_model is None:
|
63
86
|
raise ValueError("agent_model not found in configuration")
|
64
|
-
if agent_model.runtime is None:
|
87
|
+
if agent_model.spec.runtime is None:
|
65
88
|
raise ValueError("runtime not found in agent model")
|
66
|
-
if agent_model.runtime.type_ is None:
|
89
|
+
if agent_model.spec.runtime.type_ is None:
|
67
90
|
raise ValueError("type not found in runtime")
|
68
|
-
if agent_model.runtime.model is None:
|
91
|
+
if agent_model.spec.runtime.model is None:
|
69
92
|
raise ValueError("model not found in runtime")
|
70
93
|
|
71
|
-
provider = agent_model.runtime.type_
|
72
|
-
model = agent_model.runtime.model
|
94
|
+
provider = agent_model.spec.runtime.type_
|
95
|
+
model = agent_model.spec.runtime.model
|
73
96
|
|
74
97
|
kwargs = {
|
75
98
|
"model": model,
|
@@ -85,4 +108,7 @@ def get_chat_model(agent_model: AgentDeployment):
|
|
85
108
|
chat_class = chat_classes["openai"]
|
86
109
|
if "kwargs" in chat_class:
|
87
110
|
kwargs.update(chat_class["kwargs"])
|
111
|
+
if "remove_kwargs" in chat_class:
|
112
|
+
for key in chat_class["remove_kwargs"]:
|
113
|
+
kwargs.pop(key, None)
|
88
114
|
return chat_class["func"](**kwargs)
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# Import necessary modules
|
2
|
+
import ast
|
3
|
+
import asyncio
|
4
|
+
import functools
|
5
|
+
import importlib
|
6
|
+
import os
|
7
|
+
from logging import getLogger
|
8
|
+
|
9
|
+
from beamlit.api.models import get_model
|
10
|
+
from beamlit.authentication import new_client
|
11
|
+
from beamlit.common.settings import get_settings, init
|
12
|
+
from beamlit.errors import UnexpectedStatus
|
13
|
+
from beamlit.models import Agent, AgentSpec, Metadata
|
14
|
+
from langchain_core.tools import Tool
|
15
|
+
from langgraph.checkpoint.memory import MemorySaver
|
16
|
+
from langgraph.prebuilt import create_react_agent
|
17
|
+
|
18
|
+
from .chat import get_chat_model
|
19
|
+
|
20
|
+
|
21
|
+
def get_functions(dir="src/functions", from_decorator="function"):
|
22
|
+
functions = []
|
23
|
+
logger = getLogger(__name__)
|
24
|
+
|
25
|
+
# Walk through all Python files in functions directory and subdirectories
|
26
|
+
if not os.path.exists(dir):
|
27
|
+
return []
|
28
|
+
for root, _, files in os.walk(dir):
|
29
|
+
for file in files:
|
30
|
+
if file.endswith(".py"):
|
31
|
+
file_path = os.path.join(root, file)
|
32
|
+
# Read and compile the file content
|
33
|
+
with open(file_path) as f:
|
34
|
+
try:
|
35
|
+
file_content = f.read()
|
36
|
+
# Parse the file content to find decorated functions
|
37
|
+
tree = ast.parse(file_content)
|
38
|
+
|
39
|
+
# Look for function definitions with decorators
|
40
|
+
for node in ast.walk(tree):
|
41
|
+
if (
|
42
|
+
not isinstance(node, ast.FunctionDef)
|
43
|
+
and not isinstance(node, ast.AsyncFunctionDef)
|
44
|
+
) or len(node.decorator_list) == 0:
|
45
|
+
continue
|
46
|
+
decorator = node.decorator_list[0]
|
47
|
+
|
48
|
+
decorator_name = ""
|
49
|
+
if isinstance(decorator, ast.Call):
|
50
|
+
decorator_name = decorator.func.id
|
51
|
+
if isinstance(decorator, ast.Name):
|
52
|
+
decorator_name = decorator.id
|
53
|
+
|
54
|
+
if decorator_name == from_decorator:
|
55
|
+
# Get the function name and decorator name
|
56
|
+
func_name = node.name
|
57
|
+
|
58
|
+
# Import the module to get the actual function
|
59
|
+
spec = importlib.util.spec_from_file_location(func_name, file_path)
|
60
|
+
module = importlib.util.module_from_spec(spec)
|
61
|
+
spec.loader.exec_module(module)
|
62
|
+
# Check if kit=True in the decorator arguments
|
63
|
+
is_kit = False
|
64
|
+
if isinstance(decorator, ast.Call):
|
65
|
+
for keyword in decorator.keywords:
|
66
|
+
if keyword.arg == "kit" and isinstance(
|
67
|
+
keyword.value, ast.Constant
|
68
|
+
):
|
69
|
+
is_kit = keyword.value.value
|
70
|
+
if is_kit:
|
71
|
+
kit_functions = get_functions(
|
72
|
+
dir=os.path.join(root),
|
73
|
+
from_decorator="kit",
|
74
|
+
)
|
75
|
+
functions.extend(kit_functions)
|
76
|
+
|
77
|
+
# Get the decorated function
|
78
|
+
if not is_kit and hasattr(module, func_name):
|
79
|
+
func = getattr(module, func_name)
|
80
|
+
if asyncio.iscoroutinefunction(func):
|
81
|
+
functions.append(
|
82
|
+
Tool(
|
83
|
+
name=func.__name__,
|
84
|
+
description=func.__doc__,
|
85
|
+
func=func,
|
86
|
+
coroutine=func,
|
87
|
+
)
|
88
|
+
)
|
89
|
+
else:
|
90
|
+
functions.append(
|
91
|
+
Tool(
|
92
|
+
name=func.__name__,
|
93
|
+
description=func.__doc__,
|
94
|
+
func=func,
|
95
|
+
)
|
96
|
+
)
|
97
|
+
except Exception as e:
|
98
|
+
logger.warning(f"Error processing {file_path}: {e!s}")
|
99
|
+
return functions
|
100
|
+
|
101
|
+
|
102
|
+
def agent(
|
103
|
+
agent: Agent | dict = None,
|
104
|
+
override_chat_model=None,
|
105
|
+
override_agent=None,
|
106
|
+
):
|
107
|
+
logger = getLogger(__name__)
|
108
|
+
try:
|
109
|
+
if agent is not None and not isinstance(agent, dict):
|
110
|
+
raise Exception(
|
111
|
+
'agent must be a dictionary, example: @agent(agent={"metadata": {"name": "my_agent"}})'
|
112
|
+
)
|
113
|
+
|
114
|
+
chat_model = override_chat_model or None
|
115
|
+
settings = init()
|
116
|
+
|
117
|
+
def wrapper(func):
|
118
|
+
@functools.wraps(func)
|
119
|
+
def wrapped(*args, **kwargs):
|
120
|
+
return func(
|
121
|
+
settings.agent.agent,
|
122
|
+
settings.agent.chat_model,
|
123
|
+
settings.agent.functions,
|
124
|
+
*args,
|
125
|
+
**kwargs,
|
126
|
+
)
|
127
|
+
|
128
|
+
return wrapped
|
129
|
+
|
130
|
+
# Initialize functions array to store decorated functions
|
131
|
+
functions = get_functions(dir=settings.agent.functions_directory)
|
132
|
+
settings.agent.functions = functions
|
133
|
+
|
134
|
+
if agent is not None:
|
135
|
+
metadata = Metadata(**agent.get("metadata", {}))
|
136
|
+
spec = AgentSpec(**agent.get("spec", {}))
|
137
|
+
agent = Agent(metadata=metadata, spec=spec)
|
138
|
+
if agent.spec.model and chat_model is None:
|
139
|
+
client = new_client()
|
140
|
+
try:
|
141
|
+
response = get_model.sync_detailed(
|
142
|
+
agent.spec.model, environment=settings.environment, client=client
|
143
|
+
)
|
144
|
+
settings.agent.model = response.parsed
|
145
|
+
except UnexpectedStatus as e:
|
146
|
+
if e.status_code == 404 and settings.environment != "production":
|
147
|
+
try:
|
148
|
+
response = get_model.sync_detailed(
|
149
|
+
agent.spec.model, environment="production", client=client
|
150
|
+
)
|
151
|
+
settings.agent.model = response.parsed
|
152
|
+
except UnexpectedStatus as e:
|
153
|
+
if e.status_code == 404:
|
154
|
+
raise ValueError(f"Model {agent.spec.model} not found")
|
155
|
+
else:
|
156
|
+
raise e
|
157
|
+
except Exception as e:
|
158
|
+
raise e
|
159
|
+
|
160
|
+
if settings.agent.model:
|
161
|
+
chat_model = get_chat_model(settings.agent.model)
|
162
|
+
settings.agent.chat_model = chat_model
|
163
|
+
runtime = settings.agent.model.spec.runtime
|
164
|
+
logger.info(f"Chat model configured, using: {runtime.type_}:{runtime.model}")
|
165
|
+
|
166
|
+
if override_agent is None and len(functions) == 0:
|
167
|
+
raise ValueError(
|
168
|
+
"You must define at least one function, you can define this function in directory "
|
169
|
+
f'"{settings.agent.functions_directory}". Here is a sample function you can use:\n\n'
|
170
|
+
"from beamlit.functions import function\n\n"
|
171
|
+
"@function()\n"
|
172
|
+
"def hello_world(query: str):\n"
|
173
|
+
" return 'Hello, world!'\n"
|
174
|
+
)
|
175
|
+
|
176
|
+
if override_agent is None and chat_model is not None:
|
177
|
+
memory = MemorySaver()
|
178
|
+
agent = create_react_agent(chat_model, functions, checkpointer=memory)
|
179
|
+
settings.agent.agent = agent
|
180
|
+
else:
|
181
|
+
settings.agent.agent = override_agent
|
182
|
+
return wrapper
|
183
|
+
except Exception as e:
|
184
|
+
logger.error(f"Error in agent decorator: {e!s} at line {e.__traceback__.tb_lineno}")
|
185
|
+
raise e
|
@@ -6,13 +6,12 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
8
|
from ...models.agent import Agent
|
9
|
-
from ...models.agent_with_deployments import AgentWithDeployments
|
10
9
|
from ...types import Response
|
11
10
|
|
12
11
|
|
13
12
|
def _get_kwargs(
|
14
13
|
*,
|
15
|
-
body:
|
14
|
+
body: Agent,
|
16
15
|
) -> dict[str, Any]:
|
17
16
|
headers: dict[str, Any] = {}
|
18
17
|
|
@@ -53,13 +52,12 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
|
53
52
|
def sync_detailed(
|
54
53
|
*,
|
55
54
|
client: AuthenticatedClient,
|
56
|
-
body:
|
55
|
+
body: Agent,
|
57
56
|
) -> Response[Agent]:
|
58
57
|
"""Create agent by name
|
59
58
|
|
60
59
|
Args:
|
61
|
-
body (
|
62
|
-
definition inside
|
60
|
+
body (Agent): Agent
|
63
61
|
|
64
62
|
Raises:
|
65
63
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -83,13 +81,12 @@ def sync_detailed(
|
|
83
81
|
def sync(
|
84
82
|
*,
|
85
83
|
client: AuthenticatedClient,
|
86
|
-
body:
|
84
|
+
body: Agent,
|
87
85
|
) -> Optional[Agent]:
|
88
86
|
"""Create agent by name
|
89
87
|
|
90
88
|
Args:
|
91
|
-
body (
|
92
|
-
definition inside
|
89
|
+
body (Agent): Agent
|
93
90
|
|
94
91
|
Raises:
|
95
92
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -108,13 +105,12 @@ def sync(
|
|
108
105
|
async def asyncio_detailed(
|
109
106
|
*,
|
110
107
|
client: AuthenticatedClient,
|
111
|
-
body:
|
108
|
+
body: Agent,
|
112
109
|
) -> Response[Agent]:
|
113
110
|
"""Create agent by name
|
114
111
|
|
115
112
|
Args:
|
116
|
-
body (
|
117
|
-
definition inside
|
113
|
+
body (Agent): Agent
|
118
114
|
|
119
115
|
Raises:
|
120
116
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -136,13 +132,12 @@ async def asyncio_detailed(
|
|
136
132
|
async def asyncio(
|
137
133
|
*,
|
138
134
|
client: AuthenticatedClient,
|
139
|
-
body:
|
135
|
+
body: Agent,
|
140
136
|
) -> Optional[Agent]:
|
141
137
|
"""Create agent by name
|
142
138
|
|
143
139
|
Args:
|
144
|
-
body (
|
145
|
-
definition inside
|
140
|
+
body (Agent): Agent
|
146
141
|
|
147
142
|
Raises:
|
148
143
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -6,15 +6,24 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
8
|
from ...models.agent import Agent
|
9
|
-
from ...types import Response
|
9
|
+
from ...types import UNSET, Response
|
10
10
|
|
11
11
|
|
12
12
|
def _get_kwargs(
|
13
13
|
agent_name: str,
|
14
|
+
*,
|
15
|
+
environment: str,
|
14
16
|
) -> dict[str, Any]:
|
17
|
+
params: dict[str, Any] = {}
|
18
|
+
|
19
|
+
params["environment"] = environment
|
20
|
+
|
21
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
22
|
+
|
15
23
|
_kwargs: dict[str, Any] = {
|
16
24
|
"method": "delete",
|
17
25
|
"url": f"/agents/{agent_name}",
|
26
|
+
"params": params,
|
18
27
|
}
|
19
28
|
|
20
29
|
return _kwargs
|
@@ -44,11 +53,13 @@ def sync_detailed(
|
|
44
53
|
agent_name: str,
|
45
54
|
*,
|
46
55
|
client: AuthenticatedClient,
|
56
|
+
environment: str,
|
47
57
|
) -> Response[Agent]:
|
48
58
|
"""Delete agent by name
|
49
59
|
|
50
60
|
Args:
|
51
61
|
agent_name (str):
|
62
|
+
environment (str):
|
52
63
|
|
53
64
|
Raises:
|
54
65
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -60,6 +71,7 @@ def sync_detailed(
|
|
60
71
|
|
61
72
|
kwargs = _get_kwargs(
|
62
73
|
agent_name=agent_name,
|
74
|
+
environment=environment,
|
63
75
|
)
|
64
76
|
|
65
77
|
response = client.get_httpx_client().request(
|
@@ -73,11 +85,13 @@ def sync(
|
|
73
85
|
agent_name: str,
|
74
86
|
*,
|
75
87
|
client: AuthenticatedClient,
|
88
|
+
environment: str,
|
76
89
|
) -> Optional[Agent]:
|
77
90
|
"""Delete agent by name
|
78
91
|
|
79
92
|
Args:
|
80
93
|
agent_name (str):
|
94
|
+
environment (str):
|
81
95
|
|
82
96
|
Raises:
|
83
97
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -90,6 +104,7 @@ def sync(
|
|
90
104
|
return sync_detailed(
|
91
105
|
agent_name=agent_name,
|
92
106
|
client=client,
|
107
|
+
environment=environment,
|
93
108
|
).parsed
|
94
109
|
|
95
110
|
|
@@ -97,11 +112,13 @@ async def asyncio_detailed(
|
|
97
112
|
agent_name: str,
|
98
113
|
*,
|
99
114
|
client: AuthenticatedClient,
|
115
|
+
environment: str,
|
100
116
|
) -> Response[Agent]:
|
101
117
|
"""Delete agent by name
|
102
118
|
|
103
119
|
Args:
|
104
120
|
agent_name (str):
|
121
|
+
environment (str):
|
105
122
|
|
106
123
|
Raises:
|
107
124
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -113,6 +130,7 @@ async def asyncio_detailed(
|
|
113
130
|
|
114
131
|
kwargs = _get_kwargs(
|
115
132
|
agent_name=agent_name,
|
133
|
+
environment=environment,
|
116
134
|
)
|
117
135
|
|
118
136
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -124,11 +142,13 @@ async def asyncio(
|
|
124
142
|
agent_name: str,
|
125
143
|
*,
|
126
144
|
client: AuthenticatedClient,
|
145
|
+
environment: str,
|
127
146
|
) -> Optional[Agent]:
|
128
147
|
"""Delete agent by name
|
129
148
|
|
130
149
|
Args:
|
131
150
|
agent_name (str):
|
151
|
+
environment (str):
|
132
152
|
|
133
153
|
Raises:
|
134
154
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -142,5 +162,6 @@ async def asyncio(
|
|
142
162
|
await asyncio_detailed(
|
143
163
|
agent_name=agent_name,
|
144
164
|
client=client,
|
165
|
+
environment=environment,
|
145
166
|
)
|
146
167
|
).parsed
|
@@ -21,9 +21,7 @@ def _get_kwargs(
|
|
21
21
|
return _kwargs
|
22
22
|
|
23
23
|
|
24
|
-
def _parse_response(
|
25
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
26
|
-
) -> Optional[AgentHistory]:
|
24
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AgentHistory]:
|
27
25
|
if response.status_code == 200:
|
28
26
|
response_200 = AgentHistory.from_dict(response.json())
|
29
27
|
|
@@ -34,9 +32,7 @@ def _parse_response(
|
|
34
32
|
return None
|
35
33
|
|
36
34
|
|
37
|
-
def _build_response(
|
38
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
39
|
-
) -> Response[AgentHistory]:
|
35
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AgentHistory]:
|
40
36
|
return Response(
|
41
37
|
status_code=HTTPStatus(response.status_code),
|
42
38
|
content=response.content,
|
@@ -6,28 +6,26 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
8
|
from ...models.agent import Agent
|
9
|
-
from ...
|
10
|
-
from ...types import Response
|
9
|
+
from ...types import UNSET, Response, Unset
|
11
10
|
|
12
11
|
|
13
12
|
def _get_kwargs(
|
14
13
|
agent_name: str,
|
15
14
|
*,
|
16
|
-
|
15
|
+
environment: Union[Unset, str] = UNSET,
|
17
16
|
) -> dict[str, Any]:
|
18
|
-
|
17
|
+
params: dict[str, Any] = {}
|
18
|
+
|
19
|
+
params["environment"] = environment
|
20
|
+
|
21
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
19
22
|
|
20
23
|
_kwargs: dict[str, Any] = {
|
21
|
-
"method": "
|
24
|
+
"method": "get",
|
22
25
|
"url": f"/agents/{agent_name}",
|
26
|
+
"params": params,
|
23
27
|
}
|
24
28
|
|
25
|
-
_body = body.to_dict()
|
26
|
-
|
27
|
-
_kwargs["json"] = _body
|
28
|
-
headers["Content-Type"] = "application/json"
|
29
|
-
|
30
|
-
_kwargs["headers"] = headers
|
31
29
|
return _kwargs
|
32
30
|
|
33
31
|
|
@@ -55,14 +53,13 @@ def sync_detailed(
|
|
55
53
|
agent_name: str,
|
56
54
|
*,
|
57
55
|
client: AuthenticatedClient,
|
58
|
-
|
56
|
+
environment: Union[Unset, str] = UNSET,
|
59
57
|
) -> Response[Agent]:
|
60
|
-
"""
|
58
|
+
"""Get agent by name
|
61
59
|
|
62
60
|
Args:
|
63
61
|
agent_name (str):
|
64
|
-
|
65
|
-
definition inside
|
62
|
+
environment (Union[Unset, str]):
|
66
63
|
|
67
64
|
Raises:
|
68
65
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -74,7 +71,7 @@ def sync_detailed(
|
|
74
71
|
|
75
72
|
kwargs = _get_kwargs(
|
76
73
|
agent_name=agent_name,
|
77
|
-
|
74
|
+
environment=environment,
|
78
75
|
)
|
79
76
|
|
80
77
|
response = client.get_httpx_client().request(
|
@@ -88,14 +85,13 @@ def sync(
|
|
88
85
|
agent_name: str,
|
89
86
|
*,
|
90
87
|
client: AuthenticatedClient,
|
91
|
-
|
88
|
+
environment: Union[Unset, str] = UNSET,
|
92
89
|
) -> Optional[Agent]:
|
93
|
-
"""
|
90
|
+
"""Get agent by name
|
94
91
|
|
95
92
|
Args:
|
96
93
|
agent_name (str):
|
97
|
-
|
98
|
-
definition inside
|
94
|
+
environment (Union[Unset, str]):
|
99
95
|
|
100
96
|
Raises:
|
101
97
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -108,7 +104,7 @@ def sync(
|
|
108
104
|
return sync_detailed(
|
109
105
|
agent_name=agent_name,
|
110
106
|
client=client,
|
111
|
-
|
107
|
+
environment=environment,
|
112
108
|
).parsed
|
113
109
|
|
114
110
|
|
@@ -116,14 +112,13 @@ async def asyncio_detailed(
|
|
116
112
|
agent_name: str,
|
117
113
|
*,
|
118
114
|
client: AuthenticatedClient,
|
119
|
-
|
115
|
+
environment: Union[Unset, str] = UNSET,
|
120
116
|
) -> Response[Agent]:
|
121
|
-
"""
|
117
|
+
"""Get agent by name
|
122
118
|
|
123
119
|
Args:
|
124
120
|
agent_name (str):
|
125
|
-
|
126
|
-
definition inside
|
121
|
+
environment (Union[Unset, str]):
|
127
122
|
|
128
123
|
Raises:
|
129
124
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -135,7 +130,7 @@ async def asyncio_detailed(
|
|
135
130
|
|
136
131
|
kwargs = _get_kwargs(
|
137
132
|
agent_name=agent_name,
|
138
|
-
|
133
|
+
environment=environment,
|
139
134
|
)
|
140
135
|
|
141
136
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -147,14 +142,13 @@ async def asyncio(
|
|
147
142
|
agent_name: str,
|
148
143
|
*,
|
149
144
|
client: AuthenticatedClient,
|
150
|
-
|
145
|
+
environment: Union[Unset, str] = UNSET,
|
151
146
|
) -> Optional[Agent]:
|
152
|
-
"""
|
147
|
+
"""Get agent by name
|
153
148
|
|
154
149
|
Args:
|
155
150
|
agent_name (str):
|
156
|
-
|
157
|
-
definition inside
|
151
|
+
environment (Union[Unset, str]):
|
158
152
|
|
159
153
|
Raises:
|
160
154
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -168,6 +162,6 @@ async def asyncio(
|
|
168
162
|
await asyncio_detailed(
|
169
163
|
agent_name=agent_name,
|
170
164
|
client=client,
|
171
|
-
|
165
|
+
environment=environment,
|
172
166
|
)
|
173
167
|
).parsed
|