pygeai 0.6.0b11__py3-none-any.whl → 0.6.0b12__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.
- pygeai/_docs/source/content/ai_lab/cli.rst +4 -4
- pygeai/_docs/source/content/ai_lab/models.rst +169 -35
- pygeai/_docs/source/content/ai_lab/runner.rst +2 -2
- pygeai/_docs/source/content/ai_lab/spec.rst +9 -9
- pygeai/_docs/source/content/ai_lab/usage.rst +34 -34
- pygeai/_docs/source/content/ai_lab.rst +1 -1
- pygeai/_docs/source/content/analytics.rst +598 -0
- pygeai/_docs/source/content/api_reference/chat.rst +428 -2
- pygeai/_docs/source/content/api_reference/embeddings.rst +1 -1
- pygeai/_docs/source/content/api_reference/project.rst +184 -0
- pygeai/_docs/source/content/api_reference/rag.rst +2 -2
- pygeai/_docs/source/content/authentication.rst +295 -0
- pygeai/_docs/source/content/cli.rst +79 -2
- pygeai/_docs/source/content/debugger.rst +1 -1
- pygeai/_docs/source/content/migration.rst +19 -2
- pygeai/_docs/source/index.rst +2 -0
- pygeai/_docs/source/pygeai.analytics.rst +53 -0
- pygeai/_docs/source/pygeai.cli.commands.rst +8 -0
- pygeai/_docs/source/pygeai.rst +1 -0
- pygeai/_docs/source/pygeai.tests.analytics.rst +45 -0
- pygeai/_docs/source/pygeai.tests.auth.rst +8 -0
- pygeai/_docs/source/pygeai.tests.rst +1 -1
- pygeai/analytics/__init__.py +0 -0
- pygeai/analytics/clients.py +505 -0
- pygeai/analytics/endpoints.py +35 -0
- pygeai/analytics/managers.py +606 -0
- pygeai/analytics/mappers.py +207 -0
- pygeai/analytics/responses.py +240 -0
- pygeai/cli/commands/analytics.py +525 -0
- pygeai/cli/commands/base.py +16 -0
- pygeai/cli/commands/common.py +28 -24
- pygeai/cli/commands/migrate.py +75 -6
- pygeai/cli/commands/organization.py +265 -0
- pygeai/cli/commands/validators.py +144 -1
- pygeai/cli/error_handler.py +41 -6
- pygeai/cli/geai.py +99 -16
- pygeai/cli/parsers.py +75 -31
- pygeai/cli/texts/help.py +75 -6
- pygeai/core/base/clients.py +18 -4
- pygeai/core/base/session.py +46 -7
- pygeai/core/common/config.py +25 -2
- pygeai/core/common/exceptions.py +64 -1
- pygeai/core/services/rest.py +20 -2
- pygeai/evaluation/clients.py +5 -3
- pygeai/lab/agents/clients.py +3 -3
- pygeai/lab/agents/endpoints.py +2 -2
- pygeai/lab/agents/mappers.py +50 -2
- pygeai/lab/clients.py +5 -2
- pygeai/lab/managers.py +7 -9
- pygeai/lab/models.py +70 -2
- pygeai/lab/tools/clients.py +1 -59
- pygeai/migration/__init__.py +3 -1
- pygeai/migration/strategies.py +72 -3
- pygeai/organization/clients.py +110 -1
- pygeai/organization/endpoints.py +11 -7
- pygeai/organization/managers.py +134 -2
- pygeai/organization/mappers.py +28 -2
- pygeai/organization/responses.py +11 -1
- pygeai/tests/analytics/__init__.py +0 -0
- pygeai/tests/analytics/test_clients.py +86 -0
- pygeai/tests/analytics/test_managers.py +94 -0
- pygeai/tests/analytics/test_mappers.py +84 -0
- pygeai/tests/analytics/test_responses.py +73 -0
- pygeai/tests/auth/test_oauth.py +172 -0
- pygeai/tests/cli/commands/test_migrate.py +14 -1
- pygeai/tests/cli/commands/test_organization.py +69 -1
- pygeai/tests/cli/test_error_handler.py +4 -4
- pygeai/tests/cli/test_geai_driver.py +1 -1
- pygeai/tests/lab/agents/test_mappers.py +128 -1
- pygeai/tests/lab/test_models.py +2 -0
- pygeai/tests/lab/tools/test_clients.py +2 -31
- pygeai/tests/organization/test_clients.py +180 -1
- pygeai/tests/organization/test_managers.py +40 -0
- pygeai/tests/snippets/analytics/__init__.py +0 -0
- pygeai/tests/snippets/analytics/get_agent_usage_per_user.py +16 -0
- pygeai/tests/snippets/analytics/get_agents_created_and_modified.py +11 -0
- pygeai/tests/snippets/analytics/get_average_cost_per_request.py +10 -0
- pygeai/tests/snippets/analytics/get_overall_error_rate.py +10 -0
- pygeai/tests/snippets/analytics/get_top_10_agents_by_requests.py +12 -0
- pygeai/tests/snippets/analytics/get_total_active_users.py +10 -0
- pygeai/tests/snippets/analytics/get_total_cost.py +10 -0
- pygeai/tests/snippets/analytics/get_total_requests_per_day.py +12 -0
- pygeai/tests/snippets/analytics/get_total_tokens.py +12 -0
- pygeai/tests/snippets/chat/get_response_complete_example.py +67 -0
- pygeai/tests/snippets/chat/get_response_with_instructions.py +19 -0
- pygeai/tests/snippets/chat/get_response_with_metadata.py +24 -0
- pygeai/tests/snippets/chat/get_response_with_parallel_tools.py +58 -0
- pygeai/tests/snippets/chat/get_response_with_reasoning.py +21 -0
- pygeai/tests/snippets/chat/get_response_with_store.py +38 -0
- pygeai/tests/snippets/chat/get_response_with_truncation.py +24 -0
- pygeai/tests/snippets/lab/agents/create_agent_with_permissions.py +39 -0
- pygeai/tests/snippets/lab/agents/create_agent_with_properties.py +46 -0
- pygeai/tests/snippets/lab/agents/get_agent_with_new_fields.py +62 -0
- pygeai/tests/snippets/lab/agents/update_agent_properties.py +50 -0
- pygeai/tests/snippets/organization/add_project_member.py +10 -0
- pygeai/tests/snippets/organization/add_project_member_batch.py +44 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b12.dist-info}/METADATA +1 -1
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b12.dist-info}/RECORD +102 -92
- pygeai/_docs/source/pygeai.tests.snippets.assistants.data_analyst.rst +0 -37
- pygeai/_docs/source/pygeai.tests.snippets.assistants.rag.rst +0 -85
- pygeai/_docs/source/pygeai.tests.snippets.assistants.rst +0 -78
- pygeai/_docs/source/pygeai.tests.snippets.auth.rst +0 -10
- pygeai/_docs/source/pygeai.tests.snippets.chat.rst +0 -125
- pygeai/_docs/source/pygeai.tests.snippets.dbg.rst +0 -45
- pygeai/_docs/source/pygeai.tests.snippets.embeddings.rst +0 -61
- pygeai/_docs/source/pygeai.tests.snippets.evaluation.dataset.rst +0 -197
- pygeai/_docs/source/pygeai.tests.snippets.evaluation.plan.rst +0 -133
- pygeai/_docs/source/pygeai.tests.snippets.evaluation.result.rst +0 -37
- pygeai/_docs/source/pygeai.tests.snippets.evaluation.rst +0 -20
- pygeai/_docs/source/pygeai.tests.snippets.extras.rst +0 -37
- pygeai/_docs/source/pygeai.tests.snippets.files.rst +0 -53
- pygeai/_docs/source/pygeai.tests.snippets.gam.rst +0 -21
- pygeai/_docs/source/pygeai.tests.snippets.lab.agents.rst +0 -93
- pygeai/_docs/source/pygeai.tests.snippets.lab.processes.jobs.rst +0 -21
- pygeai/_docs/source/pygeai.tests.snippets.lab.processes.kbs.rst +0 -45
- pygeai/_docs/source/pygeai.tests.snippets.lab.processes.rst +0 -46
- pygeai/_docs/source/pygeai.tests.snippets.lab.rst +0 -82
- pygeai/_docs/source/pygeai.tests.snippets.lab.samples.rst +0 -21
- pygeai/_docs/source/pygeai.tests.snippets.lab.strategies.rst +0 -45
- pygeai/_docs/source/pygeai.tests.snippets.lab.tools.rst +0 -85
- pygeai/_docs/source/pygeai.tests.snippets.lab.use_cases.rst +0 -117
- pygeai/_docs/source/pygeai.tests.snippets.migrate.rst +0 -10
- pygeai/_docs/source/pygeai.tests.snippets.organization.rst +0 -109
- pygeai/_docs/source/pygeai.tests.snippets.rag.rst +0 -85
- pygeai/_docs/source/pygeai.tests.snippets.rerank.rst +0 -21
- pygeai/_docs/source/pygeai.tests.snippets.rst +0 -32
- pygeai/_docs/source/pygeai.tests.snippets.secrets.rst +0 -10
- pygeai/_docs/source/pygeai.tests.snippets.usage_limit.rst +0 -77
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b12.dist-info}/WHEEL +0 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b12.dist-info}/entry_points.txt +0 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b12.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b12.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Authentication
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
The PyGEAI SDK supports two authentication methods: **API Key** authentication and **OAuth 2.0** authentication. Both methods provide secure access to Globant Enterprise AI services, with OAuth offering enhanced security through token-based authentication and project-level access control.
|
|
5
|
+
|
|
6
|
+
API Key Authentication
|
|
7
|
+
----------------------
|
|
8
|
+
|
|
9
|
+
API Key authentication is the traditional method that uses a project-specific API token. This is the simplest authentication method and is suitable for most use cases.
|
|
10
|
+
|
|
11
|
+
Configuration
|
|
12
|
+
~~~~~~~~~~~~~
|
|
13
|
+
|
|
14
|
+
You can configure API Key authentication using the CLI:
|
|
15
|
+
|
|
16
|
+
.. code-block:: shell
|
|
17
|
+
|
|
18
|
+
geai configure
|
|
19
|
+
|
|
20
|
+
When prompted, enter your API key and base URL:
|
|
21
|
+
|
|
22
|
+
.. code-block:: shell
|
|
23
|
+
|
|
24
|
+
-> Select an alias (Leave empty to use 'default'): default
|
|
25
|
+
-> Insert your GEAI_API_KEY: your_api_key_here
|
|
26
|
+
GEAI API KEY for alias 'default' saved successfully!
|
|
27
|
+
-> Insert your GEAI API BASE URL: https://api.saia.ai
|
|
28
|
+
GEAI API BASE URL for alias 'default' saved successfully!
|
|
29
|
+
|
|
30
|
+
Usage in Code
|
|
31
|
+
~~~~~~~~~~~~~
|
|
32
|
+
|
|
33
|
+
**Using Configured Credentials:**
|
|
34
|
+
|
|
35
|
+
.. code-block:: python
|
|
36
|
+
|
|
37
|
+
from pygeai.lab.clients import AILabClient
|
|
38
|
+
|
|
39
|
+
# Uses credentials from configuration file
|
|
40
|
+
client = AILabClient()
|
|
41
|
+
|
|
42
|
+
**Explicit API Key:**
|
|
43
|
+
|
|
44
|
+
.. code-block:: python
|
|
45
|
+
|
|
46
|
+
from pygeai.lab.clients import AILabClient
|
|
47
|
+
|
|
48
|
+
client = AILabClient(
|
|
49
|
+
api_key="your_api_key_here",
|
|
50
|
+
base_url="https://api.saia.ai"
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
**With Project ID:**
|
|
54
|
+
|
|
55
|
+
.. code-block:: python
|
|
56
|
+
|
|
57
|
+
from pygeai.lab.clients import AILabClient
|
|
58
|
+
|
|
59
|
+
client = AILabClient(
|
|
60
|
+
api_key="your_api_key_here",
|
|
61
|
+
base_url="https://api.saia.ai",
|
|
62
|
+
project_id="your-project-id"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
OAuth 2.0 Authentication
|
|
66
|
+
------------------------
|
|
67
|
+
|
|
68
|
+
OAuth 2.0 provides enhanced security by using temporary access tokens instead of long-lived API keys. This method requires both an ``access_token`` and a ``project_id``.
|
|
69
|
+
|
|
70
|
+
Prerequisites
|
|
71
|
+
~~~~~~~~~~~~~
|
|
72
|
+
|
|
73
|
+
Before using OAuth authentication, you need to:
|
|
74
|
+
|
|
75
|
+
1. Obtain OAuth credentials (client ID, username, password)
|
|
76
|
+
2. Get an access token
|
|
77
|
+
3. Know your project ID
|
|
78
|
+
|
|
79
|
+
Getting an Access Token
|
|
80
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
81
|
+
|
|
82
|
+
Use the Auth client to obtain an OAuth 2.0 access token:
|
|
83
|
+
|
|
84
|
+
.. code-block:: python
|
|
85
|
+
|
|
86
|
+
from pygeai.auth.clients import AuthClient
|
|
87
|
+
|
|
88
|
+
auth_client = AuthClient()
|
|
89
|
+
|
|
90
|
+
# Get OAuth 2.0 access token
|
|
91
|
+
response = auth_client.get_oauth2_access_token(
|
|
92
|
+
client_id="your-client-id",
|
|
93
|
+
username="your-username",
|
|
94
|
+
password="your-password"
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
access_token = response["access_token"]
|
|
98
|
+
project_id = "your-project-id"
|
|
99
|
+
|
|
100
|
+
Usage in Code
|
|
101
|
+
~~~~~~~~~~~~~
|
|
102
|
+
|
|
103
|
+
**Basic OAuth Authentication:**
|
|
104
|
+
|
|
105
|
+
.. code-block:: python
|
|
106
|
+
|
|
107
|
+
from pygeai.lab.clients import AILabClient
|
|
108
|
+
|
|
109
|
+
client = AILabClient(
|
|
110
|
+
base_url="https://api.saia.ai",
|
|
111
|
+
access_token="your_oauth_access_token",
|
|
112
|
+
project_id="your-project-id"
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
**With Other Clients:**
|
|
116
|
+
|
|
117
|
+
.. code-block:: python
|
|
118
|
+
|
|
119
|
+
from pygeai.core.secrets.clients import SecretClient
|
|
120
|
+
from pygeai.evaluation.clients import EvaluationClient
|
|
121
|
+
|
|
122
|
+
# Secret Client with OAuth
|
|
123
|
+
secret_client = SecretClient(
|
|
124
|
+
base_url="https://api.saia.ai",
|
|
125
|
+
access_token="your_oauth_access_token",
|
|
126
|
+
project_id="your-project-id"
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# Evaluation Client with OAuth
|
|
130
|
+
eval_client = EvaluationClient(
|
|
131
|
+
base_url="https://api.saia.ai",
|
|
132
|
+
eval_url="https://eval.saia.ai",
|
|
133
|
+
access_token="your_oauth_access_token",
|
|
134
|
+
project_id="your-project-id"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
Complete OAuth Flow Example
|
|
138
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
139
|
+
|
|
140
|
+
.. code-block:: python
|
|
141
|
+
|
|
142
|
+
from pygeai.auth.clients import AuthClient
|
|
143
|
+
from pygeai.lab.clients import AILabClient
|
|
144
|
+
from pygeai.lab.agents.clients import AgentClient
|
|
145
|
+
|
|
146
|
+
# Step 1: Obtain OAuth access token
|
|
147
|
+
auth_client = AuthClient()
|
|
148
|
+
token_response = auth_client.get_oauth2_access_token(
|
|
149
|
+
client_id="your-client-id",
|
|
150
|
+
username="user@example.com",
|
|
151
|
+
password="your-password"
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
access_token = token_response["access_token"]
|
|
155
|
+
project_id = "your-project-id"
|
|
156
|
+
|
|
157
|
+
# Step 2: Use OAuth token with clients
|
|
158
|
+
lab_client = AILabClient(
|
|
159
|
+
base_url="https://api.saia.ai",
|
|
160
|
+
access_token=access_token,
|
|
161
|
+
project_id=project_id
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
# Step 3: Use the client
|
|
165
|
+
agents = lab_client.list_agents()
|
|
166
|
+
print(f"Found {len(agents)} agents")
|
|
167
|
+
|
|
168
|
+
Authentication Comparison
|
|
169
|
+
-------------------------
|
|
170
|
+
|
|
171
|
+
.. list-table::
|
|
172
|
+
:header-rows: 1
|
|
173
|
+
:widths: 30 35 35
|
|
174
|
+
|
|
175
|
+
* - Feature
|
|
176
|
+
- API Key
|
|
177
|
+
- OAuth 2.0
|
|
178
|
+
* - **Security**
|
|
179
|
+
- Long-lived key
|
|
180
|
+
- Temporary access token
|
|
181
|
+
* - **Setup Complexity**
|
|
182
|
+
- Simple
|
|
183
|
+
- Moderate
|
|
184
|
+
* - **Project Isolation**
|
|
185
|
+
- Optional
|
|
186
|
+
- Required
|
|
187
|
+
* - **Token Expiration**
|
|
188
|
+
- Never (until revoked)
|
|
189
|
+
- Yes (requires refresh)
|
|
190
|
+
* - **Header Format**
|
|
191
|
+
- ``Bearer {api_key}``
|
|
192
|
+
- ``Bearer {access_token}``
|
|
193
|
+
* - **Additional Headers**
|
|
194
|
+
- None (ProjectId optional)
|
|
195
|
+
- ``ProjectId`` header required
|
|
196
|
+
* - **Use Case**
|
|
197
|
+
- Development, testing
|
|
198
|
+
- Production, multi-project
|
|
199
|
+
|
|
200
|
+
Implementation Details
|
|
201
|
+
----------------------
|
|
202
|
+
|
|
203
|
+
Header Injection
|
|
204
|
+
~~~~~~~~~~~~~~~~
|
|
205
|
+
|
|
206
|
+
The SDK automatically injects authentication headers:
|
|
207
|
+
|
|
208
|
+
**API Key:**
|
|
209
|
+
|
|
210
|
+
.. code-block:: python
|
|
211
|
+
|
|
212
|
+
Authorization: Bearer your_api_key_here
|
|
213
|
+
|
|
214
|
+
**OAuth 2.0:**
|
|
215
|
+
|
|
216
|
+
.. code-block:: python
|
|
217
|
+
|
|
218
|
+
Authorization: Bearer your_oauth_access_token
|
|
219
|
+
ProjectId: your-project-id
|
|
220
|
+
|
|
221
|
+
Backward Compatibility
|
|
222
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
223
|
+
|
|
224
|
+
OAuth parameters (``access_token`` and ``project_id``) are **keyword-only** parameters to maintain backward compatibility with existing code:
|
|
225
|
+
|
|
226
|
+
.. code-block:: python
|
|
227
|
+
|
|
228
|
+
# Correct - keyword arguments
|
|
229
|
+
client = AILabClient(
|
|
230
|
+
base_url="https://api.saia.ai",
|
|
231
|
+
access_token="token",
|
|
232
|
+
project_id="project-123"
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
# Error - cannot pass as positional
|
|
236
|
+
client = AILabClient("https://api.saia.ai", "token", "project-123")
|
|
237
|
+
|
|
238
|
+
Validation
|
|
239
|
+
~~~~~~~~~~
|
|
240
|
+
|
|
241
|
+
The SDK validates authentication parameters:
|
|
242
|
+
|
|
243
|
+
- **Missing OAuth parameters**: If ``access_token`` is provided without ``project_id``, a ``MissingRequirementException`` is raised.
|
|
244
|
+
- **Complete OAuth**: Both ``access_token`` and ``project_id`` must be provided together.
|
|
245
|
+
|
|
246
|
+
.. code-block:: python
|
|
247
|
+
|
|
248
|
+
# Raises MissingRequirementException
|
|
249
|
+
client = AILabClient(
|
|
250
|
+
base_url="https://api.saia.ai",
|
|
251
|
+
access_token="token_without_project"
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
# Correct
|
|
255
|
+
client = AILabClient(
|
|
256
|
+
base_url="https://api.saia.ai",
|
|
257
|
+
access_token="token",
|
|
258
|
+
project_id="project-123"
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
Best Practices
|
|
262
|
+
--------------
|
|
263
|
+
|
|
264
|
+
1. **Use OAuth for Production**: OAuth provides better security through temporary tokens and project isolation.
|
|
265
|
+
|
|
266
|
+
2. **Store Credentials Securely**: Never hardcode API keys or access tokens in your source code. Use environment variables or secure credential storage.
|
|
267
|
+
|
|
268
|
+
3. **Token Refresh**: Implement token refresh logic when using OAuth to handle token expiration.
|
|
269
|
+
|
|
270
|
+
4. **Project Isolation**: Use ``project_id`` to ensure requests are scoped to the correct project, even when using API keys.
|
|
271
|
+
|
|
272
|
+
5. **Error Handling**: Implement proper error handling for authentication failures:
|
|
273
|
+
|
|
274
|
+
.. code-block:: python
|
|
275
|
+
|
|
276
|
+
from pygeai.core.common.exceptions import MissingRequirementException, APIResponseError
|
|
277
|
+
|
|
278
|
+
try:
|
|
279
|
+
client = AILabClient(
|
|
280
|
+
base_url="https://api.saia.ai",
|
|
281
|
+
access_token=access_token,
|
|
282
|
+
project_id=project_id
|
|
283
|
+
)
|
|
284
|
+
agents = client.list_agents()
|
|
285
|
+
except MissingRequirementException as e:
|
|
286
|
+
print(f"Configuration error: {e}")
|
|
287
|
+
except APIResponseError as e:
|
|
288
|
+
print(f"Authentication failed: {e}")
|
|
289
|
+
|
|
290
|
+
Related Resources
|
|
291
|
+
-----------------
|
|
292
|
+
|
|
293
|
+
- :doc:`quickstart` - Getting started with PyGEAI
|
|
294
|
+
- :doc:`api_reference/auth` - Auth client API reference
|
|
295
|
+
- :doc:`ai_lab` - AI Lab documentation
|
|
@@ -1,8 +1,85 @@
|
|
|
1
|
-
geai -
|
|
2
|
-
|
|
1
|
+
geai - CLI Reference
|
|
2
|
+
====================
|
|
3
3
|
|
|
4
4
|
In this section, you can find examples of commands using the geai utility to perform basic tasks in GEAI.
|
|
5
5
|
|
|
6
|
+
CLI Architecture
|
|
7
|
+
----------------
|
|
8
|
+
|
|
9
|
+
The PyGEAI CLI provides a comprehensive command-line interface with the following features:
|
|
10
|
+
|
|
11
|
+
- **Type-Safe**: Full type hints for better IDE support and error detection
|
|
12
|
+
- **Fuzzy Matching**: Suggests similar commands when typos are detected
|
|
13
|
+
- **Enhanced Validation**: Detailed error messages with examples and suggestions
|
|
14
|
+
- **Multi-Profile Support**: Manage multiple GEAI instances via ``--alias`` flag
|
|
15
|
+
- **Consistent Error Handling**: Standardized exit codes and error formats
|
|
16
|
+
- **Verbose Mode**: Detailed logging for debugging and troubleshooting
|
|
17
|
+
|
|
18
|
+
Error Handling
|
|
19
|
+
--------------
|
|
20
|
+
|
|
21
|
+
The CLI provides clear, actionable error messages:
|
|
22
|
+
|
|
23
|
+
Exit Codes
|
|
24
|
+
^^^^^^^^^^
|
|
25
|
+
|
|
26
|
+
- ``0``: Success
|
|
27
|
+
- ``1``: User input error (invalid command, option, or argument)
|
|
28
|
+
- ``2``: Missing required parameter
|
|
29
|
+
- ``3``: Service error (API or agent issues)
|
|
30
|
+
- ``130``: Keyboard interrupt (Ctrl+C)
|
|
31
|
+
- ``255``: Unexpected error
|
|
32
|
+
|
|
33
|
+
Error Message Format
|
|
34
|
+
^^^^^^^^^^^^^^^^^^^
|
|
35
|
+
|
|
36
|
+
.. code-block:: text
|
|
37
|
+
|
|
38
|
+
ERROR: <error description>
|
|
39
|
+
→ <suggestion for fixing>
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
<example of correct usage>
|
|
43
|
+
|
|
44
|
+
Run 'geai help' for usage information.
|
|
45
|
+
|
|
46
|
+
Global Options
|
|
47
|
+
--------------
|
|
48
|
+
|
|
49
|
+
Verbose Mode
|
|
50
|
+
^^^^^^^^^^^^
|
|
51
|
+
|
|
52
|
+
Enable detailed logging output to debug issues or understand command execution flow:
|
|
53
|
+
|
|
54
|
+
.. code-block:: shell
|
|
55
|
+
|
|
56
|
+
geai --verbose <command> [options]
|
|
57
|
+
geai -v <command> [options]
|
|
58
|
+
|
|
59
|
+
Example output with verbose mode:
|
|
60
|
+
|
|
61
|
+
.. code-block:: text
|
|
62
|
+
|
|
63
|
+
2026-01-13 09:45:04 - geai - DEBUG - Verbose mode enabled
|
|
64
|
+
2026-01-13 09:45:04 - geai - DEBUG - Running geai with: geai help
|
|
65
|
+
2026-01-13 09:45:04 - geai - DEBUG - Session: default
|
|
66
|
+
2026-01-13 09:45:04 - geai - DEBUG - Identifying command for argument: help
|
|
67
|
+
2026-01-13 09:45:04 - geai - DEBUG - Searching for command matching: help
|
|
68
|
+
2026-01-13 09:45:04 - geai - DEBUG - Command found: help (identifiers: ['help', 'h'])
|
|
69
|
+
2026-01-13 09:45:04 - geai - DEBUG - Command identified: help
|
|
70
|
+
2026-01-13 09:45:04 - geai - DEBUG - Processing command: help, arguments: []
|
|
71
|
+
|
|
72
|
+
**When to use verbose mode:**
|
|
73
|
+
|
|
74
|
+
- Troubleshooting configuration issues
|
|
75
|
+
- Understanding which session/alias is being used
|
|
76
|
+
- Debugging command parsing or option validation
|
|
77
|
+
- Reporting issues to support with detailed context
|
|
78
|
+
- Tracking API calls and responses
|
|
79
|
+
|
|
80
|
+
Basic Usage
|
|
81
|
+
-----------
|
|
82
|
+
|
|
6
83
|
# Display help
|
|
7
84
|
|
|
8
85
|
.. code-block:: shell
|
|
@@ -17,7 +17,7 @@ The debugger provides features similar to Python's built-in ``pdb`` debugger, in
|
|
|
17
17
|
- **Command history**: Uses readline for command history and editing
|
|
18
18
|
|
|
19
19
|
Installation and Setup
|
|
20
|
-
|
|
20
|
+
----------------------
|
|
21
21
|
|
|
22
22
|
``geai-dbg`` is included in the ``pygeai`` package. Ensure ``pygeai`` is installed in your Python environment:
|
|
23
23
|
|
|
@@ -20,6 +20,7 @@ The migration feature supports migrating the following resource types:
|
|
|
20
20
|
- **Usage Limits**: Resource usage constraints and quotas
|
|
21
21
|
- **RAG Assistants**: Retrieval-Augmented Generation assistants
|
|
22
22
|
- **Files**: Project files and attachments
|
|
23
|
+
- **Secrets**: Secure credentials and sensitive configuration values
|
|
23
24
|
|
|
24
25
|
Key Features
|
|
25
26
|
------------
|
|
@@ -77,6 +78,7 @@ Different migration operations require different API token scopes:
|
|
|
77
78
|
- **Task Migration**: Migrating tasks
|
|
78
79
|
- **RAG Assistant Migration**: Migrating RAG assistants
|
|
79
80
|
- **File Migration**: Migrating files within projects
|
|
81
|
+
- **Secret Migration**: Migrating secrets within projects
|
|
80
82
|
|
|
81
83
|
Migration Scenarios and Required Keys
|
|
82
84
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -129,7 +131,7 @@ This command will:
|
|
|
129
131
|
|
|
130
132
|
1. Create a new project named "Cloned Project"
|
|
131
133
|
2. Discover all resources in the source project
|
|
132
|
-
3. Migrate all agents, tools, processes, tasks, usage limits, RAG assistants, and
|
|
134
|
+
3. Migrate all agents, tools, processes, tasks, usage limits, RAG assistants, files, and secrets
|
|
133
135
|
4. Display progress and results
|
|
134
136
|
|
|
135
137
|
Migrate to Different Instance
|
|
@@ -194,6 +196,18 @@ Instead of migrating everything, you can selectively migrate specific resource t
|
|
|
194
196
|
--admin-email "admin@example.com" \\
|
|
195
197
|
--rag-assistants all
|
|
196
198
|
|
|
199
|
+
**Migrate all secrets only:**
|
|
200
|
+
|
|
201
|
+
.. code-block:: shell
|
|
202
|
+
|
|
203
|
+
geai migrate clone-project \\
|
|
204
|
+
--from-api-key "source_api_key_123" \\
|
|
205
|
+
--from-project-id "source-project-id" \\
|
|
206
|
+
--from-instance "https://api.example.ai" \\
|
|
207
|
+
--to-project-name "Secrets Only" \\
|
|
208
|
+
--admin-email "admin@example.com" \\
|
|
209
|
+
--secrets all
|
|
210
|
+
|
|
197
211
|
Migrate Specific Resources by ID
|
|
198
212
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
199
213
|
|
|
@@ -339,7 +353,7 @@ Command: ``geai migrate clone-project``
|
|
|
339
353
|
**Migration Flags:**
|
|
340
354
|
|
|
341
355
|
``--all``
|
|
342
|
-
Migrate all available resource types (agents, tools, processes, tasks, usage limits, RAG assistants, files)
|
|
356
|
+
Migrate all available resource types (agents, tools, processes, tasks, usage limits, RAG assistants, files, secrets)
|
|
343
357
|
|
|
344
358
|
``--agents <all|id1,id2,...>``
|
|
345
359
|
Migrate all agents or specific agents by ID (comma-separated)
|
|
@@ -362,6 +376,9 @@ Command: ``geai migrate clone-project``
|
|
|
362
376
|
``--files <all|id1,id2,...>``
|
|
363
377
|
Migrate all files or specific files by ID (comma-separated)
|
|
364
378
|
|
|
379
|
+
``--secrets <all|id1,id2,...>``
|
|
380
|
+
Migrate all secrets or specific secrets by ID (comma-separated)
|
|
381
|
+
|
|
365
382
|
``--stop-on-error <0|1>`` or ``--soe <0|1>``
|
|
366
383
|
Control migration behavior on errors. Set to ``1`` (default) to stop migration on first error, or ``0`` to continue migrating remaining resources even if some fail
|
|
367
384
|
|
pygeai/_docs/source/index.rst
CHANGED
|
@@ -15,6 +15,7 @@ Getting Started
|
|
|
15
15
|
|
|
16
16
|
content/intro
|
|
17
17
|
content/quickstart
|
|
18
|
+
content/authentication
|
|
18
19
|
|
|
19
20
|
Core Features & API Reference
|
|
20
21
|
-------------------------------
|
|
@@ -52,6 +53,7 @@ Tools & Utilities
|
|
|
52
53
|
.. toctree::
|
|
53
54
|
:maxdepth: 2
|
|
54
55
|
|
|
56
|
+
content/migration
|
|
55
57
|
content/cli
|
|
56
58
|
content/chat_gui
|
|
57
59
|
content/debugger
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
pygeai.analytics package
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
pygeai.analytics.clients module
|
|
8
|
+
-------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: pygeai.analytics.clients
|
|
11
|
+
:members:
|
|
12
|
+
:show-inheritance:
|
|
13
|
+
:undoc-members:
|
|
14
|
+
|
|
15
|
+
pygeai.analytics.endpoints module
|
|
16
|
+
---------------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: pygeai.analytics.endpoints
|
|
19
|
+
:members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
:undoc-members:
|
|
22
|
+
|
|
23
|
+
pygeai.analytics.managers module
|
|
24
|
+
--------------------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: pygeai.analytics.managers
|
|
27
|
+
:members:
|
|
28
|
+
:show-inheritance:
|
|
29
|
+
:undoc-members:
|
|
30
|
+
|
|
31
|
+
pygeai.analytics.mappers module
|
|
32
|
+
-------------------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: pygeai.analytics.mappers
|
|
35
|
+
:members:
|
|
36
|
+
:show-inheritance:
|
|
37
|
+
:undoc-members:
|
|
38
|
+
|
|
39
|
+
pygeai.analytics.responses module
|
|
40
|
+
---------------------------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: pygeai.analytics.responses
|
|
43
|
+
:members:
|
|
44
|
+
:show-inheritance:
|
|
45
|
+
:undoc-members:
|
|
46
|
+
|
|
47
|
+
Module contents
|
|
48
|
+
---------------
|
|
49
|
+
|
|
50
|
+
.. automodule:: pygeai.analytics
|
|
51
|
+
:members:
|
|
52
|
+
:show-inheritance:
|
|
53
|
+
:undoc-members:
|
|
@@ -21,6 +21,14 @@ pygeai.cli.commands.admin module
|
|
|
21
21
|
:show-inheritance:
|
|
22
22
|
:undoc-members:
|
|
23
23
|
|
|
24
|
+
pygeai.cli.commands.analytics module
|
|
25
|
+
------------------------------------
|
|
26
|
+
|
|
27
|
+
.. automodule:: pygeai.cli.commands.analytics
|
|
28
|
+
:members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
:undoc-members:
|
|
31
|
+
|
|
24
32
|
pygeai.cli.commands.assistant module
|
|
25
33
|
------------------------------------
|
|
26
34
|
|
pygeai/_docs/source/pygeai.rst
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
pygeai.tests.analytics package
|
|
2
|
+
==============================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
pygeai.tests.analytics.test\_clients module
|
|
8
|
+
-------------------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: pygeai.tests.analytics.test_clients
|
|
11
|
+
:members:
|
|
12
|
+
:show-inheritance:
|
|
13
|
+
:undoc-members:
|
|
14
|
+
|
|
15
|
+
pygeai.tests.analytics.test\_managers module
|
|
16
|
+
--------------------------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: pygeai.tests.analytics.test_managers
|
|
19
|
+
:members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
:undoc-members:
|
|
22
|
+
|
|
23
|
+
pygeai.tests.analytics.test\_mappers module
|
|
24
|
+
-------------------------------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: pygeai.tests.analytics.test_mappers
|
|
27
|
+
:members:
|
|
28
|
+
:show-inheritance:
|
|
29
|
+
:undoc-members:
|
|
30
|
+
|
|
31
|
+
pygeai.tests.analytics.test\_responses module
|
|
32
|
+
---------------------------------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: pygeai.tests.analytics.test_responses
|
|
35
|
+
:members:
|
|
36
|
+
:show-inheritance:
|
|
37
|
+
:undoc-members:
|
|
38
|
+
|
|
39
|
+
Module contents
|
|
40
|
+
---------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: pygeai.tests.analytics
|
|
43
|
+
:members:
|
|
44
|
+
:show-inheritance:
|
|
45
|
+
:undoc-members:
|
|
@@ -12,6 +12,14 @@ pygeai.tests.auth.test\_clients module
|
|
|
12
12
|
:show-inheritance:
|
|
13
13
|
:undoc-members:
|
|
14
14
|
|
|
15
|
+
pygeai.tests.auth.test\_oauth module
|
|
16
|
+
------------------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: pygeai.tests.auth.test_oauth
|
|
19
|
+
:members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
:undoc-members:
|
|
22
|
+
|
|
15
23
|
Module contents
|
|
16
24
|
---------------
|
|
17
25
|
|
|
@@ -8,6 +8,7 @@ Subpackages
|
|
|
8
8
|
:maxdepth: 4
|
|
9
9
|
|
|
10
10
|
pygeai.tests.admin
|
|
11
|
+
pygeai.tests.analytics
|
|
11
12
|
pygeai.tests.assistants
|
|
12
13
|
pygeai.tests.auth
|
|
13
14
|
pygeai.tests.chat
|
|
@@ -22,7 +23,6 @@ Subpackages
|
|
|
22
23
|
pygeai.tests.migration
|
|
23
24
|
pygeai.tests.organization
|
|
24
25
|
pygeai.tests.proxy
|
|
25
|
-
pygeai.tests.snippets
|
|
26
26
|
|
|
27
27
|
Module contents
|
|
28
28
|
---------------
|
|
File without changes
|