beamlit 0.0.54rc101__py3-none-any.whl → 0.0.55__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. beamlit/agents/chain.py +2 -1
  2. beamlit/agents/chat.py +2 -1
  3. beamlit/agents/decorator.py +3 -2
  4. beamlit/api/integrations/get_integration_connection_model.py +2 -2
  5. beamlit/api/integrations/{list_integration_models.py → get_integration_connection_model_endpoint_configurations.py} +12 -12
  6. beamlit/api/{default/create_account.py → knowledgebases/create_knowledgebase.py} +30 -30
  7. beamlit/api/{accounts/delete_account.py → knowledgebases/delete_knowledgebase.py} +57 -43
  8. beamlit/api/{accounts/get_account.py → knowledgebases/get_knowledgebase.py} +56 -35
  9. beamlit/api/{accounts/list_accounts.py → knowledgebases/list_knowledgebases.py} +57 -25
  10. beamlit/api/{accounts/update_account.py → knowledgebases/update_knowledgebase.py} +43 -43
  11. beamlit/deploy/deploy.py +2 -0
  12. beamlit/deploy/format.py +1 -68
  13. beamlit/models/__init__.py +8 -10
  14. beamlit/models/agent_chain.py +9 -0
  15. beamlit/models/agent_spec.py +10 -1
  16. beamlit/models/integration_model.py +27 -9
  17. beamlit/models/knowledgebase.py +126 -0
  18. beamlit/models/knowledgebase_release.py +70 -0
  19. beamlit/models/knowledgebase_spec.py +143 -0
  20. beamlit/models/{account_spec_address.py → knowledgebase_spec_options.py} +6 -6
  21. beamlit/models/model_spec.py +9 -0
  22. beamlit/models/runtime.py +21 -2
  23. beamlit/models/store_agent.py +9 -0
  24. {beamlit-0.0.54rc101.dist-info → beamlit-0.0.55.dist-info}/METADATA +1 -1
  25. {beamlit-0.0.54rc101.dist-info → beamlit-0.0.55.dist-info}/RECORD +29 -31
  26. beamlit/api/integrations/get_integration_model.py +0 -104
  27. beamlit/models/account.py +0 -224
  28. beamlit/models/account_metadata.py +0 -121
  29. beamlit/models/account_spec.py +0 -123
  30. beamlit/models/billing_address.py +0 -133
  31. /beamlit/api/{accounts → knowledgebases}/__init__.py +0 -0
  32. {beamlit-0.0.54rc101.dist-info → beamlit-0.0.55.dist-info}/WHEEL +0 -0
  33. {beamlit-0.0.54rc101.dist-info → beamlit-0.0.55.dist-info}/entry_points.txt +0 -0
  34. {beamlit-0.0.54rc101.dist-info → beamlit-0.0.55.dist-info}/licenses/LICENSE +0 -0
beamlit/agents/chain.py CHANGED
@@ -112,6 +112,7 @@ class ChainToolkit:
112
112
  for chain in chain_enabled:
113
113
  agent = [agent for agent in agents if agent.metadata.name == chain.name]
114
114
  if agent:
115
+ agent[0].spec.prompt = chain.prompt or agent[0].spec.prompt
115
116
  agent[0].spec.description = chain.description or agent[0].spec.description
116
117
  agents_chain.append(agent[0])
117
118
  self._chain = agents_chain
@@ -133,7 +134,7 @@ class ChainToolkit:
133
134
  ChainTool(
134
135
  client=RunClient(self.client),
135
136
  name=agent.metadata.name,
136
- description=agent.spec.description or "",
137
+ description=agent.spec.description or agent.spec.prompt or "",
137
138
  args_schema=ChainInput,
138
139
  )
139
140
  for agent in self._chain
beamlit/agents/chat.py CHANGED
@@ -1,11 +1,12 @@
1
1
  from logging import getLogger
2
2
  from typing import Tuple, Union
3
3
 
4
+ from langchain_core.language_models import BaseChatModel
5
+
4
6
  from beamlit.api.models import get_model
5
7
  from beamlit.authentication import get_authentication_headers, new_client
6
8
  from beamlit.common.settings import get_settings
7
9
  from beamlit.models import Model
8
- from langchain_core.language_models import BaseChatModel
9
10
 
10
11
  from .voice.openai import OpenAIVoiceReactAgent
11
12
 
@@ -160,6 +160,7 @@ def agent(
160
160
  ' "spec": {\n'
161
161
  ' "model": "MODEL_NAME",\n'
162
162
  f' "description": "{agent.spec.description}",\n'
163
+ f' "prompt": "{agent.spec.prompt}",\n'
163
164
  " },\n"
164
165
  "}")
165
166
  if isinstance(chat_model, OpenAIVoiceReactAgent):
@@ -174,10 +175,10 @@ def agent(
174
175
  "def hello_world(query: str):\n"
175
176
  " return 'Hello, world!'\n")
176
177
  try:
177
- _agent = create_react_agent(chat_model, functions, checkpointer=memory)
178
+ _agent = create_react_agent(chat_model, functions, checkpointer=memory, state_modifier=agent.spec.prompt or "")
178
179
  except AttributeError: # special case for azure-marketplace where it uses the old OpenAI interface (no tools)
179
180
  logger.warning("Using the old OpenAI interface for Azure Marketplace, no tools available")
180
- _agent = create_react_agent(chat_model, [], checkpointer=memory)
181
+ _agent = create_react_agent(chat_model, [], checkpointer=memory, state_modifier=agent.spec.prompt or "")
181
182
 
182
183
  settings.agent.agent = _agent
183
184
  else:
@@ -44,7 +44,7 @@ def sync_detailed(
44
44
  *,
45
45
  client: AuthenticatedClient,
46
46
  ) -> Response[Any]:
47
- """List integration connection models
47
+ """Get integration model endpoint configurations
48
48
 
49
49
  Returns a model for an integration connection by ID.
50
50
 
@@ -78,7 +78,7 @@ async def asyncio_detailed(
78
78
  *,
79
79
  client: AuthenticatedClient,
80
80
  ) -> Response[Any]:
81
- """List integration connection models
81
+ """Get integration model endpoint configurations
82
82
 
83
83
  Returns a model for an integration connection by ID.
84
84
 
@@ -9,11 +9,11 @@ from ...types import Response
9
9
 
10
10
 
11
11
  def _get_kwargs(
12
- integration_name: str,
12
+ connection_name: str,
13
13
  ) -> dict[str, Any]:
14
14
  _kwargs: dict[str, Any] = {
15
15
  "method": "get",
16
- "url": f"/integrations/{integration_name}/models",
16
+ "url": f"/integrations/connections/{connection_name}/endpointConfigurations",
17
17
  }
18
18
 
19
19
  return _kwargs
@@ -38,16 +38,16 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
38
38
 
39
39
 
40
40
  def sync_detailed(
41
- integration_name: str,
41
+ connection_name: str,
42
42
  *,
43
43
  client: AuthenticatedClient,
44
44
  ) -> Response[Any]:
45
- """List integration models
45
+ """Get integration connection model endpoint configurations
46
46
 
47
- Returns a list of all models for an integration.
47
+ Returns a list of all endpoint configurations for a model.
48
48
 
49
49
  Args:
50
- integration_name (str):
50
+ connection_name (str):
51
51
 
52
52
  Raises:
53
53
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -58,7 +58,7 @@ def sync_detailed(
58
58
  """
59
59
 
60
60
  kwargs = _get_kwargs(
61
- integration_name=integration_name,
61
+ connection_name=connection_name,
62
62
  )
63
63
 
64
64
  response = client.get_httpx_client().request(
@@ -69,16 +69,16 @@ def sync_detailed(
69
69
 
70
70
 
71
71
  async def asyncio_detailed(
72
- integration_name: str,
72
+ connection_name: str,
73
73
  *,
74
74
  client: AuthenticatedClient,
75
75
  ) -> Response[Any]:
76
- """List integration models
76
+ """Get integration connection model endpoint configurations
77
77
 
78
- Returns a list of all models for an integration.
78
+ Returns a list of all endpoint configurations for a model.
79
79
 
80
80
  Args:
81
- integration_name (str):
81
+ connection_name (str):
82
82
 
83
83
  Raises:
84
84
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -89,7 +89,7 @@ async def asyncio_detailed(
89
89
  """
90
90
 
91
91
  kwargs = _get_kwargs(
92
- integration_name=integration_name,
92
+ connection_name=connection_name,
93
93
  )
94
94
 
95
95
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -5,19 +5,19 @@ import httpx
5
5
 
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
- from ...models.account import Account
8
+ from ...models.knowledgebase import Knowledgebase
9
9
  from ...types import Response
10
10
 
11
11
 
12
12
  def _get_kwargs(
13
13
  *,
14
- body: Account,
14
+ body: Knowledgebase,
15
15
  ) -> dict[str, Any]:
16
16
  headers: dict[str, Any] = {}
17
17
 
18
18
  _kwargs: dict[str, Any] = {
19
19
  "method": "post",
20
- "url": "/accounts",
20
+ "url": "/knowledgebases",
21
21
  }
22
22
 
23
23
  _body = body.to_dict()
@@ -29,9 +29,9 @@ def _get_kwargs(
29
29
  return _kwargs
30
30
 
31
31
 
32
- def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Account]:
32
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Knowledgebase]:
33
33
  if response.status_code == 200:
34
- response_200 = Account.from_dict(response.json())
34
+ response_200 = Knowledgebase.from_dict(response.json())
35
35
 
36
36
  return response_200
37
37
  if client.raise_on_unexpected_status:
@@ -40,7 +40,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
40
40
  return None
41
41
 
42
42
 
43
- def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Account]:
43
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Knowledgebase]:
44
44
  return Response(
45
45
  status_code=HTTPStatus(response.status_code),
46
46
  content=response.content,
@@ -52,21 +52,21 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
52
52
  def sync_detailed(
53
53
  *,
54
54
  client: AuthenticatedClient,
55
- body: Account,
56
- ) -> Response[Account]:
57
- """Create account
55
+ body: Knowledgebase,
56
+ ) -> Response[Knowledgebase]:
57
+ """Create environment
58
58
 
59
- Creates an account.
59
+ Creates an knowledgebase.
60
60
 
61
61
  Args:
62
- body (Account): Account
62
+ body (Knowledgebase): Knowledgebase
63
63
 
64
64
  Raises:
65
65
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
66
66
  httpx.TimeoutException: If the request takes longer than Client.timeout.
67
67
 
68
68
  Returns:
69
- Response[Account]
69
+ Response[Knowledgebase]
70
70
  """
71
71
 
72
72
  kwargs = _get_kwargs(
@@ -83,21 +83,21 @@ def sync_detailed(
83
83
  def sync(
84
84
  *,
85
85
  client: AuthenticatedClient,
86
- body: Account,
87
- ) -> Optional[Account]:
88
- """Create account
86
+ body: Knowledgebase,
87
+ ) -> Optional[Knowledgebase]:
88
+ """Create environment
89
89
 
90
- Creates an account.
90
+ Creates an knowledgebase.
91
91
 
92
92
  Args:
93
- body (Account): Account
93
+ body (Knowledgebase): Knowledgebase
94
94
 
95
95
  Raises:
96
96
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
97
  httpx.TimeoutException: If the request takes longer than Client.timeout.
98
98
 
99
99
  Returns:
100
- Account
100
+ Knowledgebase
101
101
  """
102
102
 
103
103
  return sync_detailed(
@@ -109,21 +109,21 @@ def sync(
109
109
  async def asyncio_detailed(
110
110
  *,
111
111
  client: AuthenticatedClient,
112
- body: Account,
113
- ) -> Response[Account]:
114
- """Create account
112
+ body: Knowledgebase,
113
+ ) -> Response[Knowledgebase]:
114
+ """Create environment
115
115
 
116
- Creates an account.
116
+ Creates an knowledgebase.
117
117
 
118
118
  Args:
119
- body (Account): Account
119
+ body (Knowledgebase): Knowledgebase
120
120
 
121
121
  Raises:
122
122
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
123
123
  httpx.TimeoutException: If the request takes longer than Client.timeout.
124
124
 
125
125
  Returns:
126
- Response[Account]
126
+ Response[Knowledgebase]
127
127
  """
128
128
 
129
129
  kwargs = _get_kwargs(
@@ -138,21 +138,21 @@ async def asyncio_detailed(
138
138
  async def asyncio(
139
139
  *,
140
140
  client: AuthenticatedClient,
141
- body: Account,
142
- ) -> Optional[Account]:
143
- """Create account
141
+ body: Knowledgebase,
142
+ ) -> Optional[Knowledgebase]:
143
+ """Create environment
144
144
 
145
- Creates an account.
145
+ Creates an knowledgebase.
146
146
 
147
147
  Args:
148
- body (Account): Account
148
+ body (Knowledgebase): Knowledgebase
149
149
 
150
150
  Raises:
151
151
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
152
152
  httpx.TimeoutException: If the request takes longer than Client.timeout.
153
153
 
154
154
  Returns:
155
- Account
155
+ Knowledgebase
156
156
  """
157
157
 
158
158
  return (
@@ -1,44 +1,46 @@
1
1
  from http import HTTPStatus
2
- from typing import Any, Optional, Union, cast
2
+ from typing import Any, Optional, Union
3
3
 
4
4
  import httpx
5
5
 
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
- from ...models.account import Account
9
- from ...types import Response
8
+ from ...models.knowledgebase import Knowledgebase
9
+ from ...types import UNSET, Response, Unset
10
10
 
11
11
 
12
12
  def _get_kwargs(
13
- account_id: str,
13
+ knowledgebase_id: str,
14
+ *,
15
+ environment: Union[Unset, str] = UNSET,
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
- "url": f"/accounts/{account_id}",
25
+ "url": f"/knowledgebases/{knowledgebase_id}",
26
+ "params": params,
18
27
  }
19
28
 
20
29
  return _kwargs
21
30
 
22
31
 
23
- def _parse_response(
24
- *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25
- ) -> Optional[Union[Account, Any]]:
32
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Knowledgebase]:
26
33
  if response.status_code == 200:
27
- response_200 = Account.from_dict(response.json())
34
+ response_200 = Knowledgebase.from_dict(response.json())
28
35
 
29
36
  return response_200
30
- if response.status_code == 404:
31
- response_404 = cast(Any, None)
32
- return response_404
33
37
  if client.raise_on_unexpected_status:
34
38
  raise errors.UnexpectedStatus(response.status_code, response.content)
35
39
  else:
36
40
  return None
37
41
 
38
42
 
39
- def _build_response(
40
- *, client: Union[AuthenticatedClient, Client], response: httpx.Response
41
- ) -> Response[Union[Account, Any]]:
43
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Knowledgebase]:
42
44
  return Response(
43
45
  status_code=HTTPStatus(response.status_code),
44
46
  content=response.content,
@@ -48,27 +50,30 @@ def _build_response(
48
50
 
49
51
 
50
52
  def sync_detailed(
51
- account_id: str,
53
+ knowledgebase_id: str,
52
54
  *,
53
55
  client: AuthenticatedClient,
54
- ) -> Response[Union[Account, Any]]:
55
- """Delete account
56
+ environment: Union[Unset, str] = UNSET,
57
+ ) -> Response[Knowledgebase]:
58
+ """Delete environment
56
59
 
57
- Deletes an account by name.
60
+ Deletes an knowledgebase by ID.
58
61
 
59
62
  Args:
60
- account_id (str):
63
+ knowledgebase_id (str):
64
+ environment (Union[Unset, str]):
61
65
 
62
66
  Raises:
63
67
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
64
68
  httpx.TimeoutException: If the request takes longer than Client.timeout.
65
69
 
66
70
  Returns:
67
- Response[Union[Account, Any]]
71
+ Response[Knowledgebase]
68
72
  """
69
73
 
70
74
  kwargs = _get_kwargs(
71
- account_id=account_id,
75
+ knowledgebase_id=knowledgebase_id,
76
+ environment=environment,
72
77
  )
73
78
 
74
79
  response = client.get_httpx_client().request(
@@ -79,53 +84,59 @@ def sync_detailed(
79
84
 
80
85
 
81
86
  def sync(
82
- account_id: str,
87
+ knowledgebase_id: str,
83
88
  *,
84
89
  client: AuthenticatedClient,
85
- ) -> Optional[Union[Account, Any]]:
86
- """Delete account
90
+ environment: Union[Unset, str] = UNSET,
91
+ ) -> Optional[Knowledgebase]:
92
+ """Delete environment
87
93
 
88
- Deletes an account by name.
94
+ Deletes an knowledgebase by ID.
89
95
 
90
96
  Args:
91
- account_id (str):
97
+ knowledgebase_id (str):
98
+ environment (Union[Unset, str]):
92
99
 
93
100
  Raises:
94
101
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95
102
  httpx.TimeoutException: If the request takes longer than Client.timeout.
96
103
 
97
104
  Returns:
98
- Union[Account, Any]
105
+ Knowledgebase
99
106
  """
100
107
 
101
108
  return sync_detailed(
102
- account_id=account_id,
109
+ knowledgebase_id=knowledgebase_id,
103
110
  client=client,
111
+ environment=environment,
104
112
  ).parsed
105
113
 
106
114
 
107
115
  async def asyncio_detailed(
108
- account_id: str,
116
+ knowledgebase_id: str,
109
117
  *,
110
118
  client: AuthenticatedClient,
111
- ) -> Response[Union[Account, Any]]:
112
- """Delete account
119
+ environment: Union[Unset, str] = UNSET,
120
+ ) -> Response[Knowledgebase]:
121
+ """Delete environment
113
122
 
114
- Deletes an account by name.
123
+ Deletes an knowledgebase by ID.
115
124
 
116
125
  Args:
117
- account_id (str):
126
+ knowledgebase_id (str):
127
+ environment (Union[Unset, str]):
118
128
 
119
129
  Raises:
120
130
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
121
131
  httpx.TimeoutException: If the request takes longer than Client.timeout.
122
132
 
123
133
  Returns:
124
- Response[Union[Account, Any]]
134
+ Response[Knowledgebase]
125
135
  """
126
136
 
127
137
  kwargs = _get_kwargs(
128
- account_id=account_id,
138
+ knowledgebase_id=knowledgebase_id,
139
+ environment=environment,
129
140
  )
130
141
 
131
142
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -134,28 +145,31 @@ async def asyncio_detailed(
134
145
 
135
146
 
136
147
  async def asyncio(
137
- account_id: str,
148
+ knowledgebase_id: str,
138
149
  *,
139
150
  client: AuthenticatedClient,
140
- ) -> Optional[Union[Account, Any]]:
141
- """Delete account
151
+ environment: Union[Unset, str] = UNSET,
152
+ ) -> Optional[Knowledgebase]:
153
+ """Delete environment
142
154
 
143
- Deletes an account by name.
155
+ Deletes an knowledgebase by ID.
144
156
 
145
157
  Args:
146
- account_id (str):
158
+ knowledgebase_id (str):
159
+ environment (Union[Unset, str]):
147
160
 
148
161
  Raises:
149
162
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
150
163
  httpx.TimeoutException: If the request takes longer than Client.timeout.
151
164
 
152
165
  Returns:
153
- Union[Account, Any]
166
+ Knowledgebase
154
167
  """
155
168
 
156
169
  return (
157
170
  await asyncio_detailed(
158
- account_id=account_id,
171
+ knowledgebase_id=knowledgebase_id,
159
172
  client=client,
173
+ environment=environment,
160
174
  )
161
175
  ).parsed