pygeai 0.6.0b6__py3-none-any.whl → 0.6.0b7__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 (85) hide show
  1. pygeai/_docs/source/content/api_reference/admin.rst +161 -0
  2. pygeai/_docs/source/content/api_reference/assistant.rst +326 -0
  3. pygeai/_docs/source/content/api_reference/auth.rst +379 -0
  4. pygeai/_docs/source/content/api_reference/health.rst +58 -0
  5. pygeai/_docs/source/content/api_reference/project.rst +20 -18
  6. pygeai/_docs/source/content/api_reference/rerank.rst +94 -0
  7. pygeai/_docs/source/content/api_reference.rst +6 -1
  8. pygeai/_docs/source/index.rst +59 -7
  9. pygeai/_docs/source/pygeai.auth.rst +29 -0
  10. pygeai/_docs/source/pygeai.cli.commands.rst +16 -0
  11. pygeai/_docs/source/pygeai.core.utils.rst +16 -0
  12. pygeai/_docs/source/pygeai.rst +1 -0
  13. pygeai/_docs/source/pygeai.tests.auth.rst +21 -0
  14. pygeai/_docs/source/pygeai.tests.cli.commands.rst +16 -0
  15. pygeai/_docs/source/pygeai.tests.core.base.rst +8 -0
  16. pygeai/_docs/source/pygeai.tests.core.files.rst +8 -0
  17. pygeai/_docs/source/pygeai.tests.core.plugins.rst +21 -0
  18. pygeai/_docs/source/pygeai.tests.core.rst +1 -0
  19. pygeai/_docs/source/pygeai.tests.evaluation.dataset.rst +21 -0
  20. pygeai/_docs/source/pygeai.tests.evaluation.plan.rst +21 -0
  21. pygeai/_docs/source/pygeai.tests.evaluation.result.rst +21 -0
  22. pygeai/_docs/source/pygeai.tests.evaluation.rst +20 -0
  23. pygeai/_docs/source/pygeai.tests.integration.lab.processes.rst +8 -0
  24. pygeai/_docs/source/pygeai.tests.organization.rst +8 -0
  25. pygeai/_docs/source/pygeai.tests.rst +2 -0
  26. pygeai/_docs/source/pygeai.tests.snippets.auth.rst +10 -0
  27. pygeai/_docs/source/pygeai.tests.snippets.organization.rst +40 -0
  28. pygeai/_docs/source/pygeai.tests.snippets.rst +1 -0
  29. pygeai/admin/clients.py +7 -32
  30. pygeai/assistant/clients.py +9 -44
  31. pygeai/assistant/data/clients.py +1 -0
  32. pygeai/assistant/data_analyst/clients.py +4 -13
  33. pygeai/assistant/rag/clients.py +13 -67
  34. pygeai/auth/clients.py +88 -14
  35. pygeai/auth/endpoints.py +4 -0
  36. pygeai/chat/clients.py +1 -0
  37. pygeai/cli/commands/auth.py +178 -2
  38. pygeai/cli/commands/lab/ai_lab.py +0 -2
  39. pygeai/cli/commands/organization.py +241 -0
  40. pygeai/core/base/clients.py +1 -0
  41. pygeai/core/embeddings/clients.py +3 -7
  42. pygeai/core/feedback/clients.py +3 -8
  43. pygeai/core/files/clients.py +5 -18
  44. pygeai/core/llm/clients.py +7 -26
  45. pygeai/core/models.py +107 -0
  46. pygeai/core/plugins/clients.py +3 -7
  47. pygeai/core/rerank/clients.py +3 -8
  48. pygeai/core/secrets/clients.py +8 -37
  49. pygeai/core/utils/parsers.py +32 -0
  50. pygeai/core/utils/validators.py +10 -0
  51. pygeai/evaluation/clients.py +1 -0
  52. pygeai/evaluation/dataset/clients.py +1 -0
  53. pygeai/evaluation/plan/clients.py +1 -0
  54. pygeai/evaluation/result/clients.py +1 -0
  55. pygeai/gam/clients.py +6 -25
  56. pygeai/health/clients.py +3 -7
  57. pygeai/lab/agents/clients.py +13 -53
  58. pygeai/lab/agents/endpoints.py +2 -0
  59. pygeai/lab/clients.py +1 -0
  60. pygeai/lab/processes/clients.py +24 -127
  61. pygeai/lab/strategies/clients.py +7 -25
  62. pygeai/lab/tools/clients.py +22 -67
  63. pygeai/lab/tools/endpoints.py +3 -0
  64. pygeai/organization/clients.py +122 -51
  65. pygeai/organization/endpoints.py +6 -1
  66. pygeai/organization/limits/clients.py +17 -91
  67. pygeai/organization/managers.py +157 -1
  68. pygeai/organization/mappers.py +76 -2
  69. pygeai/organization/responses.py +25 -1
  70. pygeai/proxy/clients.py +1 -0
  71. pygeai/tests/auth/test_clients.py +183 -7
  72. pygeai/tests/organization/test_clients.py +184 -1
  73. pygeai/tests/organization/test_managers.py +122 -1
  74. pygeai/tests/snippets/auth/__init__.py +0 -0
  75. pygeai/tests/snippets/organization/get_memberships.py +12 -0
  76. pygeai/tests/snippets/organization/get_organization_members.py +6 -0
  77. pygeai/tests/snippets/organization/get_project_members.py +6 -0
  78. pygeai/tests/snippets/organization/get_project_memberships.py +12 -0
  79. pygeai/tests/snippets/organization/get_project_roles.py +6 -0
  80. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b7.dist-info}/METADATA +1 -1
  81. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b7.dist-info}/RECORD +85 -64
  82. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b7.dist-info}/WHEEL +0 -0
  83. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b7.dist-info}/entry_points.txt +0 -0
  84. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b7.dist-info}/licenses/LICENSE +0 -0
  85. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b7.dist-info}/top_level.txt +0 -0
@@ -1,21 +1,73 @@
1
- PyGEAI documentation
1
+ PyGEAI Documentation
2
2
  ====================
3
3
 
4
- PyGEAI is a Python SDK developed to interact with the different components that constitute GEAI.
5
- Its composed of several resources that allow developers to work with GEAIs modules in an easy and simple manner.
6
- The SDK is composed of libraries, tools, documentation and code samples.
7
- The goal is to provide an easier experience working with GEAI, without any overhead of setup and configuration.
4
+ PyGEAI is a Python SDK developed to interact with the different components that constitute GEAI (Globant Enterprise AI).
5
+ It's composed of several resources that allow developers to work with GEAI's modules in an easy and simple manner.
6
+
7
+ The SDK provides libraries, tools, documentation, and code samples to deliver an easier development experience
8
+ with GEAI, without overhead of setup and configuration.
9
+
10
+ Getting Started
11
+ ---------------
8
12
 
9
13
  .. toctree::
10
14
  :maxdepth: 2
11
- :caption: Contents:
12
15
 
13
16
  content/intro
14
17
  content/quickstart
18
+
19
+ Core Features & API Reference
20
+ -------------------------------
21
+
22
+ Complete reference for all PyGEAI modules and APIs.
23
+
24
+ .. toctree::
25
+ :maxdepth: 2
26
+
15
27
  content/api_reference
28
+
29
+ The API Reference includes:
30
+
31
+ * **Authentication** - OAuth2, API tokens, user profiles
32
+ * **Administration** - Token validation, organization access
33
+ * **Assistants** - Create and manage AI assistants
34
+ * **Chat** - Chat completions and streaming
35
+ * **Embeddings** - Text embeddings for similarity search
36
+ * **RAG** - Retrieval-Augmented Generation assistants
37
+ * **Reranking** - Document reranking for relevance
38
+ * **Projects** - Project and organization management
39
+ * **Health** - Service status and monitoring
40
+
41
+ Advanced Features
42
+ -----------------
43
+
44
+ .. toctree::
45
+ :maxdepth: 2
46
+
16
47
  content/ai_lab
17
- content/samples
48
+
49
+ Tools & Utilities
50
+ -----------------
51
+
52
+ .. toctree::
53
+ :maxdepth: 2
54
+
18
55
  content/cli
19
56
  content/chat_gui
20
57
  content/debugger
58
+
59
+ Additional Resources
60
+ --------------------
61
+
62
+ .. toctree::
63
+ :maxdepth: 2
64
+
65
+ content/samples
21
66
  modules
67
+
68
+ Indices and tables
69
+ ==================
70
+
71
+ * :ref:`genindex`
72
+ * :ref:`modindex`
73
+ * :ref:`search`
@@ -0,0 +1,29 @@
1
+ pygeai.auth package
2
+ ===================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pygeai.auth.clients module
8
+ --------------------------
9
+
10
+ .. automodule:: pygeai.auth.clients
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ pygeai.auth.endpoints module
16
+ ----------------------------
17
+
18
+ .. automodule:: pygeai.auth.endpoints
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: pygeai.auth
27
+ :members:
28
+ :show-inheritance:
29
+ :undoc-members:
@@ -29,6 +29,14 @@ pygeai.cli.commands.assistant module
29
29
  :show-inheritance:
30
30
  :undoc-members:
31
31
 
32
+ pygeai.cli.commands.auth module
33
+ -------------------------------
34
+
35
+ .. automodule:: pygeai.cli.commands.auth
36
+ :members:
37
+ :show-inheritance:
38
+ :undoc-members:
39
+
32
40
  pygeai.cli.commands.base module
33
41
  -------------------------------
34
42
 
@@ -69,6 +77,14 @@ pygeai.cli.commands.configuration module
69
77
  :show-inheritance:
70
78
  :undoc-members:
71
79
 
80
+ pygeai.cli.commands.docs module
81
+ -------------------------------
82
+
83
+ .. automodule:: pygeai.cli.commands.docs
84
+ :members:
85
+ :show-inheritance:
86
+ :undoc-members:
87
+
72
88
  pygeai.cli.commands.embeddings module
73
89
  -------------------------------------
74
90
 
@@ -12,6 +12,22 @@ pygeai.core.utils.console module
12
12
  :show-inheritance:
13
13
  :undoc-members:
14
14
 
15
+ pygeai.core.utils.parsers module
16
+ --------------------------------
17
+
18
+ .. automodule:: pygeai.core.utils.parsers
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
22
+
23
+ pygeai.core.utils.validators module
24
+ -----------------------------------
25
+
26
+ .. automodule:: pygeai.core.utils.validators
27
+ :members:
28
+ :show-inheritance:
29
+ :undoc-members:
30
+
15
31
  Module contents
16
32
  ---------------
17
33
 
@@ -9,6 +9,7 @@ Subpackages
9
9
 
10
10
  pygeai.admin
11
11
  pygeai.assistant
12
+ pygeai.auth
12
13
  pygeai.chat
13
14
  pygeai.cli
14
15
  pygeai.core
@@ -0,0 +1,21 @@
1
+ pygeai.tests.auth package
2
+ =========================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pygeai.tests.auth.test\_clients module
8
+ --------------------------------------
9
+
10
+ .. automodule:: pygeai.tests.auth.test_clients
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ Module contents
16
+ ---------------
17
+
18
+ .. automodule:: pygeai.tests.auth
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
@@ -44,6 +44,14 @@ pygeai.tests.cli.commands.test\_embeddings module
44
44
  :show-inheritance:
45
45
  :undoc-members:
46
46
 
47
+ pygeai.tests.cli.commands.test\_evaluation module
48
+ -------------------------------------------------
49
+
50
+ .. automodule:: pygeai.tests.cli.commands.test_evaluation
51
+ :members:
52
+ :show-inheritance:
53
+ :undoc-members:
54
+
47
55
  pygeai.tests.cli.commands.test\_feedback module
48
56
  -----------------------------------------------
49
57
 
@@ -108,6 +116,14 @@ pygeai.tests.cli.commands.test\_rerank module
108
116
  :show-inheritance:
109
117
  :undoc-members:
110
118
 
119
+ pygeai.tests.cli.commands.test\_secrets module
120
+ ----------------------------------------------
121
+
122
+ .. automodule:: pygeai.tests.cli.commands.test_secrets
123
+ :members:
124
+ :show-inheritance:
125
+ :undoc-members:
126
+
111
127
  pygeai.tests.cli.commands.test\_show\_help module
112
128
  -------------------------------------------------
113
129
 
@@ -28,6 +28,14 @@ pygeai.tests.core.base.test\_models module
28
28
  :show-inheritance:
29
29
  :undoc-members:
30
30
 
31
+ pygeai.tests.core.base.test\_responses module
32
+ ---------------------------------------------
33
+
34
+ .. automodule:: pygeai.tests.core.base.test_responses
35
+ :members:
36
+ :show-inheritance:
37
+ :undoc-members:
38
+
31
39
  Module contents
32
40
  ---------------
33
41
 
@@ -20,6 +20,14 @@ pygeai.tests.core.files.test\_managers module
20
20
  :show-inheritance:
21
21
  :undoc-members:
22
22
 
23
+ pygeai.tests.core.files.test\_mappers module
24
+ --------------------------------------------
25
+
26
+ .. automodule:: pygeai.tests.core.files.test_mappers
27
+ :members:
28
+ :show-inheritance:
29
+ :undoc-members:
30
+
23
31
  pygeai.tests.core.files.test\_models module
24
32
  -------------------------------------------
25
33
 
@@ -0,0 +1,21 @@
1
+ pygeai.tests.core.plugins package
2
+ =================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pygeai.tests.core.plugins.test\_clients module
8
+ ----------------------------------------------
9
+
10
+ .. automodule:: pygeai.tests.core.plugins.test_clients
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ Module contents
16
+ ---------------
17
+
18
+ .. automodule:: pygeai.tests.core.plugins
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
@@ -13,6 +13,7 @@ Subpackages
13
13
  pygeai.tests.core.feedback
14
14
  pygeai.tests.core.files
15
15
  pygeai.tests.core.llm
16
+ pygeai.tests.core.plugins
16
17
  pygeai.tests.core.rerank
17
18
  pygeai.tests.core.secrets
18
19
  pygeai.tests.core.services
@@ -0,0 +1,21 @@
1
+ pygeai.tests.evaluation.dataset package
2
+ =======================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pygeai.tests.evaluation.dataset.test\_clients module
8
+ ----------------------------------------------------
9
+
10
+ .. automodule:: pygeai.tests.evaluation.dataset.test_clients
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ Module contents
16
+ ---------------
17
+
18
+ .. automodule:: pygeai.tests.evaluation.dataset
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
@@ -0,0 +1,21 @@
1
+ pygeai.tests.evaluation.plan package
2
+ ====================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pygeai.tests.evaluation.plan.test\_clients module
8
+ -------------------------------------------------
9
+
10
+ .. automodule:: pygeai.tests.evaluation.plan.test_clients
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ Module contents
16
+ ---------------
17
+
18
+ .. automodule:: pygeai.tests.evaluation.plan
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
@@ -0,0 +1,21 @@
1
+ pygeai.tests.evaluation.result package
2
+ ======================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pygeai.tests.evaluation.result.test\_clients module
8
+ ---------------------------------------------------
9
+
10
+ .. automodule:: pygeai.tests.evaluation.result.test_clients
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ Module contents
16
+ ---------------
17
+
18
+ .. automodule:: pygeai.tests.evaluation.result
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
@@ -0,0 +1,20 @@
1
+ pygeai.tests.evaluation package
2
+ ===============================
3
+
4
+ Subpackages
5
+ -----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 4
9
+
10
+ pygeai.tests.evaluation.dataset
11
+ pygeai.tests.evaluation.plan
12
+ pygeai.tests.evaluation.result
13
+
14
+ Module contents
15
+ ---------------
16
+
17
+ .. automodule:: pygeai.tests.evaluation
18
+ :members:
19
+ :show-inheritance:
20
+ :undoc-members:
@@ -12,6 +12,14 @@ pygeai.tests.integration.lab.processes.test\_create\_process module
12
12
  :show-inheritance:
13
13
  :undoc-members:
14
14
 
15
+ pygeai.tests.integration.lab.processes.test\_create\_task module
16
+ ----------------------------------------------------------------
17
+
18
+ .. automodule:: pygeai.tests.integration.lab.processes.test_create_task
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
22
+
15
23
  pygeai.tests.integration.lab.processes.test\_delete\_process module
16
24
  -------------------------------------------------------------------
17
25
 
@@ -36,6 +36,14 @@ pygeai.tests.organization.test\_mappers module
36
36
  :show-inheritance:
37
37
  :undoc-members:
38
38
 
39
+ pygeai.tests.organization.test\_responses module
40
+ ------------------------------------------------
41
+
42
+ .. automodule:: pygeai.tests.organization.test_responses
43
+ :members:
44
+ :show-inheritance:
45
+ :undoc-members:
46
+
39
47
  Module contents
40
48
  ---------------
41
49
 
@@ -9,10 +9,12 @@ Subpackages
9
9
 
10
10
  pygeai.tests.admin
11
11
  pygeai.tests.assistants
12
+ pygeai.tests.auth
12
13
  pygeai.tests.chat
13
14
  pygeai.tests.cli
14
15
  pygeai.tests.core
15
16
  pygeai.tests.dbg
17
+ pygeai.tests.evaluation
16
18
  pygeai.tests.gam
17
19
  pygeai.tests.health
18
20
  pygeai.tests.integration
@@ -0,0 +1,10 @@
1
+ pygeai.tests.snippets.auth package
2
+ ==================================
3
+
4
+ Module contents
5
+ ---------------
6
+
7
+ .. automodule:: pygeai.tests.snippets.auth
8
+ :members:
9
+ :show-inheritance:
10
+ :undoc-members:
@@ -28,6 +28,22 @@ pygeai.tests.snippets.organization.export\_request\_data module
28
28
  :show-inheritance:
29
29
  :undoc-members:
30
30
 
31
+ pygeai.tests.snippets.organization.get\_memberships module
32
+ ----------------------------------------------------------
33
+
34
+ .. automodule:: pygeai.tests.snippets.organization.get_memberships
35
+ :members:
36
+ :show-inheritance:
37
+ :undoc-members:
38
+
39
+ pygeai.tests.snippets.organization.get\_organization\_members module
40
+ --------------------------------------------------------------------
41
+
42
+ .. automodule:: pygeai.tests.snippets.organization.get_organization_members
43
+ :members:
44
+ :show-inheritance:
45
+ :undoc-members:
46
+
31
47
  pygeai.tests.snippets.organization.get\_project\_data module
32
48
  ------------------------------------------------------------
33
49
 
@@ -44,6 +60,30 @@ pygeai.tests.snippets.organization.get\_project\_list module
44
60
  :show-inheritance:
45
61
  :undoc-members:
46
62
 
63
+ pygeai.tests.snippets.organization.get\_project\_members module
64
+ ---------------------------------------------------------------
65
+
66
+ .. automodule:: pygeai.tests.snippets.organization.get_project_members
67
+ :members:
68
+ :show-inheritance:
69
+ :undoc-members:
70
+
71
+ pygeai.tests.snippets.organization.get\_project\_memberships module
72
+ -------------------------------------------------------------------
73
+
74
+ .. automodule:: pygeai.tests.snippets.organization.get_project_memberships
75
+ :members:
76
+ :show-inheritance:
77
+ :undoc-members:
78
+
79
+ pygeai.tests.snippets.organization.get\_project\_roles module
80
+ -------------------------------------------------------------
81
+
82
+ .. automodule:: pygeai.tests.snippets.organization.get_project_roles
83
+ :members:
84
+ :show-inheritance:
85
+ :undoc-members:
86
+
47
87
  pygeai.tests.snippets.organization.get\_project\_tokens module
48
88
  --------------------------------------------------------------
49
89
 
@@ -8,6 +8,7 @@ Subpackages
8
8
  :maxdepth: 4
9
9
 
10
10
  pygeai.tests.snippets.assistants
11
+ pygeai.tests.snippets.auth
11
12
  pygeai.tests.snippets.chat
12
13
  pygeai.tests.snippets.embeddings
13
14
  pygeai.tests.snippets.evaluation
pygeai/admin/clients.py CHANGED
@@ -1,11 +1,11 @@
1
- import json
2
- from json import JSONDecodeError
3
1
 
4
2
  from pygeai import logger
5
3
  from pygeai.admin.endpoints import GET_API_TOKEN_VALIDATION_V1, GET_AUTHORIZED_ORGANIZATIONS_V1, \
6
4
  GET_AUTHORIZED_PROJECTS_V1, GET_PROJECT_VISIBILITY_V1, GET_PROJECT_API_TOKEN_V1
7
5
  from pygeai.core.base.clients import BaseClient
8
6
  from pygeai.core.common.exceptions import InvalidAPIResponseException
7
+ from pygeai.core.utils.validators import validate_status_code
8
+ from pygeai.core.utils.parsers import parse_json_response
9
9
 
10
10
 
11
11
  class AdminClient(BaseClient):
@@ -17,12 +17,7 @@ class AdminClient(BaseClient):
17
17
  :return: dict - The API response containing organization and project information in JSON format.
18
18
  """
19
19
  response = self.api_service.get(endpoint=GET_API_TOKEN_VALIDATION_V1)
20
- try:
21
- result = response.json()
22
- return result
23
- except JSONDecodeError as e:
24
- logger.error(f"Unable to validate API token: JSON parsing error (status {response.status_code}): {e}. Response: {response.text}")
25
- raise InvalidAPIResponseException(f"Unable to validate API token: {response.text}")
20
+ return parse_json_response(response, "validate API token")
26
21
 
27
22
  def get_authorized_organizations(self) -> dict:
28
23
  """
@@ -31,12 +26,7 @@ class AdminClient(BaseClient):
31
26
  :return: dict - The API response containing the list of authorized organizations in JSON format.
32
27
  """
33
28
  response = self.api_service.get(endpoint=GET_AUTHORIZED_ORGANIZATIONS_V1)
34
- try:
35
- result = response.json()
36
- return result
37
- except JSONDecodeError as e:
38
- logger.error(f"Unable to retrieve authorized organizations: JSON parsing error (status {response.status_code}): {e}. Response: {response.text}")
39
- raise InvalidAPIResponseException(f"Unable to retrieve authorized organizations: {response.text}")
29
+ return parse_json_response(response, "retrieve authorized organizations")
40
30
 
41
31
  def get_authorized_projects_by_organization(
42
32
  self,
@@ -54,12 +44,7 @@ class AdminClient(BaseClient):
54
44
  "organization": organization
55
45
  }
56
46
  )
57
- try:
58
- result = response.json()
59
- return result
60
- except JSONDecodeError as e:
61
- logger.error(f"Unable to retrieve authorized projects for organization '{organization}': JSON parsing error (status {response.status_code}): {e}. Response: {response.text}")
62
- raise InvalidAPIResponseException(f"Unable to retrieve authorized projects for organization {organization}: {response.text}")
47
+ return parse_json_response(response, "retrieve authorized projects for organization", organization=organization)
63
48
 
64
49
  def get_project_visibility(
65
50
  self,
@@ -90,12 +75,7 @@ class AdminClient(BaseClient):
90
75
  "accessToken": access_token
91
76
  }
92
77
  )
93
- try:
94
- result = response.json()
95
- return result
96
- except JSONDecodeError as e:
97
- logger.error(f"Unable to retrieve project visibility for organization '{organization}' and project '{project}': JSON parsing error (status {response.status_code}): {e}. Response: {response.text}")
98
- raise InvalidAPIResponseException(f"Unable to retrieve project visibility for organization {organization} and project {project}: {response.text}")
78
+ return parse_json_response(response, "retrieve project visibility", organization=organization, project=project)
99
79
 
100
80
  def get_project_api_token(
101
81
  self,
@@ -127,9 +107,4 @@ class AdminClient(BaseClient):
127
107
  "accessToken": access_token
128
108
  }
129
109
  )
130
- try:
131
- result = response.json()
132
- return result
133
- except JSONDecodeError as e:
134
- logger.error(f"Unable to retrieve project API token for organization '{organization}' and project '{project}': JSON parsing error (status {response.status_code}): {e}. Response: {response.text}")
135
- raise InvalidAPIResponseException(f"Unable to retrieve project API token for organization {organization} and project {project}: {response.text}")
110
+ return parse_json_response(response, "retrieve project API token", organization=organization, project=project)