payi 0.1.0a50__tar.gz → 0.1.0a52__tar.gz

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.

Potentially problematic release.


This version of payi might be problematic. Click here for more details.

Files changed (168) hide show
  1. payi-0.1.0a52/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a50 → payi-0.1.0a52}/CHANGELOG.md +16 -0
  3. {payi-0.1.0a50 → payi-0.1.0a52}/PKG-INFO +1 -1
  4. {payi-0.1.0a50 → payi-0.1.0a52}/pyproject.toml +1 -1
  5. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_version.py +1 -1
  6. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/helpers.py +6 -6
  7. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/instrument.py +43 -18
  8. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/ingest.py +33 -28
  9. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/ingest_event_param.py +0 -2
  10. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/ingest_units_params.py +2 -0
  11. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/test_ingest.py +2 -0
  12. payi-0.1.0a50/.release-please-manifest.json +0 -3
  13. {payi-0.1.0a50 → payi-0.1.0a52}/.gitignore +0 -0
  14. {payi-0.1.0a50 → payi-0.1.0a52}/CONTRIBUTING.md +0 -0
  15. {payi-0.1.0a50 → payi-0.1.0a52}/LICENSE +0 -0
  16. {payi-0.1.0a50 → payi-0.1.0a52}/README.md +0 -0
  17. {payi-0.1.0a50 → payi-0.1.0a52}/SECURITY.md +0 -0
  18. {payi-0.1.0a50 → payi-0.1.0a52}/api.md +0 -0
  19. {payi-0.1.0a50 → payi-0.1.0a52}/bin/check-release-environment +0 -0
  20. {payi-0.1.0a50 → payi-0.1.0a52}/bin/publish-pypi +0 -0
  21. {payi-0.1.0a50 → payi-0.1.0a52}/examples/.keep +0 -0
  22. {payi-0.1.0a50 → payi-0.1.0a52}/mypy.ini +0 -0
  23. {payi-0.1.0a50 → payi-0.1.0a52}/noxfile.py +0 -0
  24. {payi-0.1.0a50 → payi-0.1.0a52}/release-please-config.json +0 -0
  25. {payi-0.1.0a50 → payi-0.1.0a52}/requirements-dev.lock +0 -0
  26. {payi-0.1.0a50 → payi-0.1.0a52}/requirements.lock +0 -0
  27. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/__init__.py +0 -0
  28. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_base_client.py +0 -0
  29. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_client.py +0 -0
  30. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_compat.py +0 -0
  31. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_constants.py +0 -0
  32. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_exceptions.py +0 -0
  33. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_files.py +0 -0
  34. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_models.py +0 -0
  35. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_qs.py +0 -0
  36. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_resource.py +0 -0
  37. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_response.py +0 -0
  38. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_streaming.py +0 -0
  39. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_types.py +0 -0
  40. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/__init__.py +0 -0
  41. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_logs.py +0 -0
  42. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_proxy.py +0 -0
  43. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_reflection.py +0 -0
  44. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_streams.py +0 -0
  45. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_sync.py +0 -0
  46. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_transform.py +0 -0
  47. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_typing.py +0 -0
  48. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/_utils/_utils.py +0 -0
  49. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/.keep +0 -0
  50. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/AnthropicInstrumentor.py +0 -0
  51. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/BedrockInstrumentor.py +0 -0
  52. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/OpenAIInstrumentor.py +0 -0
  53. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/lib/Stopwatch.py +0 -0
  54. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/py.typed +0 -0
  55. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/__init__.py +0 -0
  56. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/billing_models.py +0 -0
  57. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/categories/__init__.py +0 -0
  58. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/categories/categories.py +0 -0
  59. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/categories/resources.py +0 -0
  60. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/experiences/__init__.py +0 -0
  61. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/experiences/experiences.py +0 -0
  62. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/experiences/properties.py +0 -0
  63. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/experiences/types/__init__.py +0 -0
  64. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/experiences/types/limit_config.py +0 -0
  65. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/experiences/types/types.py +0 -0
  66. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/limits/__init__.py +0 -0
  67. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/limits/limits.py +0 -0
  68. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/limits/tags.py +0 -0
  69. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/price_modifiers.py +0 -0
  70. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/requests/__init__.py +0 -0
  71. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/requests/properties.py +0 -0
  72. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/requests/requests.py +0 -0
  73. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/resources/requests/result.py +0 -0
  74. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/__init__.py +0 -0
  75. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/billing_model.py +0 -0
  76. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/billing_model_create_params.py +0 -0
  77. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/billing_model_list_response.py +0 -0
  78. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/billing_model_update_params.py +0 -0
  79. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/bulk_ingest_response.py +0 -0
  80. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/categories/__init__.py +0 -0
  81. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/categories/resource_create_params.py +0 -0
  82. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/categories/resource_list_response.py +0 -0
  83. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/category_delete_resource_response.py +0 -0
  84. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/category_delete_response.py +0 -0
  85. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/category_list_resources_response.py +0 -0
  86. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/category_list_response.py +0 -0
  87. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/category_resource_response.py +0 -0
  88. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/category_response.py +0 -0
  89. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/cost_data.py +0 -0
  90. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/cost_details.py +0 -0
  91. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/default_response.py +0 -0
  92. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experience_instance_response.py +0 -0
  93. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/__init__.py +0 -0
  94. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/experience_type.py +0 -0
  95. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/properties_response.py +0 -0
  96. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/property_create_params.py +0 -0
  97. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/type_create_params.py +0 -0
  98. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/type_list_params.py +0 -0
  99. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/type_list_response.py +0 -0
  100. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/type_update_params.py +0 -0
  101. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/types/__init__.py +0 -0
  102. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/experiences/types/limit_config_create_params.py +0 -0
  103. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/ingest_bulk_params.py +0 -0
  104. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/ingest_response.py +0 -0
  105. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limit_create_params.py +0 -0
  106. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limit_history_response.py +0 -0
  107. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limit_list_params.py +0 -0
  108. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limit_reset_params.py +0 -0
  109. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limit_response.py +0 -0
  110. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limit_update_params.py +0 -0
  111. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/__init__.py +0 -0
  112. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/limit_tags.py +0 -0
  113. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_create_params.py +0 -0
  114. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_create_response.py +0 -0
  115. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_delete_response.py +0 -0
  116. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_list_response.py +0 -0
  117. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_remove_params.py +0 -0
  118. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_remove_response.py +0 -0
  119. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_update_params.py +0 -0
  120. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/limits/tag_update_response.py +0 -0
  121. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/paged_limit_list.py +0 -0
  122. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/pay_i_common_models_api_router_header_info_param.py +0 -0
  123. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/price_modifier.py +0 -0
  124. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/price_modifier_create_params.py +0 -0
  125. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/price_modifier_retrieve_response.py +0 -0
  126. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/price_modifier_update_params.py +0 -0
  127. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/requests/__init__.py +0 -0
  128. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/requests/property_create_params.py +0 -0
  129. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/requests/request_result.py +0 -0
  130. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/requests_data.py +0 -0
  131. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/shared/__init__.py +0 -0
  132. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/shared/evaluation_response.py +0 -0
  133. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/shared/pay_i_common_models_budget_management_cost_details_base.py +0 -0
  134. {payi-0.1.0a50 → payi-0.1.0a52}/src/payi/types/total_cost_data.py +0 -0
  135. {payi-0.1.0a50 → payi-0.1.0a52}/tests/__init__.py +0 -0
  136. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/__init__.py +0 -0
  137. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/categories/__init__.py +0 -0
  138. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/categories/test_resources.py +0 -0
  139. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/experiences/__init__.py +0 -0
  140. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/experiences/test_properties.py +0 -0
  141. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/experiences/test_types.py +0 -0
  142. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/experiences/types/__init__.py +0 -0
  143. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/experiences/types/test_limit_config.py +0 -0
  144. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/limits/__init__.py +0 -0
  145. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/limits/test_tags.py +0 -0
  146. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/requests/__init__.py +0 -0
  147. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/requests/test_properties.py +0 -0
  148. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/requests/test_result.py +0 -0
  149. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/test_billing_models.py +0 -0
  150. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/test_categories.py +0 -0
  151. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/test_experiences.py +0 -0
  152. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/test_limits.py +0 -0
  153. {payi-0.1.0a50 → payi-0.1.0a52}/tests/api_resources/test_price_modifiers.py +0 -0
  154. {payi-0.1.0a50 → payi-0.1.0a52}/tests/conftest.py +0 -0
  155. {payi-0.1.0a50 → payi-0.1.0a52}/tests/sample_file.txt +0 -0
  156. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_client.py +0 -0
  157. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_deepcopy.py +0 -0
  158. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_extract_files.py +0 -0
  159. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_files.py +0 -0
  160. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_models.py +0 -0
  161. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_qs.py +0 -0
  162. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_required_args.py +0 -0
  163. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_response.py +0 -0
  164. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_streaming.py +0 -0
  165. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_transform.py +0 -0
  166. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_utils/test_proxy.py +0 -0
  167. {payi-0.1.0a50 → payi-0.1.0a52}/tests/test_utils/test_typing.py +0 -0
  168. {payi-0.1.0a50 → payi-0.1.0a52}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.52"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.52 (2025-02-20)
4
+
5
+ Full Changelog: [v0.1.0-alpha.51...v0.1.0-alpha.52](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.51...v0.1.0-alpha.52)
6
+
7
+ ### Features
8
+
9
+ * feat: ingest support for resource scope ([e2b4ce8](https://github.com/Pay-i/pay-i-python/commit/e2b4ce847b3f54df1bc5be7a78cf81dccd80c88c))
10
+
11
+ ## 0.1.0-alpha.51 (2025-02-20)
12
+
13
+ Full Changelog: [v0.1.0-alpha.50...v0.1.0-alpha.51](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.50...v0.1.0-alpha.51)
14
+
15
+ ### Features
16
+
17
+ * **api:** manual updates ([#235](https://github.com/Pay-i/pay-i-python/issues/235)) ([92e6b3c](https://github.com/Pay-i/pay-i-python/commit/92e6b3c9328caae24efbb75214f5f5087bfd57ec))
18
+
3
19
  ## 0.1.0-alpha.50 (2025-02-14)
4
20
 
5
21
  Full Changelog: [v0.1.0-alpha.49...v0.1.0-alpha.50](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.49...v0.1.0-alpha.50)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payi
3
- Version: 0.1.0a50
3
+ Version: 0.1.0a52
4
4
  Summary: The official Python library for the payi API
5
5
  Project-URL: Homepage, https://github.com/Pay-i/pay-i-python
6
6
  Project-URL: Repository, https://github.com/Pay-i/pay-i-python
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "payi"
3
- version = "0.1.0-alpha.50"
3
+ version = "0.1.0-alpha.52"
4
4
  description = "The official Python library for the payi API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "payi"
4
- __version__ = "0.1.0-alpha.50" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.52" # x-release-please-version
@@ -1,4 +1,3 @@
1
- from enum import Enum
2
1
  from typing import Dict, List, Union
3
2
 
4
3
  PAYI_BASE_URL = "https://api.pay-i.com"
@@ -11,12 +10,13 @@ class PayiHeaderNames:
11
10
  user_id:str = "xProxy-User-ID"
12
11
  route_as_resource:str = "xProxy-RouteAs-Resource"
13
12
  provider_base_uri = "xProxy-Provider-BaseUri"
13
+ resource_scope:str = "xProxy-Resource-Scope"
14
14
 
15
- class PayiCategories(Enum):
16
- anthropic = "system.anthropic"
17
- openai = "system.openai"
18
- azure_openai = "system.azureopenai"
19
- aws_bedrock = "system.aws.bedrock"
15
+ class PayiCategories:
16
+ anthropic:str = "system.anthropic"
17
+ openai:str = "system.openai"
18
+ azure_openai:str = "system.azureopenai"
19
+ aws_bedrock:str = "system.aws.bedrock"
20
20
 
21
21
  def create_limit_header_from_ids(limit_ids: List[str]) -> Dict[str, str]:
22
22
  if not isinstance(limit_ids, list): # type: ignore
@@ -41,7 +41,7 @@ class PayiInstrumentor:
41
41
  self,
42
42
  payi: Optional[Payi],
43
43
  apayi: Optional[AsyncPayi],
44
- instruments: Union[Set[PayiCategories], None] = None,
44
+ instruments: Union[Set[str], None] = None,
45
45
  log_prompt_and_response: bool = True,
46
46
  prompt_and_response_logger: Optional[
47
47
  Callable[[str, "dict[str, str]"], None]
@@ -56,7 +56,7 @@ class PayiInstrumentor:
56
56
  self._blocked_limits: set[str] = set()
57
57
  self._exceeded_limits: set[str] = set()
58
58
 
59
- if instruments is None:
59
+ if instruments is None or "*" in instruments:
60
60
  self._instrument_all()
61
61
  else:
62
62
  self._instrument_specific(instruments)
@@ -66,7 +66,7 @@ class PayiInstrumentor:
66
66
  self._instrument_anthropic()
67
67
  self._instrument_aws_bedrock()
68
68
 
69
- def _instrument_specific(self, instruments: Set[PayiCategories]) -> None:
69
+ def _instrument_specific(self, instruments: Set[str]) -> None:
70
70
  if PayiCategories.openai in instruments or PayiCategories.azure_openai in instruments:
71
71
  self._instrument_openai()
72
72
  if PayiCategories.anthropic in instruments:
@@ -375,14 +375,18 @@ class PayiInstrumentor:
375
375
  if len(ingest_extra_headers) > 0:
376
376
  ingest["provider_request_headers"] = [PayICommonModelsAPIRouterHeaderInfoParam(name=k, value=v) for k, v in ingest_extra_headers.items()]
377
377
 
378
- provider_prompt = {}
378
+ provider_prompt: "dict[str, Any]" = {}
379
379
  for k, v in kwargs.items():
380
380
  if k == "messages":
381
381
  provider_prompt[k] = [m.model_dump() if hasattr(m, "model_dump") else m for m in v]
382
382
  elif k in ["extra_headers", "extra_query"]:
383
383
  pass
384
384
  else:
385
- provider_prompt[k] = v
385
+ try:
386
+ json.dumps(v)
387
+ provider_prompt[k] = v
388
+ except (TypeError, ValueError):
389
+ pass
386
390
 
387
391
  if self._log_prompt_and_response:
388
392
  ingest["provider_request_json"] = json.dumps(provider_prompt)
@@ -420,18 +424,28 @@ class PayiInstrumentor:
420
424
  ingest: IngestUnitsParams = {"category": category, "units": {}} # type: ignore
421
425
  ingest["resource"] = kwargs.get("model", "")
422
426
 
423
- if category == "system.openai" and instance and hasattr(instance, "_client"):
427
+ if category == PayiCategories.openai and instance and hasattr(instance, "_client"):
424
428
  from .OpenAIInstrumentor import OpenAiInstrumentor # noqa: I001
425
429
 
426
430
  if OpenAiInstrumentor.is_azure(instance):
427
- resource = extra_headers.pop(PayiHeaderNames.route_as_resource, None)
428
- if not resource:
431
+ route_as_resource = extra_headers.pop(PayiHeaderNames.route_as_resource, None)
432
+ resource_scope = extra_headers.pop(PayiHeaderNames.resource_scope, None)
433
+
434
+ if not route_as_resource:
429
435
  logging.error("Azure OpenAI route as resource not found, not ingesting")
430
436
  return await wrapped(*args, **kwargs)
431
437
 
432
- category = "system.azureopenai"
438
+ if resource_scope:
439
+ if not(resource_scope in ["global", "datazone"] or resource_scope.startswith("region")):
440
+ logging.error("Azure OpenAI invalid resource scope, not ingesting")
441
+ return wrapped(*args, **kwargs)
442
+
443
+ ingest["resource_scope"] = resource_scope
444
+
445
+ category = PayiCategories.azure_openai
446
+
433
447
  ingest["category"] = category
434
- ingest["resource"] = resource
448
+ ingest["resource"] = route_as_resource
435
449
 
436
450
  current_frame = inspect.currentframe()
437
451
  # f_back excludes the current frame, strip() cleans up whitespace and newlines
@@ -511,7 +525,7 @@ class PayiInstrumentor:
511
525
  ) -> Any:
512
526
  context = self.get_context()
513
527
 
514
- is_bedrock:bool = category == "system.aws.bedrock"
528
+ is_bedrock:bool = category == PayiCategories.aws_bedrock
515
529
 
516
530
  if not context:
517
531
  if is_bedrock:
@@ -539,17 +553,28 @@ class PayiInstrumentor:
539
553
  else:
540
554
  ingest["resource"] = kwargs.get("model", "")
541
555
 
542
- if category == "system.openai" and instance and hasattr(instance, "_client"):
543
- from .OpenAIInstrumentor import OpenAiInstrumentor
556
+ if category == PayiCategories.openai and instance and hasattr(instance, "_client"):
557
+ from .OpenAIInstrumentor import OpenAiInstrumentor # noqa: I001
558
+
544
559
  if OpenAiInstrumentor.is_azure(instance):
545
- resource = extra_headers.pop(PayiHeaderNames.route_as_resource, None)
546
- if not resource:
560
+ route_as_resource:str = extra_headers.pop(PayiHeaderNames.route_as_resource, None)
561
+ resource_scope:str = extra_headers.pop(PayiHeaderNames.resource_scope, None)
562
+
563
+ if not route_as_resource:
547
564
  logging.error("Azure OpenAI route as resource not found, not ingesting")
548
565
  return wrapped(*args, **kwargs)
549
566
 
550
- category = "system.azureopenai"
567
+ if resource_scope:
568
+ if not(resource_scope in ["global", "datazone"] or resource_scope.startswith("region")):
569
+ logging.error("Azure OpenAI invalid resource scope, not ingesting")
570
+ return wrapped(*args, **kwargs)
571
+
572
+ ingest["resource_scope"] = resource_scope
573
+
574
+ category = PayiCategories.azure_openai
575
+
551
576
  ingest["category"] = category
552
- ingest["resource"] = resource
577
+ ingest["resource"] = route_as_resource
553
578
 
554
579
  current_frame = inspect.currentframe()
555
580
  # f_back excludes the current frame, strip() cleans up whitespace and newlines
@@ -864,7 +889,7 @@ _instrumentor: Optional[PayiInstrumentor] = None
864
889
 
865
890
  def payi_instrument(
866
891
  payi: Optional[Union[Payi, AsyncPayi, 'list[Union[Payi, AsyncPayi]]']] = None,
867
- instruments: Optional[Set[PayiCategories]] = None,
892
+ instruments: Optional[Set[str]] = None,
868
893
  log_prompt_and_response: bool = True,
869
894
  prompt_and_response_logger: Optional[Callable[[str, "dict[str, str]"], None]] = None,
870
895
  ) -> None:
@@ -101,11 +101,12 @@ class IngestResource(SyncAPIResource):
101
101
  provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
102
102
  provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
103
103
  time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
104
- limit_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
105
- request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
106
- experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
107
- experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
108
- user_id: Union[str, None] | NotGiven = NOT_GIVEN,
104
+ limit_ids: Optional[list[str]] | NotGiven = NOT_GIVEN,
105
+ request_tags: Optional[list[str]] | NotGiven = NOT_GIVEN,
106
+ experience_id: Optional[str] | NotGiven = NOT_GIVEN,
107
+ experience_name: Optional[str] | NotGiven = NOT_GIVEN,
108
+ user_id: Optional[str] | NotGiven = NOT_GIVEN,
109
+ resource_scope: Optional[str] | NotGiven = NOT_GIVEN,
109
110
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
110
111
  # The extra values given here take precedence over values defined on the client or passed to this method.
111
112
  extra_headers: Headers | None = None,
@@ -136,6 +137,8 @@ class IngestResource(SyncAPIResource):
136
137
  experience_id (str, optional): The experience instance id
137
138
 
138
139
  user_id (str, optional): The user id
140
+
141
+ resource_scope(str, optional): The scope of the resource
139
142
 
140
143
  extra_headers (Dict[str, str], optional): Additional headers for the request. Defaults to None.
141
144
 
@@ -176,17 +179,17 @@ class IngestResource(SyncAPIResource):
176
179
  user_id = NOT_GIVEN
177
180
 
178
181
  extra_headers = {
179
- **strip_not_given(
180
- {
181
- "xProxy-Limit-IDs": valid_ids_str,
182
- "xProxy-Request-Tags": valid_tags_str,
183
- "xProxy-Experience-Id": experience_id,
184
- "xProxy-Experience-Name": experience_name,
185
- "xProxy-User-ID": user_id,
186
- }
187
- ),
182
+ **{key: value for key, value in strip_not_given({
183
+ "xProxy-Limit-IDs": valid_ids_str,
184
+ "xProxy-Request-Tags": valid_tags_str,
185
+ "xProxy-Experience-Name": experience_name,
186
+ "xProxy-Experience-Id": experience_id,
187
+ "xProxy-User-ID": user_id,
188
+ "xProxy-Resource-Scope": resource_scope,
189
+ }).items() if value is not None}, # Ensure no 'None' values are included
188
190
  **(extra_headers or {}),
189
191
  }
192
+
190
193
  return self._post(
191
194
  "/api/v1/ingest",
192
195
  body=maybe_transform(
@@ -286,11 +289,12 @@ class AsyncIngestResource(AsyncAPIResource):
286
289
  provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
287
290
  provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
288
291
  time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
289
- limit_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
290
- request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
291
- experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
292
- experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
293
- user_id: Union[str, None] | NotGiven = NOT_GIVEN,
292
+ limit_ids: Optional[list[str]] | NotGiven = NOT_GIVEN,
293
+ request_tags: Optional[list[str]] | NotGiven = NOT_GIVEN,
294
+ experience_name: Optional[str] | NotGiven = NOT_GIVEN,
295
+ experience_id: Optional[str] | NotGiven = NOT_GIVEN,
296
+ user_id: Optional[str] | NotGiven = NOT_GIVEN,
297
+ resource_scope: Union[str, None] | NotGiven = NOT_GIVEN,
294
298
  # The extra values given here take precedence over values defined on the client or passed to this method.
295
299
  extra_headers: Headers | None = None,
296
300
  extra_query: Query | None = None,
@@ -320,6 +324,8 @@ class AsyncIngestResource(AsyncAPIResource):
320
324
  experience_id (str, optional): The experience instance id
321
325
 
322
326
  user_id (str, optional): The user id
327
+
328
+ resource_scope (str, optional): The scope of the resource
323
329
 
324
330
  extra_headers (Dict[str, str], optional): Additional headers for the request. Defaults to None.
325
331
 
@@ -360,15 +366,14 @@ class AsyncIngestResource(AsyncAPIResource):
360
366
  user_id = NOT_GIVEN
361
367
 
362
368
  extra_headers = {
363
- **strip_not_given(
364
- {
365
- "xProxy-Limit-IDs": valid_ids_str,
366
- "xProxy-Request-Tags": valid_tags_str,
367
- "xProxy-Experience-Name": experience_name,
368
- "xProxy-Experience-Id": experience_id,
369
- "xProxy-User-ID": user_id,
370
- }
371
- ),
369
+ **{key: value for key, value in strip_not_given({
370
+ "xProxy-Limit-IDs": valid_ids_str,
371
+ "xProxy-Request-Tags": valid_tags_str,
372
+ "xProxy-Experience-Name": experience_name,
373
+ "xProxy-Experience-Id": experience_id,
374
+ "xProxy-User-ID": user_id,
375
+ "xProxy-Resource-Scope": resource_scope,
376
+ }).items() if value is not None}, # Ensure no 'None' values are included
372
377
  **(extra_headers or {}),
373
378
  }
374
379
  return await self._post(
@@ -25,8 +25,6 @@ class IngestEventParam(TypedDict, total=False):
25
25
 
26
26
  units: Required[Dict[str, Units]]
27
27
 
28
- csat_rating: Optional[int]
29
-
30
28
  end_to_end_latency_ms: Optional[int]
31
29
 
32
30
  event_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
@@ -51,6 +51,8 @@ class IngestUnitsParams(TypedDict, total=False):
51
51
 
52
52
  experience_id: Annotated[Union[str, None], PropertyInfo(alias="xProxy-Experience-Id")]
53
53
 
54
+ resource_scope: Annotated[Union[str, None], PropertyInfo(alias="xProxy-Resource-Scope")]
55
+
54
56
  user_id: Annotated[Union[str, None], PropertyInfo(alias="xProxy-User-ID")]
55
57
 
56
58
 
@@ -113,6 +113,7 @@ class TestIngest:
113
113
  request_tags=["requestTag1", "request_tag_2"],
114
114
  experience_name="experience_name",
115
115
  experience_id="experience_id",
116
+ resource_scope="datazone",
116
117
  user_id="UserName123",
117
118
  )
118
119
  assert_matches_type(IngestResponse, ingest, path=["response"])
@@ -244,6 +245,7 @@ class TestAsyncIngest:
244
245
  request_tags=["requestTag1", "request_tag_2"],
245
246
  experience_name="experience_name",
246
247
  experience_id="experience_id",
248
+ resource_scope="datazone",
247
249
  user_id="UserName123",
248
250
  )
249
251
  assert_matches_type(IngestResponse, ingest, path=["response"])
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.1.0-alpha.50"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes