pygeai 0.6.0b11__py3-none-any.whl → 0.6.0b13__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/assistant/managers.py +1 -1
- pygeai/chat/managers.py +1 -1
- 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 +106 -18
- 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 +59 -7
- pygeai/core/common/config.py +25 -2
- pygeai/core/common/exceptions.py +64 -1
- pygeai/core/embeddings/managers.py +1 -1
- pygeai/core/files/managers.py +1 -1
- pygeai/core/rerank/managers.py +1 -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 +8 -10
- 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/limits/managers.py +1 -1
- pygeai/organization/managers.py +135 -3
- 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.0b13.dist-info}/METADATA +1 -1
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/RECORD +108 -98
- 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.0b13.dist-info}/WHEEL +0 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/entry_points.txt +0 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
Analytics
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
The GEAI Analytics module provides comprehensive insights into your GEAI platform usage, costs, performance, and adoption metrics. Through the PyGEAI SDK's ``analytics`` CLI command, you can access detailed analytics data programmatically, enabling you to monitor platform usage, track costs, identify trends, and generate reports for stakeholders.
|
|
5
|
+
|
|
6
|
+
.. contents:: Table of Contents
|
|
7
|
+
:depth: 3
|
|
8
|
+
:local:
|
|
9
|
+
|
|
10
|
+
Overview
|
|
11
|
+
--------
|
|
12
|
+
|
|
13
|
+
The Analytics module offers access to various metrics across different dimensions:
|
|
14
|
+
|
|
15
|
+
- **Lab Metrics**: Track creation and modification of agents, flows, and processes
|
|
16
|
+
- **Request Metrics**: Monitor total requests, error rates, and response times
|
|
17
|
+
- **Cost Metrics**: Analyze spending patterns and cost per request
|
|
18
|
+
- **Token Metrics**: Track token consumption across users and agents
|
|
19
|
+
- **User & Agent Activity**: Monitor active users, agents, and projects
|
|
20
|
+
- **Top Performers**: Identify top agents and users by requests, tokens, and cost
|
|
21
|
+
|
|
22
|
+
All analytics commands support flexible date range filtering, with automatic defaults to the previous month when dates are not specified.
|
|
23
|
+
|
|
24
|
+
Prerequisites
|
|
25
|
+
-------------
|
|
26
|
+
|
|
27
|
+
- **CLI Installation**: Ensure the ``geai`` CLI is installed
|
|
28
|
+
- **Authentication**: Obtain your API token from the GEAI platform
|
|
29
|
+
- **Permissions**: Analytics access permissions are required
|
|
30
|
+
|
|
31
|
+
Set your API token as an environment variable:
|
|
32
|
+
|
|
33
|
+
.. code-block:: bash
|
|
34
|
+
|
|
35
|
+
export GEAI_APITOKEN="your-api-token-here"
|
|
36
|
+
|
|
37
|
+
Date Range Defaults
|
|
38
|
+
-------------------
|
|
39
|
+
|
|
40
|
+
All analytics commands support optional date range parameters. When ``--start-date`` and ``--end-date`` are not specified, commands automatically default to the previous month.
|
|
41
|
+
|
|
42
|
+
**Example**: If today is January 15, 2024, the default range would be:
|
|
43
|
+
|
|
44
|
+
- **Start Date**: 2023-12-01 (first day of December)
|
|
45
|
+
- **End Date**: 2023-12-31 (last day of December)
|
|
46
|
+
|
|
47
|
+
Common Options
|
|
48
|
+
--------------
|
|
49
|
+
|
|
50
|
+
Most analytics commands support the following options:
|
|
51
|
+
|
|
52
|
+
``--start-date, -s DATE``
|
|
53
|
+
Start date for the analytics period in YYYY-MM-DD format.
|
|
54
|
+
**Default**: First day of the previous month
|
|
55
|
+
|
|
56
|
+
``--end-date, -e DATE``
|
|
57
|
+
End date for the analytics period in YYYY-MM-DD format.
|
|
58
|
+
**Default**: Last day of the previous month
|
|
59
|
+
|
|
60
|
+
``--agent-name, -a NAME``
|
|
61
|
+
Filter results by specific agent name (where applicable)
|
|
62
|
+
|
|
63
|
+
Available Commands
|
|
64
|
+
------------------
|
|
65
|
+
|
|
66
|
+
Help
|
|
67
|
+
^^^^
|
|
68
|
+
|
|
69
|
+
Display help information for analytics commands.
|
|
70
|
+
|
|
71
|
+
.. code-block:: bash
|
|
72
|
+
|
|
73
|
+
geai analytics help
|
|
74
|
+
geai analytics h
|
|
75
|
+
|
|
76
|
+
Lab Metrics
|
|
77
|
+
^^^^^^^^^^^
|
|
78
|
+
|
|
79
|
+
Agents Created and Modified
|
|
80
|
+
""""""""""""""""""""""""""""
|
|
81
|
+
|
|
82
|
+
Get the total number of agents created and modified within a date range.
|
|
83
|
+
|
|
84
|
+
**Command:**
|
|
85
|
+
|
|
86
|
+
.. code-block:: bash
|
|
87
|
+
|
|
88
|
+
geai analytics agents-created --start-date "2024-01-01" --end-date "2024-01-31"
|
|
89
|
+
geai analytics ac -s "2024-01-01" -e "2024-01-31"
|
|
90
|
+
|
|
91
|
+
**Example Output:**
|
|
92
|
+
|
|
93
|
+
.. code-block:: text
|
|
94
|
+
|
|
95
|
+
Agents created and modified:
|
|
96
|
+
Created: 15
|
|
97
|
+
Modified: 42
|
|
98
|
+
|
|
99
|
+
Request Metrics
|
|
100
|
+
^^^^^^^^^^^^^^^
|
|
101
|
+
|
|
102
|
+
Requests Per Day
|
|
103
|
+
""""""""""""""""
|
|
104
|
+
|
|
105
|
+
Get total requests per day, including error counts.
|
|
106
|
+
|
|
107
|
+
**Command:**
|
|
108
|
+
|
|
109
|
+
.. code-block:: bash
|
|
110
|
+
|
|
111
|
+
geai analytics requests-per-day --start-date "2024-01-01" --end-date "2024-01-31"
|
|
112
|
+
geai analytics rpd -s "2024-01-01" -e "2024-01-31"
|
|
113
|
+
|
|
114
|
+
**With agent filter:**
|
|
115
|
+
|
|
116
|
+
.. code-block:: bash
|
|
117
|
+
|
|
118
|
+
geai analytics rpd -s "2024-01-01" -e "2024-01-31" --agent-name "Sales Assistant"
|
|
119
|
+
|
|
120
|
+
**Example Output:**
|
|
121
|
+
|
|
122
|
+
.. code-block:: text
|
|
123
|
+
|
|
124
|
+
Total requests per day:
|
|
125
|
+
2024-01-01: 450 requests (5 errors)
|
|
126
|
+
2024-01-02: 523 requests (3 errors)
|
|
127
|
+
2024-01-03: 601 requests (8 errors)
|
|
128
|
+
...
|
|
129
|
+
|
|
130
|
+
Error Rate
|
|
131
|
+
""""""""""
|
|
132
|
+
|
|
133
|
+
Get the overall error rate as a percentage.
|
|
134
|
+
|
|
135
|
+
**Command:**
|
|
136
|
+
|
|
137
|
+
.. code-block:: bash
|
|
138
|
+
|
|
139
|
+
geai analytics error-rate --start-date "2024-01-01" --end-date "2024-01-31"
|
|
140
|
+
geai analytics er -s "2024-01-01" -e "2024-01-31"
|
|
141
|
+
|
|
142
|
+
**Example Output:**
|
|
143
|
+
|
|
144
|
+
.. code-block:: text
|
|
145
|
+
|
|
146
|
+
Overall error rate: 1.24%
|
|
147
|
+
|
|
148
|
+
Cost Metrics
|
|
149
|
+
^^^^^^^^^^^^
|
|
150
|
+
|
|
151
|
+
Total Cost
|
|
152
|
+
""""""""""
|
|
153
|
+
|
|
154
|
+
Get the total cost incurred during the specified period.
|
|
155
|
+
|
|
156
|
+
**Command:**
|
|
157
|
+
|
|
158
|
+
.. code-block:: bash
|
|
159
|
+
|
|
160
|
+
geai analytics total-cost --start-date "2024-01-01" --end-date "2024-01-31"
|
|
161
|
+
geai analytics tc -s "2024-01-01" -e "2024-01-31"
|
|
162
|
+
|
|
163
|
+
**Example Output:**
|
|
164
|
+
|
|
165
|
+
.. code-block:: text
|
|
166
|
+
|
|
167
|
+
Total cost: $456.78
|
|
168
|
+
|
|
169
|
+
Average Cost Per Request
|
|
170
|
+
""""""""""""""""""""""""
|
|
171
|
+
|
|
172
|
+
Get the average cost per request.
|
|
173
|
+
|
|
174
|
+
**Command:**
|
|
175
|
+
|
|
176
|
+
.. code-block:: bash
|
|
177
|
+
|
|
178
|
+
geai analytics average-cost --start-date "2024-01-01" --end-date "2024-01-31"
|
|
179
|
+
geai analytics ac -s "2024-01-01" -e "2024-01-31"
|
|
180
|
+
|
|
181
|
+
**Example Output:**
|
|
182
|
+
|
|
183
|
+
.. code-block:: text
|
|
184
|
+
|
|
185
|
+
Average cost per request: $0.0367
|
|
186
|
+
|
|
187
|
+
Token Metrics
|
|
188
|
+
^^^^^^^^^^^^^
|
|
189
|
+
|
|
190
|
+
Total Tokens
|
|
191
|
+
""""""""""""
|
|
192
|
+
|
|
193
|
+
Get total input, output, and combined token counts.
|
|
194
|
+
|
|
195
|
+
**Command:**
|
|
196
|
+
|
|
197
|
+
.. code-block:: bash
|
|
198
|
+
|
|
199
|
+
geai analytics total-tokens --start-date "2024-01-01" --end-date "2024-01-31"
|
|
200
|
+
geai analytics tt -s "2024-01-01" -e "2024-01-31"
|
|
201
|
+
|
|
202
|
+
**Example Output:**
|
|
203
|
+
|
|
204
|
+
.. code-block:: text
|
|
205
|
+
|
|
206
|
+
Total tokens:
|
|
207
|
+
Input: 1,234,567
|
|
208
|
+
Output: 987,654
|
|
209
|
+
Total: 2,222,221
|
|
210
|
+
|
|
211
|
+
User & Agent Metrics
|
|
212
|
+
^^^^^^^^^^^^^^^^^^^^
|
|
213
|
+
|
|
214
|
+
Active Users
|
|
215
|
+
""""""""""""
|
|
216
|
+
|
|
217
|
+
Get the total number of active users during the period.
|
|
218
|
+
|
|
219
|
+
**Command:**
|
|
220
|
+
|
|
221
|
+
.. code-block:: bash
|
|
222
|
+
|
|
223
|
+
geai analytics active-users --start-date "2024-01-01" --end-date "2024-01-31"
|
|
224
|
+
geai analytics au -s "2024-01-01" -e "2024-01-31"
|
|
225
|
+
|
|
226
|
+
**Example Output:**
|
|
227
|
+
|
|
228
|
+
.. code-block:: text
|
|
229
|
+
|
|
230
|
+
Total active users: 45
|
|
231
|
+
|
|
232
|
+
Top Performers
|
|
233
|
+
^^^^^^^^^^^^^^
|
|
234
|
+
|
|
235
|
+
Top Agents by Requests
|
|
236
|
+
"""""""""""""""""""""""
|
|
237
|
+
|
|
238
|
+
Get the top 10 agents ranked by number of requests.
|
|
239
|
+
|
|
240
|
+
**Command:**
|
|
241
|
+
|
|
242
|
+
.. code-block:: bash
|
|
243
|
+
|
|
244
|
+
geai analytics top-agents --start-date "2024-01-01" --end-date "2024-01-31"
|
|
245
|
+
geai analytics ta -s "2024-01-01" -e "2024-01-31"
|
|
246
|
+
|
|
247
|
+
**Example Output:**
|
|
248
|
+
|
|
249
|
+
.. code-block:: text
|
|
250
|
+
|
|
251
|
+
Top 10 agents by requests:
|
|
252
|
+
1. Sales Assistant: 2,340 requests
|
|
253
|
+
2. Customer Support Bot: 1,890 requests
|
|
254
|
+
3. Code Reviewer: 1,456 requests
|
|
255
|
+
4. Data Analyst: 1,234 requests
|
|
256
|
+
5. Content Generator: 1,089 requests
|
|
257
|
+
...
|
|
258
|
+
|
|
259
|
+
Full Report
|
|
260
|
+
^^^^^^^^^^^
|
|
261
|
+
|
|
262
|
+
Get a comprehensive analytics report combining all metrics.
|
|
263
|
+
|
|
264
|
+
**Command:**
|
|
265
|
+
|
|
266
|
+
.. code-block:: bash
|
|
267
|
+
|
|
268
|
+
geai analytics full-report
|
|
269
|
+
geai analytics fr
|
|
270
|
+
|
|
271
|
+
**With custom date range:**
|
|
272
|
+
|
|
273
|
+
.. code-block:: bash
|
|
274
|
+
|
|
275
|
+
geai analytics full-report --start-date "2024-01-01" --end-date "2024-01-31"
|
|
276
|
+
geai analytics fr -s "2024-01-01" -e "2024-01-31"
|
|
277
|
+
|
|
278
|
+
**Export to CSV:**
|
|
279
|
+
|
|
280
|
+
.. code-block:: bash
|
|
281
|
+
|
|
282
|
+
geai analytics full-report --csv report.csv
|
|
283
|
+
geai analytics fr -s "2024-01-01" -e "2024-01-31" -c january_report.csv
|
|
284
|
+
|
|
285
|
+
**Report Sections:**
|
|
286
|
+
|
|
287
|
+
1. **Lab Metrics**
|
|
288
|
+
|
|
289
|
+
- Agents Created
|
|
290
|
+
- Agents Modified
|
|
291
|
+
- Flows Created
|
|
292
|
+
- Flows Modified
|
|
293
|
+
- Processes Created
|
|
294
|
+
- Processes Modified
|
|
295
|
+
|
|
296
|
+
2. **Request Metrics**
|
|
297
|
+
|
|
298
|
+
- Total Requests
|
|
299
|
+
- Total Requests with Error
|
|
300
|
+
- Overall Error Rate
|
|
301
|
+
- Average Request Time (ms)
|
|
302
|
+
|
|
303
|
+
3. **Cost Metrics**
|
|
304
|
+
|
|
305
|
+
- Total Cost (USD)
|
|
306
|
+
- Average Cost per Request (USD)
|
|
307
|
+
|
|
308
|
+
4. **Token Metrics**
|
|
309
|
+
|
|
310
|
+
- Total Input Tokens
|
|
311
|
+
- Total Output Tokens
|
|
312
|
+
- Total Tokens
|
|
313
|
+
- Average Input Tokens per Request
|
|
314
|
+
- Average Output Tokens per Request
|
|
315
|
+
- Average Total Tokens per Request
|
|
316
|
+
|
|
317
|
+
5. **User & Agent Metrics**
|
|
318
|
+
|
|
319
|
+
- Total Active Users
|
|
320
|
+
- Total Active Agents
|
|
321
|
+
- Total Active Projects
|
|
322
|
+
|
|
323
|
+
6. **Top 10 Agents by Requests**
|
|
324
|
+
7. **Top 10 Agents by Tokens**
|
|
325
|
+
8. **Top 10 Users by Requests**
|
|
326
|
+
9. **Top 10 Users by Cost**
|
|
327
|
+
|
|
328
|
+
**Example Output:**
|
|
329
|
+
|
|
330
|
+
.. code-block:: text
|
|
331
|
+
|
|
332
|
+
Using default date range: 2023-12-01 to 2023-12-31
|
|
333
|
+
|
|
334
|
+
================================================================================
|
|
335
|
+
ANALYTICS FULL REPORT - Period: 2023-12-01 to 2023-12-31
|
|
336
|
+
================================================================================
|
|
337
|
+
|
|
338
|
+
LAB METRICS
|
|
339
|
+
--------------------------------------------------------------------------------
|
|
340
|
+
Agents Created: 15
|
|
341
|
+
Agents Modified: 42
|
|
342
|
+
Flows Created: 8
|
|
343
|
+
Flows Modified: 23
|
|
344
|
+
Processes Created: 5
|
|
345
|
+
Processes Modified: 12
|
|
346
|
+
|
|
347
|
+
REQUEST METRICS
|
|
348
|
+
--------------------------------------------------------------------------------
|
|
349
|
+
Total Requests: 12,450
|
|
350
|
+
Total Requests with Error: 125
|
|
351
|
+
Overall Error Rate: 1.00%
|
|
352
|
+
Average Request Time: 1,234.56 ms
|
|
353
|
+
|
|
354
|
+
COST METRICS
|
|
355
|
+
--------------------------------------------------------------------------------
|
|
356
|
+
Total Cost: $456.78
|
|
357
|
+
Average Cost per Request: $0.0367
|
|
358
|
+
|
|
359
|
+
TOKEN METRICS
|
|
360
|
+
--------------------------------------------------------------------------------
|
|
361
|
+
Total Input Tokens: 1,234,567
|
|
362
|
+
Total Output Tokens: 987,654
|
|
363
|
+
Total Tokens: 2,222,221
|
|
364
|
+
Average Input Tokens per Request: 99.50
|
|
365
|
+
Average Output Tokens per Request: 79.00
|
|
366
|
+
Average Total Tokens per Request: 178.50
|
|
367
|
+
|
|
368
|
+
USER & AGENT METRICS
|
|
369
|
+
--------------------------------------------------------------------------------
|
|
370
|
+
Total Active Users: 45
|
|
371
|
+
Total Active Agents: 28
|
|
372
|
+
Total Active Projects: 12
|
|
373
|
+
|
|
374
|
+
TOP 10 AGENTS BY REQUESTS
|
|
375
|
+
--------------------------------------------------------------------------------
|
|
376
|
+
1. Sales Assistant: 2,340 requests
|
|
377
|
+
2. Customer Support Bot: 1,890 requests
|
|
378
|
+
...
|
|
379
|
+
|
|
380
|
+
================================================================================
|
|
381
|
+
|
|
382
|
+
**CSV Export Format:**
|
|
383
|
+
|
|
384
|
+
.. code-block:: text
|
|
385
|
+
|
|
386
|
+
Metric,Value
|
|
387
|
+
Report Period,2024-01-01 to 2024-01-31
|
|
388
|
+
Generated At,2024-02-15 14:30:45
|
|
389
|
+
|
|
390
|
+
Agents Created,15
|
|
391
|
+
Agents Modified,42
|
|
392
|
+
Flows Created,8
|
|
393
|
+
Flows Modified,23
|
|
394
|
+
Processes Created,5
|
|
395
|
+
Processes Modified,12
|
|
396
|
+
Total Requests,12450
|
|
397
|
+
Total Requests with Error,125
|
|
398
|
+
Overall Error Rate (%),1.00%
|
|
399
|
+
Average Request Time (ms),1234.56
|
|
400
|
+
Total Cost (USD),456.78
|
|
401
|
+
Average Cost per Request (USD),0.0367
|
|
402
|
+
Total Input Tokens,1234567
|
|
403
|
+
Total Output Tokens,987654
|
|
404
|
+
Total Tokens,2222221
|
|
405
|
+
Average Tokens per Request,178.50
|
|
406
|
+
Total Active Users,45
|
|
407
|
+
Total Active Agents,28
|
|
408
|
+
Total Active Projects,12
|
|
409
|
+
|
|
410
|
+
Python SDK Usage
|
|
411
|
+
----------------
|
|
412
|
+
|
|
413
|
+
In addition to the CLI, you can use the Analytics module programmatically through the Python SDK.
|
|
414
|
+
|
|
415
|
+
**Example:**
|
|
416
|
+
|
|
417
|
+
.. code-block:: python
|
|
418
|
+
|
|
419
|
+
from pygeai.analytics.managers import AnalyticsManager
|
|
420
|
+
|
|
421
|
+
# Initialize the manager
|
|
422
|
+
manager = AnalyticsManager()
|
|
423
|
+
|
|
424
|
+
# Get agents created and modified
|
|
425
|
+
result = manager.get_agents_created_and_modified(
|
|
426
|
+
start_date="2024-01-01",
|
|
427
|
+
end_date="2024-01-31"
|
|
428
|
+
)
|
|
429
|
+
print(f"Created: {result.createdAgents}")
|
|
430
|
+
print(f"Modified: {result.modifiedAgents}")
|
|
431
|
+
|
|
432
|
+
# Get total cost
|
|
433
|
+
cost = manager.get_total_cost(
|
|
434
|
+
start_date="2024-01-01",
|
|
435
|
+
end_date="2024-01-31"
|
|
436
|
+
)
|
|
437
|
+
print(f"Total Cost: ${cost.totalCost:.2f}")
|
|
438
|
+
|
|
439
|
+
# Get top agents by requests
|
|
440
|
+
top_agents = manager.get_top_10_agents_by_requests(
|
|
441
|
+
start_date="2024-01-01",
|
|
442
|
+
end_date="2024-01-31"
|
|
443
|
+
)
|
|
444
|
+
for agent in top_agents.topAgents:
|
|
445
|
+
print(f"{agent.agentName}: {agent.totalRequests} requests")
|
|
446
|
+
|
|
447
|
+
Available Manager Methods
|
|
448
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
449
|
+
|
|
450
|
+
**Lab Metrics:**
|
|
451
|
+
|
|
452
|
+
- ``get_agents_created_and_modified(start_date, end_date)``
|
|
453
|
+
- ``get_agents_created_and_modified_per_day(start_date, end_date)``
|
|
454
|
+
- ``get_flows_created_and_modified(start_date, end_date)``
|
|
455
|
+
- ``get_flows_created_and_modified_per_day(start_date, end_date)``
|
|
456
|
+
- ``get_processes_created_and_modified(start_date, end_date)``
|
|
457
|
+
|
|
458
|
+
**Request Metrics:**
|
|
459
|
+
|
|
460
|
+
- ``get_total_requests(start_date, end_date, agent_name=None)``
|
|
461
|
+
- ``get_total_requests_per_day(start_date, end_date, agent_name=None)``
|
|
462
|
+
- ``get_total_requests_with_error(start_date, end_date)``
|
|
463
|
+
- ``get_overall_error_rate(start_date, end_date)``
|
|
464
|
+
- ``get_average_request_time(start_date, end_date)``
|
|
465
|
+
- ``get_average_requests_per_day(start_date, end_date)``
|
|
466
|
+
- ``get_average_requests_per_user(start_date, end_date)``
|
|
467
|
+
- ``get_average_requests_per_user_per_date(start_date, end_date)``
|
|
468
|
+
|
|
469
|
+
**Cost Metrics:**
|
|
470
|
+
|
|
471
|
+
- ``get_total_cost(start_date, end_date)``
|
|
472
|
+
- ``get_total_cost_per_day(start_date, end_date)``
|
|
473
|
+
- ``get_average_cost_per_request(start_date, end_date)``
|
|
474
|
+
- ``get_average_cost_per_user(start_date, end_date)``
|
|
475
|
+
- ``get_average_cost_per_user_per_date(start_date, end_date)``
|
|
476
|
+
|
|
477
|
+
**Token Metrics:**
|
|
478
|
+
|
|
479
|
+
- ``get_total_tokens(start_date, end_date)``
|
|
480
|
+
- ``get_number_of_tokens_per_agent(start_date, end_date)``
|
|
481
|
+
- ``get_number_of_tokens_per_day(start_date, end_date)``
|
|
482
|
+
- ``get_average_tokens_per_request(start_date, end_date)``
|
|
483
|
+
|
|
484
|
+
**User & Agent Metrics:**
|
|
485
|
+
|
|
486
|
+
- ``get_total_active_users(start_date, end_date, agent_name=None)``
|
|
487
|
+
- ``get_total_active_agents(start_date, end_date)``
|
|
488
|
+
- ``get_total_active_projects(start_date, end_date)``
|
|
489
|
+
- ``get_agent_usage_per_user(start_date, end_date)``
|
|
490
|
+
- ``get_average_users_per_agent(start_date, end_date)``
|
|
491
|
+
- ``get_average_users_per_project(start_date, end_date)``
|
|
492
|
+
|
|
493
|
+
**Top Performers:**
|
|
494
|
+
|
|
495
|
+
- ``get_top_10_agents_by_requests(start_date, end_date)``
|
|
496
|
+
- ``get_top_10_agents_by_tokens(start_date, end_date)``
|
|
497
|
+
- ``get_top_10_users_by_requests(start_date, end_date)``
|
|
498
|
+
- ``get_top_10_users_by_cost(start_date, end_date)``
|
|
499
|
+
|
|
500
|
+
Best Practices
|
|
501
|
+
--------------
|
|
502
|
+
|
|
503
|
+
1. **Regular Monitoring**: Run analytics reports regularly to track trends and identify patterns
|
|
504
|
+
2. **CSV Export**: Export to CSV for further analysis in spreadsheet applications or BI tools
|
|
505
|
+
3. **Compare Periods**: Generate reports for different time periods to compare performance
|
|
506
|
+
4. **Cost Optimization**: Monitor cost metrics to identify opportunities for optimization
|
|
507
|
+
5. **Error Analysis**: Track error rates to quickly identify and address issues
|
|
508
|
+
6. **Resource Planning**: Use active user and agent metrics for capacity planning
|
|
509
|
+
7. **Performance Tuning**: Monitor average request times to identify performance bottlenecks
|
|
510
|
+
|
|
511
|
+
Common Use Cases
|
|
512
|
+
----------------
|
|
513
|
+
|
|
514
|
+
Monthly Reporting
|
|
515
|
+
^^^^^^^^^^^^^^^^^
|
|
516
|
+
|
|
517
|
+
Generate a monthly report automatically using default dates:
|
|
518
|
+
|
|
519
|
+
.. code-block:: bash
|
|
520
|
+
|
|
521
|
+
#!/bin/bash
|
|
522
|
+
# Run on the 1st of each month
|
|
523
|
+
REPORT_FILE="analytics_$(date -d 'last month' +%Y-%m).csv"
|
|
524
|
+
geai analytics full-report --csv "$REPORT_FILE"
|
|
525
|
+
|
|
526
|
+
Cost Tracking
|
|
527
|
+
^^^^^^^^^^^^^
|
|
528
|
+
|
|
529
|
+
Track costs over time:
|
|
530
|
+
|
|
531
|
+
.. code-block:: bash
|
|
532
|
+
|
|
533
|
+
# Q1 2024
|
|
534
|
+
geai analytics total-cost -s "2024-01-01" -e "2024-03-31"
|
|
535
|
+
|
|
536
|
+
# Compare to Q4 2023
|
|
537
|
+
geai analytics total-cost -s "2023-10-01" -e "2023-12-31"
|
|
538
|
+
|
|
539
|
+
Performance Monitoring
|
|
540
|
+
^^^^^^^^^^^^^^^^^^^^^^
|
|
541
|
+
|
|
542
|
+
Monitor error rates and response times:
|
|
543
|
+
|
|
544
|
+
.. code-block:: bash
|
|
545
|
+
|
|
546
|
+
geai analytics error-rate -s "2024-01-01" -e "2024-01-31"
|
|
547
|
+
geai analytics requests-per-day -s "2024-01-01" -e "2024-01-31"
|
|
548
|
+
|
|
549
|
+
Agent Analysis
|
|
550
|
+
^^^^^^^^^^^^^^
|
|
551
|
+
|
|
552
|
+
Identify top-performing agents:
|
|
553
|
+
|
|
554
|
+
.. code-block:: bash
|
|
555
|
+
|
|
556
|
+
geai analytics top-agents -s "2024-01-01" -e "2024-01-31"
|
|
557
|
+
|
|
558
|
+
Troubleshooting
|
|
559
|
+
---------------
|
|
560
|
+
|
|
561
|
+
**Error: Authentication Failed**
|
|
562
|
+
|
|
563
|
+
Ensure your API token is properly configured:
|
|
564
|
+
|
|
565
|
+
.. code-block:: bash
|
|
566
|
+
|
|
567
|
+
export GEAI_APITOKEN="your-api-token-here"
|
|
568
|
+
|
|
569
|
+
**Error: Insufficient Permissions**
|
|
570
|
+
|
|
571
|
+
Contact your GEAI administrator to ensure you have analytics access permissions.
|
|
572
|
+
|
|
573
|
+
**Empty Results**
|
|
574
|
+
|
|
575
|
+
If metrics show zero or empty values:
|
|
576
|
+
|
|
577
|
+
- Verify the date range includes periods with activity
|
|
578
|
+
- Check that you're querying the correct organization/project
|
|
579
|
+
- Ensure there was actual usage during the specified period
|
|
580
|
+
|
|
581
|
+
**Date Format Errors**
|
|
582
|
+
|
|
583
|
+
Always use YYYY-MM-DD format for dates:
|
|
584
|
+
|
|
585
|
+
.. code-block:: bash
|
|
586
|
+
|
|
587
|
+
# Correct
|
|
588
|
+
geai analytics total-cost -s "2024-01-01" -e "2024-01-31"
|
|
589
|
+
|
|
590
|
+
# Incorrect
|
|
591
|
+
geai analytics total-cost -s "01/01/2024" -e "01/31/2024"
|
|
592
|
+
|
|
593
|
+
See Also
|
|
594
|
+
--------
|
|
595
|
+
|
|
596
|
+
- :doc:`cli` - General CLI documentation
|
|
597
|
+
- API Documentation: https://docs.globant.ai/en/wiki?2725,Analytics+API
|
|
598
|
+
- ``geai analytics help`` - View all available analytics commands
|