beamlit 0.0.28rc25__tar.gz → 0.0.29rc27__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/PKG-INFO +1 -1
  2. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/pyproject.toml +1 -1
  3. beamlit-0.0.29rc27/src/beamlit/agents/chain.py +93 -0
  4. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/agents/decorator.py +6 -2
  5. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/authentication/authentication.py +3 -3
  6. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/authentication/clientcredentials.py +1 -1
  7. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/settings.py +3 -5
  8. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/mcp/mcp.py +26 -18
  9. beamlit-0.0.29rc27/src/beamlit/functions/remote/remote.py +122 -0
  10. beamlit-0.0.28rc25/src/beamlit/functions/remote/remote.py +0 -103
  11. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/.gitignore +0 -0
  12. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/README.md +0 -0
  13. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/beamlit.yaml +0 -0
  14. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/__init__.py +0 -0
  15. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/agents/__init__.py +0 -0
  16. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/agents/chat.py +0 -0
  17. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/__init__.py +0 -0
  18. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/__init__.py +0 -0
  19. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/create_agent.py +0 -0
  20. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/create_agent_release.py +0 -0
  21. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/delete_agent.py +0 -0
  22. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/delete_agent_history.py +0 -0
  23. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/get_agent.py +0 -0
  24. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/get_agent_environment_logs.py +0 -0
  25. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/get_agent_history.py +0 -0
  26. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/get_agent_metrics.py +0 -0
  27. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/get_agent_trace_ids.py +0 -0
  28. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/list_agent_history.py +0 -0
  29. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/list_agents.py +0 -0
  30. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/put_agent_history.py +0 -0
  31. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/agents/update_agent.py +0 -0
  32. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/configurations/__init__.py +0 -0
  33. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/configurations/get_configuration.py +0 -0
  34. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/default/__init__.py +0 -0
  35. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/default/get_trace.py +0 -0
  36. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/default/get_trace_ids.py +0 -0
  37. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/default/get_trace_logs.py +0 -0
  38. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/__init__.py +0 -0
  39. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/create_environment.py +0 -0
  40. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/delete_environment.py +0 -0
  41. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/get_environment.py +0 -0
  42. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/get_environment_metrics.py +0 -0
  43. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/list_environments.py +0 -0
  44. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/environments/update_environment.py +0 -0
  45. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/__init__.py +0 -0
  46. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/create_function.py +0 -0
  47. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/create_function_release.py +0 -0
  48. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/delete_function.py +0 -0
  49. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/get_function.py +0 -0
  50. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/get_function_environment_logs.py +0 -0
  51. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/get_function_metrics.py +0 -0
  52. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/get_function_trace_ids.py +0 -0
  53. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/list_functions.py +0 -0
  54. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/functions/update_function.py +0 -0
  55. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/history/__init__.py +0 -0
  56. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/history/get_agents_history.py +0 -0
  57. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/history/list_agents_history.py +0 -0
  58. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/__init__.py +0 -0
  59. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/create_integration_connection.py +0 -0
  60. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/delete_integration_connection.py +0 -0
  61. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/get_integration.py +0 -0
  62. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/get_integration_connection.py +0 -0
  63. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/get_integration_connection_model.py +0 -0
  64. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/get_integration_model.py +0 -0
  65. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/list_integration_connection_models.py +0 -0
  66. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/list_integration_connections.py +0 -0
  67. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/list_integration_models.py +0 -0
  68. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/integrations/update_integration_connection.py +0 -0
  69. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/invitations/__init__.py +0 -0
  70. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/invitations/list_all_pending_invitations.py +0 -0
  71. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/locations/__init__.py +0 -0
  72. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/locations/list_locations.py +0 -0
  73. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/metrics/__init__.py +0 -0
  74. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/metrics/get_metrics.py +0 -0
  75. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/model_providers/__init__.py +0 -0
  76. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/model_providers/create_model_provider.py +0 -0
  77. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/model_providers/delete_model_provider.py +0 -0
  78. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/model_providers/get_model_provider.py +0 -0
  79. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/model_providers/list_model_providers.py +0 -0
  80. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/model_providers/update_model_provider.py +0 -0
  81. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/__init__.py +0 -0
  82. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/create_model.py +0 -0
  83. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/delete_model.py +0 -0
  84. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/get_model.py +0 -0
  85. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/get_model_environment_logs.py +0 -0
  86. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/get_model_metrics.py +0 -0
  87. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/get_model_trace_ids.py +0 -0
  88. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/list_models.py +0 -0
  89. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/release_model.py +0 -0
  90. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/models/update_model.py +0 -0
  91. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/policies/__init__.py +0 -0
  92. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/policies/create_policy.py +0 -0
  93. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/policies/delete_policy.py +0 -0
  94. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/policies/get_policy.py +0 -0
  95. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/policies/list_policies.py +0 -0
  96. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/policies/update_policy.py +0 -0
  97. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/__init__.py +0 -0
  98. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/create_private_cluster.py +0 -0
  99. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/delete_private_cluster.py +0 -0
  100. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/get_private_cluster.py +0 -0
  101. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/get_private_cluster_health.py +0 -0
  102. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/list_private_clusters.py +0 -0
  103. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/update_private_cluster.py +0 -0
  104. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/privateclusters/update_private_cluster_health.py +0 -0
  105. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/__init__.py +0 -0
  106. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/create_api_key_for_service_account.py +0 -0
  107. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/create_workspace_service_account.py +0 -0
  108. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/delete_api_key_for_service_account.py +0 -0
  109. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/delete_workspace_service_account.py +0 -0
  110. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/get_workspace_service_accounts.py +0 -0
  111. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/list_api_keys_for_service_account.py +0 -0
  112. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/service_accounts/update_workspace_service_account.py +0 -0
  113. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/store/__init__.py +0 -0
  114. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/store/get_store_agent.py +0 -0
  115. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/store/get_store_function.py +0 -0
  116. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/store/list_store_agents.py +0 -0
  117. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/store/list_store_functions.py +0 -0
  118. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/__init__.py +0 -0
  119. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/accept_workspace_invitation.py +0 -0
  120. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/create_worspace.py +0 -0
  121. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/decline_workspace_invitation.py +0 -0
  122. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/delete_workspace.py +0 -0
  123. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/get_workspace.py +0 -0
  124. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/invite_workspace_user.py +0 -0
  125. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/leave_workspace.py +0 -0
  126. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/list_workspace_users.py +0 -0
  127. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/list_workspaces.py +0 -0
  128. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/remove_workspace_user.py +0 -0
  129. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/update_workspace.py +0 -0
  130. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/api/workspaces/update_workspace_user_role.py +0 -0
  131. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/authentication/__init__.py +0 -0
  132. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/authentication/apikey.py +0 -0
  133. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/authentication/credentials.py +0 -0
  134. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/authentication/device_mode.py +0 -0
  135. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/client.py +0 -0
  136. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/__init__.py +0 -0
  137. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/generate.py +0 -0
  138. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/instrumentation.py +0 -0
  139. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/logger.py +0 -0
  140. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/secrets.py +0 -0
  141. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/common/utils.py +0 -0
  142. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/deploy/__init__.py +0 -0
  143. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/deploy/deploy.py +0 -0
  144. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/deploy/format.py +0 -0
  145. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/deploy/parser.py +0 -0
  146. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/errors.py +0 -0
  147. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/__init__.py +0 -0
  148. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/decorator.py +0 -0
  149. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/github/__init__.py +0 -0
  150. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/github/github.py +0 -0
  151. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/github/kit/__init__.py +0 -0
  152. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/github/kit/pull_request.py +0 -0
  153. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/math/__init__.py +0 -0
  154. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/math/math.py +0 -0
  155. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/search/__init__.py +0 -0
  156. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/functions/search/search.py +0 -0
  157. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/__init__.py +0 -0
  158. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/acl.py +0 -0
  159. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent.py +0 -0
  160. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent_chain.py +0 -0
  161. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent_history.py +0 -0
  162. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent_history_event.py +0 -0
  163. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent_metadata.py +0 -0
  164. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent_release.py +0 -0
  165. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/agent_spec.py +0 -0
  166. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/api_key.py +0 -0
  167. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/configuration.py +0 -0
  168. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/continent.py +0 -0
  169. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/core_spec.py +0 -0
  170. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/core_spec_configurations.py +0 -0
  171. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/core_status.py +0 -0
  172. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/country.py +0 -0
  173. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/create_api_key_for_service_account_body.py +0 -0
  174. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/create_workspace_service_account_body.py +0 -0
  175. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/create_workspace_service_account_response_200.py +0 -0
  176. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/delete_workspace_service_account_response_200.py +0 -0
  177. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/environment.py +0 -0
  178. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/environment_metadata.py +0 -0
  179. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/environment_metrics.py +0 -0
  180. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/environment_spec.py +0 -0
  181. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/flavor.py +0 -0
  182. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/function.py +0 -0
  183. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/function_kit.py +0 -0
  184. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/function_metadata.py +0 -0
  185. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/function_release.py +0 -0
  186. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/function_spec.py +0 -0
  187. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/get_trace_ids_response_200.py +0 -0
  188. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/get_trace_logs_response_200.py +0 -0
  189. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/get_trace_response_200.py +0 -0
  190. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/get_workspace_service_accounts_response_200_item.py +0 -0
  191. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/increase_and_rate_metric.py +0 -0
  192. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/integration_config.py +0 -0
  193. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/integration_connection.py +0 -0
  194. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/integration_connection_config.py +0 -0
  195. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/integration_connection_secret.py +0 -0
  196. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/integration_connection_spec.py +0 -0
  197. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/integration_model.py +0 -0
  198. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/invite_workspace_user_body.py +0 -0
  199. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/location_response.py +0 -0
  200. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/metadata.py +0 -0
  201. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/metadata_labels.py +0 -0
  202. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/metric.py +0 -0
  203. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/metrics.py +0 -0
  204. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/model.py +0 -0
  205. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/model_metadata.py +0 -0
  206. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/model_private_cluster.py +0 -0
  207. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/model_provider.py +0 -0
  208. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/model_release.py +0 -0
  209. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/model_spec.py +0 -0
  210. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/owner_fields.py +0 -0
  211. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pending_invitation.py +0 -0
  212. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pending_invitation_accept.py +0 -0
  213. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pending_invitation_render.py +0 -0
  214. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pending_invitation_render_invited_by.py +0 -0
  215. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pending_invitation_render_workspace.py +0 -0
  216. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pending_invitation_workspace_details.py +0 -0
  217. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/pod_template_spec.py +0 -0
  218. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/policy.py +0 -0
  219. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/policy_location.py +0 -0
  220. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/policy_spec.py +0 -0
  221. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/private_cluster.py +0 -0
  222. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/private_location.py +0 -0
  223. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/provider_config.py +0 -0
  224. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/qps.py +0 -0
  225. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_deployment_metrics.py +0 -0
  226. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +0 -0
  227. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +0 -0
  228. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_environment_metrics.py +0 -0
  229. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_environment_metrics_inference_per_region.py +0 -0
  230. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +0 -0
  231. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_environment_metrics_query_per_region_per_code.py +0 -0
  232. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +0 -0
  233. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_log.py +0 -0
  234. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/resource_metrics.py +0 -0
  235. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/runtime.py +0 -0
  236. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/runtime_readiness_probe.py +0 -0
  237. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/runtime_resources.py +0 -0
  238. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/serverless_config.py +0 -0
  239. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/spec_configuration.py +0 -0
  240. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_agent.py +0 -0
  241. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_agent_labels.py +0 -0
  242. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_configuration.py +0 -0
  243. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_configuration_option.py +0 -0
  244. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_function.py +0 -0
  245. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_function_kit.py +0 -0
  246. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_function_labels.py +0 -0
  247. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/store_function_parameter.py +0 -0
  248. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/time_fields.py +0 -0
  249. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/update_workspace_service_account_body.py +0 -0
  250. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/update_workspace_service_account_response_200.py +0 -0
  251. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/update_workspace_user_role_body.py +0 -0
  252. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/websocket_channel.py +0 -0
  253. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/workspace.py +0 -0
  254. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/workspace_labels.py +0 -0
  255. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/models/workspace_user.py +0 -0
  256. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/py.typed +0 -0
  257. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/run.py +0 -0
  258. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/serve/app.py +0 -0
  259. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/serve/middlewares/__init__.py +0 -0
  260. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/serve/middlewares/accesslog.py +0 -0
  261. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/serve/middlewares/processtime.py +0 -0
  262. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/beamlit/types.py +0 -0
  263. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/integrationtest/agent.py +0 -0
  264. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/integrationtest/beamlit.yaml +0 -0
  265. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/integrationtest/functions/helloworld.py +0 -0
  266. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/src/integrationtest/main.py +0 -0
  267. {beamlit-0.0.28rc25 → beamlit-0.0.29rc27}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.28rc25
3
+ Version: 0.0.29rc27
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "beamlit"
3
- version = "0.0.28.pre-25"
3
+ version = "0.0.29.pre-27"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -0,0 +1,93 @@
1
+ import asyncio
2
+ from dataclasses import dataclass
3
+ import warnings
4
+ from typing import Any, Callable
5
+
6
+ import pydantic
7
+ import typing_extensions as t
8
+ from beamlit.api.agents import list_agents
9
+ from beamlit.authentication.authentication import AuthenticatedClient
10
+ from beamlit.models import Agent, AgentChain
11
+ from beamlit.run import RunClient
12
+ from beamlit.common.settings import get_settings
13
+ from langchain_core.tools.base import BaseTool, ToolException
14
+
15
+
16
+
17
+ class ChainTool(BaseTool):
18
+ """
19
+ Chain tool
20
+ """
21
+
22
+ client: RunClient
23
+ handle_tool_error: bool | str | Callable[[ToolException], str] | None = True
24
+
25
+ @t.override
26
+ def _run(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
27
+ warnings.warn(
28
+ "Invoke this tool asynchronousely using `ainvoke`. This method exists only to satisfy standard tests.",
29
+ stacklevel=1,
30
+ )
31
+ return asyncio.run(self._arun(*args, **kwargs))
32
+
33
+ @t.override
34
+ async def _arun(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
35
+ settings = get_settings()
36
+ result = self.client.run(
37
+ "agent",
38
+ self.name,
39
+ settings.environment,
40
+ "POST",
41
+ json=kwargs,
42
+ )
43
+ return result.text
44
+
45
+ @t.override
46
+ @property
47
+ def tool_call_schema(self) -> type[pydantic.BaseModel]:
48
+ assert self.args_schema is not None # noqa: S101
49
+ return self.args_schema
50
+
51
+ class ChainInput(pydantic.BaseModel):
52
+ inputs: str
53
+
54
+ @dataclass
55
+ class ChainToolkit:
56
+ """
57
+ Remote toolkit
58
+ """
59
+ client: AuthenticatedClient
60
+ chain: list[AgentChain]
61
+ _chain: list[Agent] | None = None
62
+
63
+ model_config = pydantic.ConfigDict(arbitrary_types_allowed=True)
64
+
65
+ def initialize(self) -> None:
66
+ """Initialize the session and retrieve tools list"""
67
+ if self._chain is None:
68
+ agents = list_agents.sync_detailed(
69
+ client=self.client,
70
+ ).parsed
71
+ chain_enabled = [chain for chain in self.chain if chain.enabled]
72
+ agents_chain = []
73
+ for chain in chain_enabled:
74
+ agent = [agent for agent in agents if agent.metadata.name == chain.name]
75
+ if agent:
76
+ agent[0].spec.description = chain.description or agent[0].spec.description
77
+ agents_chain.append(agent[0])
78
+ self._chain = agents_chain
79
+
80
+ @t.override
81
+ def get_tools(self) -> list[BaseTool]:
82
+ if self._chain is None:
83
+ raise RuntimeError("Must initialize the toolkit first")
84
+
85
+ return [
86
+ ChainTool(
87
+ client=RunClient(self.client),
88
+ name=agent.metadata.name,
89
+ description=agent.spec.description or "",
90
+ args_schema=ChainInput,
91
+ )
92
+ for agent in self._chain
93
+ ]
@@ -18,7 +18,7 @@ from langgraph.checkpoint.memory import MemorySaver
18
18
  from langgraph.prebuilt import create_react_agent
19
19
 
20
20
  from .chat import get_chat_model
21
-
21
+ from .chain import ChainToolkit
22
22
 
23
23
  def get_functions(dir="src/functions", from_decorator="function"):
24
24
  functions = []
@@ -178,7 +178,6 @@ def agent(
178
178
  logger.warn(f"Failed to initialize MCP server {server}: {e!s}")
179
179
 
180
180
  if remote_functions:
181
-
182
181
  for function in remote_functions:
183
182
  try:
184
183
  toolkit = RemoteToolkit(client, function)
@@ -187,6 +186,11 @@ def agent(
187
186
  except Exception as e:
188
187
  logger.warn(f"Failed to initialize remote function {function}: {e!s}")
189
188
 
189
+ if agent.spec.agent_chain:
190
+ toolkit = ChainToolkit(client, agent.spec.agent_chain)
191
+ toolkit.initialize()
192
+ functions.extend(toolkit.get_tools())
193
+
190
194
  if override_agent is None and len(functions) == 0:
191
195
  raise ValueError(
192
196
  "You must define at least one function, you can define this function in directory "
@@ -47,15 +47,15 @@ def new_client_from_settings(settings: Settings):
47
47
 
48
48
 
49
49
  def new_client():
50
+ settings = get_settings()
50
51
  context = current_context()
51
- if context.workspace:
52
+ if context.workspace and not settings.authentication.client.credentials:
52
53
  credentials = load_credentials(context.workspace)
53
54
  client_config = RunClientWithCredentials(
54
55
  credentials=credentials,
55
56
  workspace=context.workspace,
56
57
  )
57
58
  else:
58
- settings = get_settings()
59
59
  credentials = load_credentials_from_settings(settings)
60
60
  client_config = RunClientWithCredentials(
61
61
  credentials=credentials,
@@ -80,7 +80,7 @@ def new_client_with_credentials(config: RunClientWithCredentials):
80
80
 
81
81
  def get_authentication_headers(settings: Settings) -> Dict[str, str]:
82
82
  context = current_context()
83
- if context.workspace:
83
+ if context.workspace and not settings.authentication.client.credentials:
84
84
  credentials = load_credentials(context.workspace)
85
85
  else:
86
86
  settings = get_settings()
@@ -37,7 +37,7 @@ class ClientCredentials(Auth):
37
37
  def refresh_if_needed(self) -> Optional[Exception]:
38
38
  settings = get_settings()
39
39
  if self.credentials.client_credentials and not self.credentials.refresh_token:
40
- headers = {"Authorization": f"Basic {self.credentials.client_credentials}"}
40
+ headers = {"Authorization": f"Basic {self.credentials.client_credentials}", "Content-Type": "application/json"}
41
41
  body = {"grant_type": "client_credentials"}
42
42
  response = requests.post(f"{settings.base_url}/oauth/token", headers=headers, json=body)
43
43
  response.raise_for_status()
@@ -18,11 +18,6 @@ from pydantic_settings import (BaseSettings, PydanticBaseSettingsSource,
18
18
  global SETTINGS
19
19
  SETTINGS = None
20
20
 
21
-
22
- def get_settings():
23
- return SETTINGS
24
-
25
-
26
21
  class SettingsAgent(BaseSettings):
27
22
  agent: Union[None, CompiledGraph, BaseChatModel] = None
28
23
  chain: Union[Unset, list[Agent]] = UNSET
@@ -96,6 +91,9 @@ class Settings(BaseSettings):
96
91
  init_settings,
97
92
  )
98
93
 
94
+ def get_settings() -> Settings:
95
+ return SETTINGS
96
+
99
97
 
100
98
  def init_agent(
101
99
  client: AuthenticatedClient,
@@ -11,26 +11,35 @@ from beamlit.authentication.authentication import AuthenticatedClient
11
11
  from beamlit.common.settings import get_settings
12
12
  from langchain_core.tools.base import BaseTool, BaseToolkit, ToolException
13
13
  from mcp import ListToolsResult
14
- from pydantic.json_schema import JsonSchemaValue
15
- from pydantic_core import core_schema as cs
16
14
 
17
15
  settings = get_settings()
18
16
 
17
+ def create_dynamic_schema(name: str, schema: dict[str, t.Any]) -> type[pydantic.BaseModel]:
18
+ field_definitions = {}
19
+ for k, v in schema["properties"].items():
20
+ field_type = str
21
+ if v["type"] == "number":
22
+ field_type = float
23
+ elif v["type"] == "integer":
24
+ field_type = int
25
+ elif v["type"] == "boolean":
26
+ field_type = bool
27
+ description = v.get("description") or ""
28
+ default_ = v.get("default")
29
+ fields = {}
30
+ if default_ is not None:
31
+ fields["default"] = default_
32
+ if description is not None:
33
+ fields["description"] = description
34
+ field_definitions[k] = (
35
+ field_type,
36
+ pydantic.Field(**fields)
37
+ )
38
+ return pydantic.create_model(
39
+ f"{name}Schema",
40
+ **field_definitions
41
+ )
19
42
 
20
- def create_schema_model(schema: dict[str, t.Any]) -> type[pydantic.BaseModel]:
21
- # Create a new model class that returns our JSON schema.
22
- # LangChain requires a BaseModel class.
23
- class Schema(pydantic.BaseModel):
24
- model_config = pydantic.ConfigDict(extra="allow")
25
-
26
- @t.override
27
- @classmethod
28
- def __get_pydantic_json_schema__(
29
- cls, core_schema: cs.CoreSchema, handler: pydantic.GetJsonSchemaHandler
30
- ) -> JsonSchemaValue:
31
- return schema
32
-
33
- return Schema
34
43
 
35
44
 
36
45
  class MCPClient:
@@ -42,7 +51,6 @@ class MCPClient:
42
51
  def list_tools(self) -> requests.Response:
43
52
  client = self.client.get_httpx_client()
44
53
  url = urllib.parse.urljoin(settings.mcp_hub_url, f"{self.server_name}/tools/list")
45
-
46
54
  response = client.request("GET", url, headers=self.headers)
47
55
  response.raise_for_status()
48
56
  return response
@@ -118,7 +126,7 @@ class MCPToolkit(BaseToolkit):
118
126
  client=self.client,
119
127
  name=tool.name,
120
128
  description=tool.description or "",
121
- args_schema=create_schema_model(tool.inputSchema),
129
+ args_schema=create_dynamic_schema(tool.name, tool.inputSchema),
122
130
  )
123
131
  # list_tools returns a PaginatedResult, but I don't see a way to pass the cursor to retrieve more tools
124
132
  for tool in self._tools.tools
@@ -0,0 +1,122 @@
1
+ import asyncio
2
+ import warnings
3
+ from dataclasses import dataclass
4
+ from typing import Callable, Literal
5
+
6
+ import pydantic
7
+ import typing_extensions as t
8
+ from beamlit.api.functions import get_function
9
+ from beamlit.authentication.authentication import AuthenticatedClient
10
+ from beamlit.common.settings import get_settings
11
+ from beamlit.models import Function, StoreFunctionParameter
12
+ from beamlit.run import RunClient
13
+ from langchain_core.tools.base import BaseTool, ToolException
14
+
15
+
16
+ def create_dynamic_schema(name: str, parameters: list[StoreFunctionParameter]) -> type[pydantic.BaseModel]:
17
+ field_definitions = {}
18
+ for param in parameters:
19
+ field_type = str
20
+ if param.type_ == "number":
21
+ field_type = float
22
+ elif param.type_ == "integer":
23
+ field_type = int
24
+ elif param.type_ == "boolean":
25
+ field_type = bool
26
+
27
+ field_definitions[param.name] = (
28
+ field_type,
29
+ pydantic.Field(description=param.description or "")
30
+ )
31
+ return pydantic.create_model(
32
+ f"{name}Schema",
33
+ **field_definitions
34
+ )
35
+
36
+
37
+ class RemoteTool(BaseTool):
38
+ """
39
+ Remote tool
40
+ """
41
+
42
+ client: RunClient
43
+ resource_name: str
44
+ kit: bool = False
45
+ handle_tool_error: bool | str | Callable[[ToolException], str] | None = True
46
+
47
+ @t.override
48
+ def _run(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
49
+ warnings.warn(
50
+ "Invoke this tool asynchronousely using `ainvoke`. This method exists only to satisfy standard tests.",
51
+ stacklevel=1,
52
+ )
53
+ return asyncio.run(self._arun(*args, **kwargs))
54
+
55
+ @t.override
56
+ async def _arun(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
57
+ settings = get_settings()
58
+ body = {**kwargs}
59
+ if self.kit:
60
+ body["name"] = self.name
61
+ result = self.client.run(
62
+ "function",
63
+ self.resource_name,
64
+ settings.environment,
65
+ "POST",
66
+ json=body
67
+ )
68
+ return result.text
69
+
70
+ @t.override
71
+ @property
72
+ def tool_call_schema(self) -> type[pydantic.BaseModel]:
73
+ assert self.args_schema is not None # noqa: S101
74
+ return self.args_schema
75
+
76
+ @dataclass
77
+ class RemoteToolkit:
78
+ """
79
+ Remote toolkit
80
+ """
81
+
82
+ client: AuthenticatedClient
83
+ function: str
84
+ _function: Function | None = None
85
+
86
+ model_config = pydantic.ConfigDict(arbitrary_types_allowed=True)
87
+
88
+ def initialize(self) -> None:
89
+ """Initialize the session and retrieve tools list"""
90
+ if self._function is None:
91
+ self._function = get_function.sync_detailed(self.function, client=self.client).parsed
92
+
93
+ @t.override
94
+ def get_tools(self) -> list[BaseTool]:
95
+ if self._function is None:
96
+ raise RuntimeError("Must initialize the toolkit first")
97
+
98
+ if self._function.spec.kit:
99
+ return [
100
+ RemoteTool(
101
+ client=RunClient(self.client),
102
+ name=func.name,
103
+ resource_name=self._function.metadata.name,
104
+ kit=True,
105
+ description=func.description or "",
106
+ args_schema=create_dynamic_schema(func.name, func.parameters),
107
+ )
108
+ for func in self._function.spec.kit
109
+ ]
110
+
111
+ return [
112
+ RemoteTool(
113
+ client=RunClient(self.client),
114
+ name=self._function.metadata.name,
115
+ resource_name=self._function.metadata.name,
116
+ description=self._function.spec.description or "",
117
+ args_schema=create_dynamic_schema(
118
+ self._function.metadata.name,
119
+ self._function.spec.parameters
120
+ ),
121
+ )
122
+ ]
@@ -1,103 +0,0 @@
1
- import asyncio
2
- import urllib.parse
3
- import warnings
4
- from typing import Any, Callable
5
-
6
- import pydantic
7
- import pydantic_core
8
- import typing_extensions as t
9
- from beamlit.api.functions import get_function
10
- from beamlit.authentication.authentication import AuthenticatedClient
11
- from beamlit.models.function import Function
12
- from langchain_core.tools.base import BaseTool, BaseToolkit, ToolException
13
- from pydantic.json_schema import JsonSchemaValue
14
- from pydantic_core import core_schema as cs
15
-
16
-
17
- def create_schema_model(schema: dict[str, t.Any]) -> type[pydantic.BaseModel]:
18
- # Create a new model class that returns our JSON schema.
19
- # LangChain requires a BaseModel class.
20
- class Schema(pydantic.BaseModel):
21
- model_config = pydantic.ConfigDict(extra="allow")
22
-
23
- @t.override
24
- @classmethod
25
- def __get_pydantic_json_schema__(
26
- cls, core_schema: cs.CoreSchema, handler: pydantic.GetJsonSchemaHandler
27
- ) -> JsonSchemaValue:
28
- return schema
29
-
30
- return Schema
31
-
32
-
33
- class RemoteTool(BaseTool):
34
- """
35
- Remote tool
36
- """
37
-
38
- client: AuthenticatedClient
39
- handle_tool_error: bool | str | Callable[[ToolException], str] | None = True
40
-
41
- @t.override
42
- def _run(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
43
- warnings.warn(
44
- "Invoke this tool asynchronousely using `ainvoke`. This method exists only to satisfy standard tests.",
45
- stacklevel=1,
46
- )
47
- return asyncio.run(self._arun(*args, **kwargs))
48
-
49
- @t.override
50
- async def _arun(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
51
- result = self.client.call_tool(self.name, arguments=kwargs)
52
- response = result.json()
53
- content = pydantic_core.to_json(response["content"]).decode()
54
- if response["isError"]:
55
- raise ToolException(content)
56
- return content
57
-
58
- @t.override
59
- @property
60
- def tool_call_schema(self) -> type[pydantic.BaseModel]:
61
- assert self.args_schema is not None # noqa: S101
62
- return self.args_schema
63
-
64
- class RemoteToolkit(BaseToolkit):
65
- """
66
- Remote toolkit
67
- """
68
-
69
- client: AuthenticatedClient
70
- function: str
71
- _function: Function | None = None
72
-
73
- model_config = pydantic.ConfigDict(arbitrary_types_allowed=True)
74
-
75
- def initialize(self) -> None:
76
- """Initialize the session and retrieve tools list"""
77
- if self._function is None:
78
- self._function = get_function(self.function, client=self.client)
79
-
80
- @t.override
81
- def get_tools(self) -> list[BaseTool]:
82
- if self._tools is None:
83
- raise RuntimeError("Must initialize the toolkit first")
84
-
85
- if self._function.spec.kit:
86
- return [
87
- RemoteTool(
88
- client=self.client,
89
- name=func.name,
90
- description=func.description or "",
91
- args_schema=create_schema_model(func.parameters),
92
- )
93
- for func in self._function.spec.kit
94
- ]
95
-
96
- return [
97
- RemoteTool(
98
- client=self.client,
99
- name=self._function.metadata.name,
100
- description=self._function.spec.description or "",
101
- args_schema=create_schema_model(self._function.spec.parameters),
102
- )
103
- ]
File without changes
File without changes
File without changes