cheshirecat-python-sdk 1.2.1__py3-none-any.whl → 1.7.9__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 (47) hide show
  1. cheshirecat_python_sdk/__init__.py +0 -1
  2. cheshirecat_python_sdk/builders/memory.py +0 -12
  3. cheshirecat_python_sdk/builders/why.py +0 -6
  4. cheshirecat_python_sdk/client.py +30 -5
  5. cheshirecat_python_sdk/clients/http_client.py +21 -7
  6. cheshirecat_python_sdk/clients/websocket_client.py +21 -15
  7. cheshirecat_python_sdk/configuration.py +1 -1
  8. cheshirecat_python_sdk/endpoints/__init__.py +6 -1
  9. cheshirecat_python_sdk/endpoints/admins.py +37 -70
  10. cheshirecat_python_sdk/endpoints/auth.py +54 -0
  11. cheshirecat_python_sdk/endpoints/auth_handler.py +8 -8
  12. cheshirecat_python_sdk/endpoints/base.py +48 -17
  13. cheshirecat_python_sdk/endpoints/chunker.py +8 -8
  14. cheshirecat_python_sdk/endpoints/conversation.py +83 -0
  15. cheshirecat_python_sdk/endpoints/custom_endpoint.py +57 -0
  16. cheshirecat_python_sdk/endpoints/embedder.py +4 -4
  17. cheshirecat_python_sdk/endpoints/file_manager.py +59 -8
  18. cheshirecat_python_sdk/endpoints/health_check.py +22 -0
  19. cheshirecat_python_sdk/endpoints/large_language_model.py +8 -8
  20. cheshirecat_python_sdk/endpoints/memory.py +70 -145
  21. cheshirecat_python_sdk/endpoints/message.py +29 -13
  22. cheshirecat_python_sdk/endpoints/plugins.py +31 -26
  23. cheshirecat_python_sdk/endpoints/rabbit_hole.py +51 -23
  24. cheshirecat_python_sdk/endpoints/users.py +22 -56
  25. cheshirecat_python_sdk/endpoints/utils.py +71 -0
  26. cheshirecat_python_sdk/endpoints/vector_database.py +52 -0
  27. cheshirecat_python_sdk/enums.py +0 -11
  28. cheshirecat_python_sdk/models/api/admins.py +4 -0
  29. cheshirecat_python_sdk/models/api/conversations.py +24 -0
  30. cheshirecat_python_sdk/models/api/factories.py +6 -0
  31. cheshirecat_python_sdk/models/api/file_managers.py +18 -0
  32. cheshirecat_python_sdk/models/api/memories.py +2 -10
  33. cheshirecat_python_sdk/models/api/messages.py +8 -6
  34. cheshirecat_python_sdk/models/api/nested/memories.py +5 -5
  35. cheshirecat_python_sdk/models/api/nested/plugins.py +8 -2
  36. cheshirecat_python_sdk/models/api/plugins.py +30 -22
  37. cheshirecat_python_sdk/models/api/tokens.py +19 -0
  38. cheshirecat_python_sdk/models/api/users.py +2 -0
  39. cheshirecat_python_sdk/models/dtos.py +3 -13
  40. cheshirecat_python_sdk/utils.py +2 -1
  41. {cheshirecat_python_sdk-1.2.1.dist-info → cheshirecat_python_sdk-1.7.9.dist-info}/METADATA +12 -10
  42. cheshirecat_python_sdk-1.7.9.dist-info/RECORD +49 -0
  43. {cheshirecat_python_sdk-1.2.1.dist-info → cheshirecat_python_sdk-1.7.9.dist-info}/WHEEL +1 -1
  44. cheshirecat_python_sdk/endpoints/settings.py +0 -63
  45. cheshirecat_python_sdk/models/api/settings.py +0 -22
  46. cheshirecat_python_sdk-1.2.1.dist-info/RECORD +0 -43
  47. {cheshirecat_python_sdk-1.2.1.dist-info → cheshirecat_python_sdk-1.7.9.dist-info}/licenses/LICENSE +0 -0
@@ -2,6 +2,7 @@ from abc import ABC
2
2
  from typing import Dict, Any, List, Tuple, Type
3
3
  import requests
4
4
  from pydantic import BaseModel
5
+ from requests_toolbelt.sessions import BaseUrlSession
5
6
  from websockets import ClientConnection
6
7
 
7
8
  from cheshirecat_python_sdk.utils import T, deserialize
@@ -21,25 +22,34 @@ class AbstractEndpoint(ABC):
21
22
  def format_url(self, endpoint: str) -> str:
22
23
  return f"/{self.prefix}/{endpoint}".replace("//", "/")
23
24
 
24
- def get_http_client(self, agent_id: str | None = None, user_id: str | None = None) -> requests.Session:
25
- return self.client.http_client.get_client(agent_id, user_id)
25
+ def get_http_client(
26
+ self,
27
+ agent_id: str | None = None,
28
+ user_id: str | None = None,
29
+ chat_id: str | None = None,
30
+ ) -> requests.Session:
31
+ return self.client.http_client.get_client(agent_id, user_id, chat_id)
26
32
 
27
- async def get_ws_client(self, agent_id: str | None = None, user_id: str | None = None) -> ClientConnection:
28
- return await self.client.ws_client.get_client(agent_id, user_id)
33
+ def get_http_session(self) -> BaseUrlSession:
34
+ return self.client.http_client.get_base_session()
35
+
36
+ async def get_ws_client(self, agent_id: str, user_id: str, chat_id: str | None = None) -> ClientConnection:
37
+ return await self.client.ws_client.get_client(agent_id, user_id, chat_id)
29
38
 
30
39
  def get(
31
40
  self,
32
41
  endpoint: str,
42
+ agent_id: str,
33
43
  output_class: Type[T] | None = None,
34
- agent_id: str | None = None,
35
- user_id: str | None = None,
36
44
  query: Dict[str, Any] | None = None,
45
+ user_id: str | None = None,
37
46
  ) -> T:
38
47
  options = {}
39
48
  if query:
40
49
  options["params"] = query
41
50
 
42
51
  response = self.get_http_client(agent_id, user_id).get(endpoint, **options)
52
+ response.raise_for_status()
43
53
 
44
54
  if output_class is None:
45
55
  return response.json()
@@ -48,24 +58,29 @@ class AbstractEndpoint(ABC):
48
58
  def post_json(
49
59
  self,
50
60
  endpoint: str,
51
- output_class: Type[T],
61
+ agent_id: str,
62
+ output_class: Type[T] | None = None,
52
63
  payload: Dict[str, Any] | None = None,
53
- agent_id: str | None = None,
54
64
  user_id: str | None = None,
65
+ chat_id: str | None = None,
55
66
  ) -> T:
56
67
  options = {}
57
68
  if payload:
58
69
  options["json"] = payload
59
70
 
60
- response = self.get_http_client(agent_id, user_id).post(endpoint, **options)
71
+ response = self.get_http_client(agent_id, user_id, chat_id).post(endpoint, **options)
72
+ response.raise_for_status()
73
+
74
+ if output_class is None:
75
+ return response.json()
61
76
  return deserialize(response.json(), output_class)
62
77
 
63
78
  def post_multipart(
64
79
  self,
65
80
  endpoint: str,
66
- output_class: Type[T],
81
+ agent_id: str,
82
+ output_class: Type[T] | None = None,
67
83
  payload: MultipartPayload | None = None,
68
- agent_id: str | None = None,
69
84
  user_id: str | None = None,
70
85
  ) -> T:
71
86
  options = {}
@@ -75,24 +90,36 @@ class AbstractEndpoint(ABC):
75
90
  options["files"] = payload.files
76
91
 
77
92
  response = self.get_http_client(agent_id, user_id).post(endpoint, **options)
93
+ response.raise_for_status()
94
+
95
+ if output_class is None:
96
+ return response.json()
78
97
  return deserialize(response.json(), output_class)
79
98
 
80
99
  def put(
81
100
  self,
82
101
  endpoint: str,
83
- output_class: Type[T],
84
- payload: Dict[str, Any],
85
- agent_id: str | None = None,
102
+ agent_id: str,
103
+ output_class: Type[T] | None = None,
104
+ payload: Dict[str, Any] | None = None,
86
105
  user_id: str | None = None,
87
106
  ) -> T:
88
- response = self.get_http_client(agent_id, user_id).put(endpoint, json=payload)
107
+ options = {}
108
+ if payload:
109
+ options["json"] = payload
110
+
111
+ response = self.get_http_client(agent_id, user_id).put(endpoint, **options)
112
+ response.raise_for_status()
113
+
114
+ if output_class is None:
115
+ return response.json()
89
116
  return deserialize(response.json(), output_class)
90
117
 
91
118
  def delete(
92
119
  self,
93
120
  endpoint: str,
94
- output_class: Type[T],
95
- agent_id: str | None = None,
121
+ agent_id: str,
122
+ output_class: Type[T] | None = None,
96
123
  user_id: str | None = None,
97
124
  payload: Dict[str, Any] | None = None,
98
125
  ) -> T:
@@ -101,4 +128,8 @@ class AbstractEndpoint(ABC):
101
128
  options["json"] = payload
102
129
 
103
130
  response = self.get_http_client(agent_id, user_id).delete(endpoint, **options)
131
+ response.raise_for_status()
132
+
133
+ if output_class is None:
134
+ return response.json()
104
135
  return deserialize(response.json(), output_class)
@@ -9,7 +9,7 @@ class ChunkerEndpoint(AbstractEndpoint):
9
9
  super().__init__(client)
10
10
  self.prefix = "/chunking"
11
11
 
12
- def get_chunkers_settings(self, agent_id: str | None = None) -> FactoryObjectSettingsOutput:
12
+ def get_chunkers_settings(self, agent_id: str) -> FactoryObjectSettingsOutput:
13
13
  """
14
14
  Get all chunker settings for the agent specified by agent_id
15
15
  :param agent_id: The agent id
@@ -17,11 +17,11 @@ class ChunkerEndpoint(AbstractEndpoint):
17
17
  """
18
18
  return self.get(
19
19
  self.format_url("/settings"),
20
- FactoryObjectSettingsOutput,
21
20
  agent_id,
21
+ output_class=FactoryObjectSettingsOutput,
22
22
  )
23
23
 
24
- def get_chunker_settings(self, chunker: str, agent_id: str | None = None) -> FactoryObjectSettingOutput:
24
+ def get_chunker_settings(self, chunker: str, agent_id: str) -> FactoryObjectSettingOutput:
25
25
  """
26
26
  Get the chunker settings for the chunker specified by chunker and agent_id
27
27
  :param chunker: The name of the chunker
@@ -30,23 +30,23 @@ class ChunkerEndpoint(AbstractEndpoint):
30
30
  """
31
31
  return self.get(
32
32
  self.format_url(f"/settings/{chunker}"),
33
- FactoryObjectSettingOutput,
34
33
  agent_id,
34
+ output_class=FactoryObjectSettingOutput,
35
35
  )
36
36
 
37
37
  def put_chunker_settings(
38
- self, chunker: str, values: Dict[str, Any], agent_id: str | None = None
38
+ self, chunker: str, agent_id: str, values: Dict[str, Any]
39
39
  ) -> FactoryObjectSettingOutput:
40
40
  """
41
41
  Update the chunker settings for the chunker specified by chunker and agent_id
42
42
  :param chunker: The name of the chunker
43
- :param values: The new settings
44
43
  :param agent_id: The agent id
44
+ :param values: The new settings
45
45
  :return: FactoryObjectSettingOutput, the updated chunker settings
46
46
  """
47
47
  return self.put(
48
48
  self.format_url(f"/settings/{chunker}"),
49
- FactoryObjectSettingOutput,
50
- values,
51
49
  agent_id,
50
+ output_class=FactoryObjectSettingOutput,
51
+ payload=values,
52
52
  )
@@ -0,0 +1,83 @@
1
+ from typing import List
2
+
3
+ from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
+ from cheshirecat_python_sdk.models.api.conversations import (
5
+ ConversationHistoryOutput,
6
+ ConversationDeleteOutput,
7
+ ConversationsResponse,
8
+ ConversationNameChangeOutput,
9
+ )
10
+ from cheshirecat_python_sdk.utils import deserialize
11
+
12
+
13
+ class ConversationEndpoint(AbstractEndpoint):
14
+ def __init__(self, client: "CheshireCatClient"):
15
+ super().__init__(client)
16
+ self.prefix = "/conversation"
17
+
18
+ def get_conversation_history(self, agent_id: str, user_id: str, chat_id: str) -> ConversationHistoryOutput:
19
+ """
20
+ This endpoint returns the conversation history.
21
+ :param agent_id: The agent ID.
22
+ :param user_id: The user ID to filter the conversation history.
23
+ :param chat_id: The chat ID to filter the conversation history.
24
+ :return: ConversationHistoryOutput, a list of conversation history entries.
25
+ """
26
+ return self.get(
27
+ self.format_url(chat_id),
28
+ agent_id,
29
+ user_id=user_id,
30
+ output_class=ConversationHistoryOutput,
31
+ )
32
+
33
+ def get_conversations(self, agent_id: str, user_id: str) -> List[ConversationsResponse]:
34
+ """
35
+ This endpoint returns the attributes of the different conversations, given the `agent_id` and the `user_id`.
36
+ :param agent_id: The agent ID.
37
+ :param user_id: The user ID to filter the conversation history.
38
+ :return: List[ConversationsResponse], a list of conversation attributes.
39
+ """
40
+ response = self.get_http_client(agent_id, user_id).get(self.prefix)
41
+ response.raise_for_status()
42
+
43
+ return [deserialize(item, ConversationsResponse) for item in response.json()]
44
+
45
+ def delete_conversation(self, agent_id: str, user_id: str, chat_id: str) -> ConversationDeleteOutput:
46
+ """
47
+ This endpoint deletes the conversation.
48
+ :param agent_id: The agent ID.
49
+ :param user_id: The user ID to filter the conversation history.
50
+ :param chat_id: The chat ID to filter the conversation history.
51
+ :return: ConversationDeleteOutput, a message indicating whether the conversation was deleted.
52
+ """
53
+ return self.delete(
54
+ self.format_url(chat_id),
55
+ agent_id,
56
+ output_class=ConversationDeleteOutput,
57
+ user_id=user_id,
58
+ )
59
+
60
+ def post_conversation_name(
61
+ self,
62
+ name: str,
63
+ agent_id: str,
64
+ user_id: str,
65
+ chat_id: str,
66
+ ) -> ConversationNameChangeOutput:
67
+ """
68
+ This endpoint creates a new element in the conversation history.
69
+ :param name: The new name to assign to the conversation
70
+ :param agent_id: The agent ID.
71
+ :param user_id: The user ID to filter the conversation history.
72
+ :param chat_id: The chat ID to filter the conversation history.
73
+ :return: ConversationNameChangeOutput, a message indicating whether the conversation name was changed.
74
+ """
75
+ payload = {"name": name}
76
+
77
+ return self.post_json(
78
+ self.format_url(chat_id),
79
+ agent_id,
80
+ output_class=ConversationNameChangeOutput,
81
+ payload=payload,
82
+ user_id=user_id,
83
+ )
@@ -0,0 +1,57 @@
1
+ from typing import Any, Dict
2
+
3
+ from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
+
5
+
6
+ class CustomEndpoint(AbstractEndpoint):
7
+ def get_custom(
8
+ self, url: str, agent_id: str, user_id: str | None = None, query: Dict[str, Any] | None = None
9
+ ) -> Any:
10
+ """
11
+ This method is used to trigger a custom endpoint with GET method
12
+ :param url: The url of the custom endpoint to trigger
13
+ :param agent_id: The id of the agent to get settings for (optional)
14
+ :param user_id: The id of the user to get settings for (optional)
15
+ :param query: The query parameters to send to the custom endpoint (optional)
16
+ :return Any, the response from the custom endpoint
17
+ """
18
+ return self.get(url, agent_id, user_id=user_id, query=query)
19
+
20
+ def post_custom(
21
+ self, url: str, agent_id: str, payload: Dict[str, Any] | None = None, user_id: str | None = None
22
+ ) -> Any:
23
+ """
24
+ This method is used to trigger a custom endpoint with POST method
25
+ :param url: The url of the custom endpoint to trigger
26
+ :param agent_id: The id of the agent to get settings for (optional)
27
+ :param payload: The payload to send to the custom endpoint (optional)
28
+ :param user_id: The id of the user to get settings for (optional)
29
+ :return Any, the response from the custom endpoint
30
+ """
31
+ return self.post_json(url, agent_id, payload=payload, user_id=user_id)
32
+
33
+ def put_custom(
34
+ self, url: str, agent_id: str, payload: Dict[str, Any] | None = None, user_id: str | None = None
35
+ ) -> Any:
36
+ """
37
+ The method is used to trigger a custom endpoint with PUT method
38
+ :param url: The url of the custom endpoint to trigger
39
+ :param agent_id: The id of the agent to get settings for (optional)
40
+ :param payload: The payload to send to the custom endpoint (optional)
41
+ :param user_id: The id of the user to get settings for (optional)
42
+ :return Any, the response from the custom endpoint
43
+ """
44
+ return self.put(url, agent_id, payload=payload, user_id=user_id)
45
+
46
+ def delete_custom(
47
+ self, url: str, agent_id: str, payload: Dict[str, Any] | None = None, user_id: str | None = None
48
+ ) -> Any:
49
+ """
50
+ This method is used to trigger a custom endpoint with DELETE method
51
+ :param url: The url of the custom endpoint to trigger
52
+ :param agent_id: The id of the agent to get settings for (optional)
53
+ :param payload: The payload to send to the custom endpoint (optional)
54
+ :param user_id: The id of the user to get settings for (optional)
55
+ :return Any, the response from the custom endpoint
56
+ """
57
+ return self.delete(url, agent_id, payload=payload, user_id=user_id)
@@ -16,8 +16,8 @@ class EmbedderEndpoint(AbstractEndpoint):
16
16
  """
17
17
  return self.get(
18
18
  self.format_url("/settings"),
19
- FactoryObjectSettingsOutput,
20
19
  self.system_id,
20
+ output_class=FactoryObjectSettingsOutput,
21
21
  )
22
22
 
23
23
  def get_embedder_settings(self, embedder: str) -> FactoryObjectSettingOutput:
@@ -28,8 +28,8 @@ class EmbedderEndpoint(AbstractEndpoint):
28
28
  """
29
29
  return self.get(
30
30
  self.format_url(f"/settings/{embedder}"),
31
- FactoryObjectSettingOutput,
32
31
  self.system_id,
32
+ output_class=FactoryObjectSettingOutput,
33
33
  )
34
34
 
35
35
  def put_embedder_settings(self, embedder: str, values: Dict[str, Any]) -> FactoryObjectSettingOutput:
@@ -41,7 +41,7 @@ class EmbedderEndpoint(AbstractEndpoint):
41
41
  """
42
42
  return self.put(
43
43
  self.format_url(f"/settings/{embedder}"),
44
- FactoryObjectSettingOutput,
45
- values,
46
44
  self.system_id,
45
+ output_class=FactoryObjectSettingOutput,
46
+ payload=values,
47
47
  )
@@ -1,7 +1,9 @@
1
1
  from typing import Dict, Any
2
+ from requests import Response
2
3
 
3
4
  from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
5
  from cheshirecat_python_sdk.models.api.factories import FactoryObjectSettingOutput, FactoryObjectSettingsOutput
6
+ from cheshirecat_python_sdk.models.api.file_managers import FileManagerAttributes, FileManagerDeletedFiles
5
7
 
6
8
 
7
9
  class FileManagerEndpoint(AbstractEndpoint):
@@ -9,7 +11,7 @@ class FileManagerEndpoint(AbstractEndpoint):
9
11
  super().__init__(client)
10
12
  self.prefix = "/file_manager"
11
13
 
12
- def get_file_managers_settings(self, agent_id: str | None = None) -> FactoryObjectSettingsOutput:
14
+ def get_file_managers_settings(self, agent_id: str) -> FactoryObjectSettingsOutput:
13
15
  """
14
16
  Get all file managers settings for the agent specified by agent_id
15
17
  :param agent_id: The agent id
@@ -17,11 +19,11 @@ class FileManagerEndpoint(AbstractEndpoint):
17
19
  """
18
20
  return self.get(
19
21
  self.format_url("/settings"),
20
- FactoryObjectSettingsOutput,
21
22
  agent_id,
23
+ output_class=FactoryObjectSettingsOutput,
22
24
  )
23
25
 
24
- def get_file_manager_settings(self, file_manager: str, agent_id: str | None = None) -> FactoryObjectSettingOutput:
26
+ def get_file_manager_settings(self, file_manager: str, agent_id: str) -> FactoryObjectSettingOutput:
25
27
  """
26
28
  Get the settings of a file manager by name for the agent specified by agent_id
27
29
  :param file_manager: str, the name of the file manager
@@ -30,23 +32,72 @@ class FileManagerEndpoint(AbstractEndpoint):
30
32
  """
31
33
  return self.get(
32
34
  self.format_url(f"/settings/{file_manager}"),
33
- FactoryObjectSettingOutput,
34
35
  agent_id,
36
+ output_class=FactoryObjectSettingOutput,
35
37
  )
36
38
 
37
39
  def put_file_manager_settings(
38
- self, file_manager: str, values: Dict[str, Any], agent_id: str | None = None
40
+ self, file_manager: str, agent_id: str, values: Dict[str, Any]
39
41
  ) -> FactoryObjectSettingOutput:
40
42
  """
41
43
  Update the settings of a file manager by name with the given values, for the agent specified by agent_id
42
44
  :param file_manager: str, the name of the file manager
43
- :param values: Dict[str, Any], the values to update
44
45
  :param agent_id: The agent id
46
+ :param values: Dict[str, Any], the values to update
45
47
  :return: FactoryObjectSettingOutput, the updated settings of the file manager
46
48
  """
47
49
  return self.put(
48
50
  self.format_url(f"/settings/{file_manager}"),
49
- FactoryObjectSettingOutput,
50
- values,
51
51
  agent_id,
52
+ output_class=FactoryObjectSettingOutput,
53
+ payload=values,
54
+ )
55
+
56
+ def get_file_manager_attributes(self, agent_id: str) -> FileManagerAttributes:
57
+ """
58
+ Get the attributes of the file manager for the agent specified by agent_id
59
+ :param agent_id: The agent id
60
+ :return: FileManagerAttributes, the attributes of the file manager
61
+ """
62
+ return self.get(self.prefix, agent_id, output_class=FileManagerAttributes)
63
+
64
+ def get_file(self, agent_id: str, file_name: str) -> Response:
65
+ """
66
+ Download a file from the file manager for the agent specified by agent_id
67
+ :param agent_id: The agent id
68
+ :param file_name: The name of the file to download
69
+ :return: Response, the response containing the file content
70
+ """
71
+ response = self.get_http_client(agent_id).get(
72
+ self.format_url(f"/files/{file_name}"),
73
+ stream=True,
74
+ headers={"Accept": "application/octet-stream"}
75
+ )
76
+ response.raise_for_status()
77
+
78
+ return response
79
+
80
+ def delete_file(self, agent_id: str, file_name: str) -> FileManagerDeletedFiles:
81
+ """
82
+ Download a file from the file manager for the agent specified by agent_id
83
+ :param agent_id: The agent id
84
+ :param file_name: The name of the file to delete
85
+ :return: FileManagerDeletedFiles, the response containing info about the deleted file
86
+ """
87
+ return self.delete(
88
+ self.format_url(f"/files/{file_name}"),
89
+ agent_id,
90
+ output_class=FileManagerDeletedFiles,
91
+ )
92
+
93
+ def delete_files(self, agent_id: str) -> FileManagerDeletedFiles:
94
+ """
95
+ Download a file from the file manager for the agent specified by agent_id
96
+ :param agent_id: The agent id
97
+ :return: bool, True if all files were deleted successfully
98
+ """
99
+ return self.delete(
100
+ self.format_url("/files"),
101
+ agent_id,
102
+ output_class=FileManagerDeletedFiles,
52
103
  )
@@ -0,0 +1,22 @@
1
+ from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
2
+
3
+ class HealthCheckEndpoint(AbstractEndpoint):
4
+ def liveness(self):
5
+ """
6
+ This endpoint is used to check if the server is running.
7
+ :return: dict, the status of the server.
8
+ """
9
+ response = self.get_http_session().get("/health/liveness")
10
+ response.raise_for_status()
11
+
12
+ return response.json()
13
+
14
+ def readiness(self):
15
+ """
16
+ This endpoint is used to check if the server is running.
17
+ :return: dict, the status of the server.
18
+ """
19
+ response = self.get_http_session().get("/health/readiness")
20
+ response.raise_for_status()
21
+
22
+ return response.json()
@@ -9,7 +9,7 @@ class LargeLanguageModelEndpoint(AbstractEndpoint):
9
9
  super().__init__(client)
10
10
  self.prefix = "/llm"
11
11
 
12
- def get_large_language_models_settings(self, agent_id: str | None = None) -> FactoryObjectSettingsOutput:
12
+ def get_large_language_models_settings(self, agent_id: str) -> FactoryObjectSettingsOutput:
13
13
  """
14
14
  Get all large language model settings for the agent specified by agent_id
15
15
  :param agent_id: The agent id
@@ -17,11 +17,11 @@ class LargeLanguageModelEndpoint(AbstractEndpoint):
17
17
  """
18
18
  return self.get(
19
19
  self.format_url("/settings"),
20
- FactoryObjectSettingsOutput,
21
20
  agent_id,
21
+ output_class=FactoryObjectSettingsOutput,
22
22
  )
23
23
 
24
- def get_large_language_model_settings(self, llm: str, agent_id: str | None = None) -> FactoryObjectSettingOutput:
24
+ def get_large_language_model_settings(self, llm: str, agent_id: str) -> FactoryObjectSettingOutput:
25
25
  """
26
26
  Get the large language model settings for the large language model specified by llm and agent_id
27
27
  :param llm: The name of the large language model
@@ -30,23 +30,23 @@ class LargeLanguageModelEndpoint(AbstractEndpoint):
30
30
  """
31
31
  return self.get(
32
32
  self.format_url(f"/settings/{llm}"),
33
- FactoryObjectSettingOutput,
34
33
  agent_id,
34
+ output_class=FactoryObjectSettingOutput,
35
35
  )
36
36
 
37
37
  def put_large_language_model_settings(
38
- self, llm: str, values: Dict[str, Any], agent_id: str | None = None
38
+ self, llm: str, agent_id: str, values: Dict[str, Any]
39
39
  ) -> FactoryObjectSettingOutput:
40
40
  """
41
41
  Update the large language model settings for the large language model specified by llm and agent_id
42
42
  :param llm: The name of the large language model
43
- :param values: The new settings
44
43
  :param agent_id: The agent id
44
+ :param values: The new settings
45
45
  :return: FactoryObjectSettingOutput, the updated large language model settings
46
46
  """
47
47
  return self.put(
48
48
  self.format_url(f"/settings/{llm}"),
49
- FactoryObjectSettingOutput,
50
- values,
51
49
  agent_id,
50
+ output_class=FactoryObjectSettingOutput,
51
+ payload=values,
52
52
  )