studyfetch-sdk 0.1.0a2__py3-none-any.whl → 0.1.0a3__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.
- studyfetch_sdk/_version.py +1 -1
- studyfetch_sdk/resources/v1/__init__.py +0 -14
- studyfetch_sdk/resources/v1/auth/__init__.py +0 -28
- studyfetch_sdk/resources/v1/auth/auth.py +0 -504
- studyfetch_sdk/resources/v1/auth/number_2fa.py +1 -294
- studyfetch_sdk/resources/v1/usage.py +1 -593
- studyfetch_sdk/resources/v1/v1.py +0 -32
- studyfetch_sdk/types/v1/__init__.py +0 -5
- studyfetch_sdk/types/v1/auth/__init__.py +0 -8
- {studyfetch_sdk-0.1.0a2.dist-info → studyfetch_sdk-0.1.0a3.dist-info}/METADATA +11 -35
- {studyfetch_sdk-0.1.0a2.dist-info → studyfetch_sdk-0.1.0a3.dist-info}/RECORD +13 -41
- studyfetch_sdk/resources/v1/auth/login.py +0 -374
- studyfetch_sdk/resources/v1/auth/organization_invites.py +0 -160
- studyfetch_sdk/resources/v1/organizations/__init__.py +0 -103
- studyfetch_sdk/resources/v1/organizations/api_keys.py +0 -260
- studyfetch_sdk/resources/v1/organizations/logo/__init__.py +0 -33
- studyfetch_sdk/resources/v1/organizations/logo/logo.py +0 -166
- studyfetch_sdk/resources/v1/organizations/logo/upload.py +0 -184
- studyfetch_sdk/resources/v1/organizations/organizations.py +0 -428
- studyfetch_sdk/resources/v1/organizations/profile/__init__.py +0 -47
- studyfetch_sdk/resources/v1/organizations/profile/models.py +0 -134
- studyfetch_sdk/resources/v1/organizations/profile/profile.py +0 -248
- studyfetch_sdk/resources/v1/organizations/profile/team.py +0 -462
- studyfetch_sdk/resources/v1/organizations/team/__init__.py +0 -33
- studyfetch_sdk/resources/v1/organizations/team/invite.py +0 -236
- studyfetch_sdk/resources/v1/organizations/team/team.py +0 -564
- studyfetch_sdk/resources/v1/organizations/theme.py +0 -184
- studyfetch_sdk/resources/v1/organizations/usage.py +0 -210
- studyfetch_sdk/types/v1/auth/login_authenticate_params.py +0 -15
- studyfetch_sdk/types/v1/auth/login_verify_2fa_params.py +0 -15
- studyfetch_sdk/types/v1/auth/login_verify_backup_code_params.py +0 -17
- studyfetch_sdk/types/v1/auth/number_2fa_disable_params.py +0 -12
- studyfetch_sdk/types/v1/auth/number_2fa_enable_params.py +0 -12
- studyfetch_sdk/types/v1/auth/number_2fa_regenerate_backup_codes_params.py +0 -12
- studyfetch_sdk/types/v1/auth_register_new_user_params.py +0 -23
- studyfetch_sdk/types/v1/auth_request_password_reset_params.py +0 -12
- studyfetch_sdk/types/v1/auth_reset_password_params.py +0 -17
- studyfetch_sdk/types/v1/usage_track_chat_params.py +0 -54
- studyfetch_sdk/types/v1/usage_track_event_params.py +0 -128
- {studyfetch_sdk-0.1.0a2.dist-info → studyfetch_sdk-0.1.0a3.dist-info}/WHEEL +0 -0
- {studyfetch_sdk-0.1.0a2.dist-info → studyfetch_sdk-0.1.0a3.dist-info}/licenses/LICENSE +0 -0
@@ -9,13 +9,7 @@ import httpx
|
|
9
9
|
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
10
10
|
from ..._utils import maybe_transform, async_maybe_transform
|
11
11
|
from ..._compat import cached_property
|
12
|
-
from ...types.v1 import
|
13
|
-
usage_get_stats_params,
|
14
|
-
usage_track_chat_params,
|
15
|
-
usage_get_summary_params,
|
16
|
-
usage_list_events_params,
|
17
|
-
usage_track_event_params,
|
18
|
-
)
|
12
|
+
from ...types.v1 import usage_get_stats_params, usage_get_summary_params, usage_list_events_params
|
19
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
20
14
|
from ..._response import (
|
21
15
|
to_raw_response_wrapper,
|
@@ -253,281 +247,6 @@ class UsageResource(SyncAPIResource):
|
|
253
247
|
cast_to=NoneType,
|
254
248
|
)
|
255
249
|
|
256
|
-
def track_chat(
|
257
|
-
self,
|
258
|
-
*,
|
259
|
-
input_tokens: float,
|
260
|
-
model: Literal[
|
261
|
-
"openai:gpt-4.1",
|
262
|
-
"openai:gpt-4o",
|
263
|
-
"openai:gpt-4o-mini",
|
264
|
-
"openai:gpt-4",
|
265
|
-
"openai:gpt-3.5-turbo",
|
266
|
-
"openai:o1",
|
267
|
-
"openai:o1-mini",
|
268
|
-
"openai:o3-mini",
|
269
|
-
"anthropic:claude-3-opus",
|
270
|
-
"anthropic:claude-3-sonnet",
|
271
|
-
"anthropic:claude-3-haiku",
|
272
|
-
"google:gemini-pro",
|
273
|
-
"meta:llama-3",
|
274
|
-
],
|
275
|
-
output_tokens: float,
|
276
|
-
session_id: str,
|
277
|
-
component_id: str | NotGiven = NOT_GIVEN,
|
278
|
-
group_id: str | NotGiven = NOT_GIVEN,
|
279
|
-
metadata: object | NotGiven = NOT_GIVEN,
|
280
|
-
reasoning_tokens: float | NotGiven = NOT_GIVEN,
|
281
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
282
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
283
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
284
|
-
extra_headers: Headers | None = None,
|
285
|
-
extra_query: Query | None = None,
|
286
|
-
extra_body: Body | None = None,
|
287
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
288
|
-
) -> None:
|
289
|
-
"""
|
290
|
-
Args:
|
291
|
-
input_tokens: Number of input tokens
|
292
|
-
|
293
|
-
model: AI model used
|
294
|
-
|
295
|
-
output_tokens: Number of output tokens
|
296
|
-
|
297
|
-
session_id: Chat session ID
|
298
|
-
|
299
|
-
component_id: Component ID
|
300
|
-
|
301
|
-
group_id: Group ID
|
302
|
-
|
303
|
-
metadata: Additional metadata
|
304
|
-
|
305
|
-
reasoning_tokens: Number of reasoning tokens
|
306
|
-
|
307
|
-
user_id: User ID
|
308
|
-
|
309
|
-
extra_headers: Send extra headers
|
310
|
-
|
311
|
-
extra_query: Add additional query parameters to the request
|
312
|
-
|
313
|
-
extra_body: Add additional JSON properties to the request
|
314
|
-
|
315
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
316
|
-
"""
|
317
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
318
|
-
return self._post(
|
319
|
-
"/api/v1/usage/chat",
|
320
|
-
body=maybe_transform(
|
321
|
-
{
|
322
|
-
"input_tokens": input_tokens,
|
323
|
-
"model": model,
|
324
|
-
"output_tokens": output_tokens,
|
325
|
-
"session_id": session_id,
|
326
|
-
"component_id": component_id,
|
327
|
-
"group_id": group_id,
|
328
|
-
"metadata": metadata,
|
329
|
-
"reasoning_tokens": reasoning_tokens,
|
330
|
-
"user_id": user_id,
|
331
|
-
},
|
332
|
-
usage_track_chat_params.UsageTrackChatParams,
|
333
|
-
),
|
334
|
-
options=make_request_options(
|
335
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
336
|
-
),
|
337
|
-
cast_to=NoneType,
|
338
|
-
)
|
339
|
-
|
340
|
-
def track_event(
|
341
|
-
self,
|
342
|
-
*,
|
343
|
-
event_type: Literal[
|
344
|
-
"material_created",
|
345
|
-
"material_uploaded",
|
346
|
-
"material_processed",
|
347
|
-
"material_deleted",
|
348
|
-
"component_created",
|
349
|
-
"component_accessed",
|
350
|
-
"component_deleted",
|
351
|
-
"component_usage",
|
352
|
-
"chat_message_sent",
|
353
|
-
"chat_session_started",
|
354
|
-
"chat_session_ended",
|
355
|
-
"test_created",
|
356
|
-
"test_started",
|
357
|
-
"test_completed",
|
358
|
-
"test_question_answered",
|
359
|
-
"test_retaken",
|
360
|
-
"audio_recap_create",
|
361
|
-
"api_call",
|
362
|
-
"cache_hit",
|
363
|
-
"sso_login",
|
364
|
-
"sso_logout",
|
365
|
-
"student_performance",
|
366
|
-
],
|
367
|
-
cache_hit: bool | NotGiven = NOT_GIVEN,
|
368
|
-
component_name: str | NotGiven = NOT_GIVEN,
|
369
|
-
component_type: str | NotGiven = NOT_GIVEN,
|
370
|
-
content_size: float | NotGiven = NOT_GIVEN,
|
371
|
-
endpoint: str | NotGiven = NOT_GIVEN,
|
372
|
-
file_size: float | NotGiven = NOT_GIVEN,
|
373
|
-
file_type: str | NotGiven = NOT_GIVEN,
|
374
|
-
group_id: str | NotGiven = NOT_GIVEN,
|
375
|
-
input_tokens: float | NotGiven = NOT_GIVEN,
|
376
|
-
ip_address: str | NotGiven = NOT_GIVEN,
|
377
|
-
metadata: object | NotGiven = NOT_GIVEN,
|
378
|
-
method: str | NotGiven = NOT_GIVEN,
|
379
|
-
model: Literal[
|
380
|
-
"openai:gpt-4.1",
|
381
|
-
"openai:gpt-4o",
|
382
|
-
"openai:gpt-4o-mini",
|
383
|
-
"openai:gpt-4",
|
384
|
-
"openai:gpt-3.5-turbo",
|
385
|
-
"openai:o1",
|
386
|
-
"openai:o1-mini",
|
387
|
-
"openai:o3-mini",
|
388
|
-
"anthropic:claude-3-opus",
|
389
|
-
"anthropic:claude-3-sonnet",
|
390
|
-
"anthropic:claude-3-haiku",
|
391
|
-
"google:gemini-pro",
|
392
|
-
"meta:llama-3",
|
393
|
-
]
|
394
|
-
| NotGiven = NOT_GIVEN,
|
395
|
-
output_tokens: float | NotGiven = NOT_GIVEN,
|
396
|
-
performance_data: object | NotGiven = NOT_GIVEN,
|
397
|
-
reasoning_tokens: float | NotGiven = NOT_GIVEN,
|
398
|
-
resource_id: str | NotGiven = NOT_GIVEN,
|
399
|
-
resource_type: str | NotGiven = NOT_GIVEN,
|
400
|
-
response_time: float | NotGiven = NOT_GIVEN,
|
401
|
-
session_id: str | NotGiven = NOT_GIVEN,
|
402
|
-
status_code: float | NotGiven = NOT_GIVEN,
|
403
|
-
total_tokens: float | NotGiven = NOT_GIVEN,
|
404
|
-
user_agent: str | NotGiven = NOT_GIVEN,
|
405
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
406
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
407
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
408
|
-
extra_headers: Headers | None = None,
|
409
|
-
extra_query: Query | None = None,
|
410
|
-
extra_body: Body | None = None,
|
411
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
412
|
-
) -> None:
|
413
|
-
"""
|
414
|
-
Args:
|
415
|
-
event_type: Type of usage event
|
416
|
-
|
417
|
-
cache_hit: Whether response was served from cache
|
418
|
-
|
419
|
-
component_name: Component name
|
420
|
-
|
421
|
-
component_type: Component type
|
422
|
-
|
423
|
-
content_size: Size of content in bytes
|
424
|
-
|
425
|
-
endpoint: API endpoint accessed
|
426
|
-
|
427
|
-
file_size: File size in bytes
|
428
|
-
|
429
|
-
file_type: File MIME type
|
430
|
-
|
431
|
-
group_id: Group ID for collaborative sessions
|
432
|
-
|
433
|
-
input_tokens: Number of input tokens
|
434
|
-
|
435
|
-
ip_address: Client IP address
|
436
|
-
|
437
|
-
metadata: Additional metadata
|
438
|
-
|
439
|
-
method: HTTP method used
|
440
|
-
|
441
|
-
model: AI model used
|
442
|
-
|
443
|
-
output_tokens: Number of output tokens
|
444
|
-
|
445
|
-
performance_data: Performance metrics data
|
446
|
-
|
447
|
-
reasoning_tokens: Number of reasoning tokens
|
448
|
-
|
449
|
-
resource_id: Resource ID being accessed
|
450
|
-
|
451
|
-
resource_type: Type of resource
|
452
|
-
|
453
|
-
response_time: Response time in milliseconds
|
454
|
-
|
455
|
-
session_id: Session ID
|
456
|
-
|
457
|
-
status_code: HTTP status code
|
458
|
-
|
459
|
-
total_tokens: Total number of tokens
|
460
|
-
|
461
|
-
user_agent: Client user agent
|
462
|
-
|
463
|
-
user_id: User ID
|
464
|
-
|
465
|
-
extra_headers: Send extra headers
|
466
|
-
|
467
|
-
extra_query: Add additional query parameters to the request
|
468
|
-
|
469
|
-
extra_body: Add additional JSON properties to the request
|
470
|
-
|
471
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
472
|
-
"""
|
473
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
474
|
-
return self._post(
|
475
|
-
"/api/v1/usage/track",
|
476
|
-
body=maybe_transform(
|
477
|
-
{
|
478
|
-
"event_type": event_type,
|
479
|
-
"cache_hit": cache_hit,
|
480
|
-
"component_name": component_name,
|
481
|
-
"component_type": component_type,
|
482
|
-
"content_size": content_size,
|
483
|
-
"endpoint": endpoint,
|
484
|
-
"file_size": file_size,
|
485
|
-
"file_type": file_type,
|
486
|
-
"group_id": group_id,
|
487
|
-
"input_tokens": input_tokens,
|
488
|
-
"ip_address": ip_address,
|
489
|
-
"metadata": metadata,
|
490
|
-
"method": method,
|
491
|
-
"model": model,
|
492
|
-
"output_tokens": output_tokens,
|
493
|
-
"performance_data": performance_data,
|
494
|
-
"reasoning_tokens": reasoning_tokens,
|
495
|
-
"resource_id": resource_id,
|
496
|
-
"resource_type": resource_type,
|
497
|
-
"response_time": response_time,
|
498
|
-
"session_id": session_id,
|
499
|
-
"status_code": status_code,
|
500
|
-
"total_tokens": total_tokens,
|
501
|
-
"user_agent": user_agent,
|
502
|
-
"user_id": user_id,
|
503
|
-
},
|
504
|
-
usage_track_event_params.UsageTrackEventParams,
|
505
|
-
),
|
506
|
-
options=make_request_options(
|
507
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
508
|
-
),
|
509
|
-
cast_to=NoneType,
|
510
|
-
)
|
511
|
-
|
512
|
-
def track_performance(
|
513
|
-
self,
|
514
|
-
*,
|
515
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
516
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
517
|
-
extra_headers: Headers | None = None,
|
518
|
-
extra_query: Query | None = None,
|
519
|
-
extra_body: Body | None = None,
|
520
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
521
|
-
) -> None:
|
522
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
523
|
-
return self._post(
|
524
|
-
"/api/v1/usage/performance",
|
525
|
-
options=make_request_options(
|
526
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
527
|
-
),
|
528
|
-
cast_to=NoneType,
|
529
|
-
)
|
530
|
-
|
531
250
|
|
532
251
|
class AsyncUsageResource(AsyncAPIResource):
|
533
252
|
@cached_property
|
@@ -754,281 +473,6 @@ class AsyncUsageResource(AsyncAPIResource):
|
|
754
473
|
cast_to=NoneType,
|
755
474
|
)
|
756
475
|
|
757
|
-
async def track_chat(
|
758
|
-
self,
|
759
|
-
*,
|
760
|
-
input_tokens: float,
|
761
|
-
model: Literal[
|
762
|
-
"openai:gpt-4.1",
|
763
|
-
"openai:gpt-4o",
|
764
|
-
"openai:gpt-4o-mini",
|
765
|
-
"openai:gpt-4",
|
766
|
-
"openai:gpt-3.5-turbo",
|
767
|
-
"openai:o1",
|
768
|
-
"openai:o1-mini",
|
769
|
-
"openai:o3-mini",
|
770
|
-
"anthropic:claude-3-opus",
|
771
|
-
"anthropic:claude-3-sonnet",
|
772
|
-
"anthropic:claude-3-haiku",
|
773
|
-
"google:gemini-pro",
|
774
|
-
"meta:llama-3",
|
775
|
-
],
|
776
|
-
output_tokens: float,
|
777
|
-
session_id: str,
|
778
|
-
component_id: str | NotGiven = NOT_GIVEN,
|
779
|
-
group_id: str | NotGiven = NOT_GIVEN,
|
780
|
-
metadata: object | NotGiven = NOT_GIVEN,
|
781
|
-
reasoning_tokens: float | NotGiven = NOT_GIVEN,
|
782
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
783
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
784
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
785
|
-
extra_headers: Headers | None = None,
|
786
|
-
extra_query: Query | None = None,
|
787
|
-
extra_body: Body | None = None,
|
788
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
789
|
-
) -> None:
|
790
|
-
"""
|
791
|
-
Args:
|
792
|
-
input_tokens: Number of input tokens
|
793
|
-
|
794
|
-
model: AI model used
|
795
|
-
|
796
|
-
output_tokens: Number of output tokens
|
797
|
-
|
798
|
-
session_id: Chat session ID
|
799
|
-
|
800
|
-
component_id: Component ID
|
801
|
-
|
802
|
-
group_id: Group ID
|
803
|
-
|
804
|
-
metadata: Additional metadata
|
805
|
-
|
806
|
-
reasoning_tokens: Number of reasoning tokens
|
807
|
-
|
808
|
-
user_id: User ID
|
809
|
-
|
810
|
-
extra_headers: Send extra headers
|
811
|
-
|
812
|
-
extra_query: Add additional query parameters to the request
|
813
|
-
|
814
|
-
extra_body: Add additional JSON properties to the request
|
815
|
-
|
816
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
817
|
-
"""
|
818
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
819
|
-
return await self._post(
|
820
|
-
"/api/v1/usage/chat",
|
821
|
-
body=await async_maybe_transform(
|
822
|
-
{
|
823
|
-
"input_tokens": input_tokens,
|
824
|
-
"model": model,
|
825
|
-
"output_tokens": output_tokens,
|
826
|
-
"session_id": session_id,
|
827
|
-
"component_id": component_id,
|
828
|
-
"group_id": group_id,
|
829
|
-
"metadata": metadata,
|
830
|
-
"reasoning_tokens": reasoning_tokens,
|
831
|
-
"user_id": user_id,
|
832
|
-
},
|
833
|
-
usage_track_chat_params.UsageTrackChatParams,
|
834
|
-
),
|
835
|
-
options=make_request_options(
|
836
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
837
|
-
),
|
838
|
-
cast_to=NoneType,
|
839
|
-
)
|
840
|
-
|
841
|
-
async def track_event(
|
842
|
-
self,
|
843
|
-
*,
|
844
|
-
event_type: Literal[
|
845
|
-
"material_created",
|
846
|
-
"material_uploaded",
|
847
|
-
"material_processed",
|
848
|
-
"material_deleted",
|
849
|
-
"component_created",
|
850
|
-
"component_accessed",
|
851
|
-
"component_deleted",
|
852
|
-
"component_usage",
|
853
|
-
"chat_message_sent",
|
854
|
-
"chat_session_started",
|
855
|
-
"chat_session_ended",
|
856
|
-
"test_created",
|
857
|
-
"test_started",
|
858
|
-
"test_completed",
|
859
|
-
"test_question_answered",
|
860
|
-
"test_retaken",
|
861
|
-
"audio_recap_create",
|
862
|
-
"api_call",
|
863
|
-
"cache_hit",
|
864
|
-
"sso_login",
|
865
|
-
"sso_logout",
|
866
|
-
"student_performance",
|
867
|
-
],
|
868
|
-
cache_hit: bool | NotGiven = NOT_GIVEN,
|
869
|
-
component_name: str | NotGiven = NOT_GIVEN,
|
870
|
-
component_type: str | NotGiven = NOT_GIVEN,
|
871
|
-
content_size: float | NotGiven = NOT_GIVEN,
|
872
|
-
endpoint: str | NotGiven = NOT_GIVEN,
|
873
|
-
file_size: float | NotGiven = NOT_GIVEN,
|
874
|
-
file_type: str | NotGiven = NOT_GIVEN,
|
875
|
-
group_id: str | NotGiven = NOT_GIVEN,
|
876
|
-
input_tokens: float | NotGiven = NOT_GIVEN,
|
877
|
-
ip_address: str | NotGiven = NOT_GIVEN,
|
878
|
-
metadata: object | NotGiven = NOT_GIVEN,
|
879
|
-
method: str | NotGiven = NOT_GIVEN,
|
880
|
-
model: Literal[
|
881
|
-
"openai:gpt-4.1",
|
882
|
-
"openai:gpt-4o",
|
883
|
-
"openai:gpt-4o-mini",
|
884
|
-
"openai:gpt-4",
|
885
|
-
"openai:gpt-3.5-turbo",
|
886
|
-
"openai:o1",
|
887
|
-
"openai:o1-mini",
|
888
|
-
"openai:o3-mini",
|
889
|
-
"anthropic:claude-3-opus",
|
890
|
-
"anthropic:claude-3-sonnet",
|
891
|
-
"anthropic:claude-3-haiku",
|
892
|
-
"google:gemini-pro",
|
893
|
-
"meta:llama-3",
|
894
|
-
]
|
895
|
-
| NotGiven = NOT_GIVEN,
|
896
|
-
output_tokens: float | NotGiven = NOT_GIVEN,
|
897
|
-
performance_data: object | NotGiven = NOT_GIVEN,
|
898
|
-
reasoning_tokens: float | NotGiven = NOT_GIVEN,
|
899
|
-
resource_id: str | NotGiven = NOT_GIVEN,
|
900
|
-
resource_type: str | NotGiven = NOT_GIVEN,
|
901
|
-
response_time: float | NotGiven = NOT_GIVEN,
|
902
|
-
session_id: str | NotGiven = NOT_GIVEN,
|
903
|
-
status_code: float | NotGiven = NOT_GIVEN,
|
904
|
-
total_tokens: float | NotGiven = NOT_GIVEN,
|
905
|
-
user_agent: str | NotGiven = NOT_GIVEN,
|
906
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
907
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
908
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
909
|
-
extra_headers: Headers | None = None,
|
910
|
-
extra_query: Query | None = None,
|
911
|
-
extra_body: Body | None = None,
|
912
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
913
|
-
) -> None:
|
914
|
-
"""
|
915
|
-
Args:
|
916
|
-
event_type: Type of usage event
|
917
|
-
|
918
|
-
cache_hit: Whether response was served from cache
|
919
|
-
|
920
|
-
component_name: Component name
|
921
|
-
|
922
|
-
component_type: Component type
|
923
|
-
|
924
|
-
content_size: Size of content in bytes
|
925
|
-
|
926
|
-
endpoint: API endpoint accessed
|
927
|
-
|
928
|
-
file_size: File size in bytes
|
929
|
-
|
930
|
-
file_type: File MIME type
|
931
|
-
|
932
|
-
group_id: Group ID for collaborative sessions
|
933
|
-
|
934
|
-
input_tokens: Number of input tokens
|
935
|
-
|
936
|
-
ip_address: Client IP address
|
937
|
-
|
938
|
-
metadata: Additional metadata
|
939
|
-
|
940
|
-
method: HTTP method used
|
941
|
-
|
942
|
-
model: AI model used
|
943
|
-
|
944
|
-
output_tokens: Number of output tokens
|
945
|
-
|
946
|
-
performance_data: Performance metrics data
|
947
|
-
|
948
|
-
reasoning_tokens: Number of reasoning tokens
|
949
|
-
|
950
|
-
resource_id: Resource ID being accessed
|
951
|
-
|
952
|
-
resource_type: Type of resource
|
953
|
-
|
954
|
-
response_time: Response time in milliseconds
|
955
|
-
|
956
|
-
session_id: Session ID
|
957
|
-
|
958
|
-
status_code: HTTP status code
|
959
|
-
|
960
|
-
total_tokens: Total number of tokens
|
961
|
-
|
962
|
-
user_agent: Client user agent
|
963
|
-
|
964
|
-
user_id: User ID
|
965
|
-
|
966
|
-
extra_headers: Send extra headers
|
967
|
-
|
968
|
-
extra_query: Add additional query parameters to the request
|
969
|
-
|
970
|
-
extra_body: Add additional JSON properties to the request
|
971
|
-
|
972
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
973
|
-
"""
|
974
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
975
|
-
return await self._post(
|
976
|
-
"/api/v1/usage/track",
|
977
|
-
body=await async_maybe_transform(
|
978
|
-
{
|
979
|
-
"event_type": event_type,
|
980
|
-
"cache_hit": cache_hit,
|
981
|
-
"component_name": component_name,
|
982
|
-
"component_type": component_type,
|
983
|
-
"content_size": content_size,
|
984
|
-
"endpoint": endpoint,
|
985
|
-
"file_size": file_size,
|
986
|
-
"file_type": file_type,
|
987
|
-
"group_id": group_id,
|
988
|
-
"input_tokens": input_tokens,
|
989
|
-
"ip_address": ip_address,
|
990
|
-
"metadata": metadata,
|
991
|
-
"method": method,
|
992
|
-
"model": model,
|
993
|
-
"output_tokens": output_tokens,
|
994
|
-
"performance_data": performance_data,
|
995
|
-
"reasoning_tokens": reasoning_tokens,
|
996
|
-
"resource_id": resource_id,
|
997
|
-
"resource_type": resource_type,
|
998
|
-
"response_time": response_time,
|
999
|
-
"session_id": session_id,
|
1000
|
-
"status_code": status_code,
|
1001
|
-
"total_tokens": total_tokens,
|
1002
|
-
"user_agent": user_agent,
|
1003
|
-
"user_id": user_id,
|
1004
|
-
},
|
1005
|
-
usage_track_event_params.UsageTrackEventParams,
|
1006
|
-
),
|
1007
|
-
options=make_request_options(
|
1008
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
1009
|
-
),
|
1010
|
-
cast_to=NoneType,
|
1011
|
-
)
|
1012
|
-
|
1013
|
-
async def track_performance(
|
1014
|
-
self,
|
1015
|
-
*,
|
1016
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
1017
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
1018
|
-
extra_headers: Headers | None = None,
|
1019
|
-
extra_query: Query | None = None,
|
1020
|
-
extra_body: Body | None = None,
|
1021
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
1022
|
-
) -> None:
|
1023
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
1024
|
-
return await self._post(
|
1025
|
-
"/api/v1/usage/performance",
|
1026
|
-
options=make_request_options(
|
1027
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
1028
|
-
),
|
1029
|
-
cast_to=NoneType,
|
1030
|
-
)
|
1031
|
-
|
1032
476
|
|
1033
477
|
class UsageResourceWithRawResponse:
|
1034
478
|
def __init__(self, usage: UsageResource) -> None:
|
@@ -1043,15 +487,6 @@ class UsageResourceWithRawResponse:
|
|
1043
487
|
self.list_events = to_raw_response_wrapper(
|
1044
488
|
usage.list_events,
|
1045
489
|
)
|
1046
|
-
self.track_chat = to_raw_response_wrapper(
|
1047
|
-
usage.track_chat,
|
1048
|
-
)
|
1049
|
-
self.track_event = to_raw_response_wrapper(
|
1050
|
-
usage.track_event,
|
1051
|
-
)
|
1052
|
-
self.track_performance = to_raw_response_wrapper(
|
1053
|
-
usage.track_performance,
|
1054
|
-
)
|
1055
490
|
|
1056
491
|
|
1057
492
|
class AsyncUsageResourceWithRawResponse:
|
@@ -1067,15 +502,6 @@ class AsyncUsageResourceWithRawResponse:
|
|
1067
502
|
self.list_events = async_to_raw_response_wrapper(
|
1068
503
|
usage.list_events,
|
1069
504
|
)
|
1070
|
-
self.track_chat = async_to_raw_response_wrapper(
|
1071
|
-
usage.track_chat,
|
1072
|
-
)
|
1073
|
-
self.track_event = async_to_raw_response_wrapper(
|
1074
|
-
usage.track_event,
|
1075
|
-
)
|
1076
|
-
self.track_performance = async_to_raw_response_wrapper(
|
1077
|
-
usage.track_performance,
|
1078
|
-
)
|
1079
505
|
|
1080
506
|
|
1081
507
|
class UsageResourceWithStreamingResponse:
|
@@ -1091,15 +517,6 @@ class UsageResourceWithStreamingResponse:
|
|
1091
517
|
self.list_events = to_streamed_response_wrapper(
|
1092
518
|
usage.list_events,
|
1093
519
|
)
|
1094
|
-
self.track_chat = to_streamed_response_wrapper(
|
1095
|
-
usage.track_chat,
|
1096
|
-
)
|
1097
|
-
self.track_event = to_streamed_response_wrapper(
|
1098
|
-
usage.track_event,
|
1099
|
-
)
|
1100
|
-
self.track_performance = to_streamed_response_wrapper(
|
1101
|
-
usage.track_performance,
|
1102
|
-
)
|
1103
520
|
|
1104
521
|
|
1105
522
|
class AsyncUsageResourceWithStreamingResponse:
|
@@ -1115,12 +532,3 @@ class AsyncUsageResourceWithStreamingResponse:
|
|
1115
532
|
self.list_events = async_to_streamed_response_wrapper(
|
1116
533
|
usage.list_events,
|
1117
534
|
)
|
1118
|
-
self.track_chat = async_to_streamed_response_wrapper(
|
1119
|
-
usage.track_chat,
|
1120
|
-
)
|
1121
|
-
self.track_event = async_to_streamed_response_wrapper(
|
1122
|
-
usage.track_event,
|
1123
|
-
)
|
1124
|
-
self.track_performance = async_to_streamed_response_wrapper(
|
1125
|
-
usage.track_performance,
|
1126
|
-
)
|