payi 0.1.0a133__tar.gz → 0.1.0a134__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 (196) hide show
  1. payi-0.1.0a134/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a133 → payi-0.1.0a134}/CHANGELOG.md +8 -0
  3. {payi-0.1.0a133 → payi-0.1.0a134}/PKG-INFO +1 -1
  4. {payi-0.1.0a133 → payi-0.1.0a134}/pyproject.toml +1 -1
  5. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_version.py +1 -1
  6. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/AnthropicInstrumentor.py +14 -3
  7. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/BedrockInstrumentor.py +81 -27
  8. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/OpenAIInstrumentor.py +38 -27
  9. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/helpers.py +18 -1
  10. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/instrument.py +233 -64
  11. payi-0.1.0a133/.release-please-manifest.json +0 -3
  12. {payi-0.1.0a133 → payi-0.1.0a134}/.gitignore +0 -0
  13. {payi-0.1.0a133 → payi-0.1.0a134}/CONTRIBUTING.md +0 -0
  14. {payi-0.1.0a133 → payi-0.1.0a134}/LICENSE +0 -0
  15. {payi-0.1.0a133 → payi-0.1.0a134}/README.md +0 -0
  16. {payi-0.1.0a133 → payi-0.1.0a134}/SECURITY.md +0 -0
  17. {payi-0.1.0a133 → payi-0.1.0a134}/api.md +0 -0
  18. {payi-0.1.0a133 → payi-0.1.0a134}/bin/check-release-environment +0 -0
  19. {payi-0.1.0a133 → payi-0.1.0a134}/bin/publish-pypi +0 -0
  20. {payi-0.1.0a133 → payi-0.1.0a134}/examples/.keep +0 -0
  21. {payi-0.1.0a133 → payi-0.1.0a134}/noxfile.py +0 -0
  22. {payi-0.1.0a133 → payi-0.1.0a134}/release-please-config.json +0 -0
  23. {payi-0.1.0a133 → payi-0.1.0a134}/requirements-dev.lock +0 -0
  24. {payi-0.1.0a133 → payi-0.1.0a134}/requirements.lock +0 -0
  25. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/__init__.py +0 -0
  26. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_base_client.py +0 -0
  27. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_client.py +0 -0
  28. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_compat.py +0 -0
  29. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_constants.py +0 -0
  30. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_exceptions.py +0 -0
  31. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_files.py +0 -0
  32. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_models.py +0 -0
  33. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_qs.py +0 -0
  34. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_resource.py +0 -0
  35. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_response.py +0 -0
  36. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_streaming.py +0 -0
  37. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_types.py +0 -0
  38. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/__init__.py +0 -0
  39. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_compat.py +0 -0
  40. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_datetime_parse.py +0 -0
  41. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_logs.py +0 -0
  42. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_proxy.py +0 -0
  43. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_reflection.py +0 -0
  44. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_resources_proxy.py +0 -0
  45. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_streams.py +0 -0
  46. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_sync.py +0 -0
  47. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_transform.py +0 -0
  48. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_typing.py +0 -0
  49. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/_utils/_utils.py +0 -0
  50. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/.keep +0 -0
  51. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/GoogleGenAiInstrumentor.py +0 -0
  52. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/Stopwatch.py +0 -0
  53. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/VertexInstrumentor.py +0 -0
  54. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/VertexRequest.py +0 -0
  55. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/data/cohere_embed_english_v3.json +0 -0
  56. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/lib/version_helper.py +0 -0
  57. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/pagination.py +0 -0
  58. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/py.typed +0 -0
  59. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/__init__.py +0 -0
  60. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/categories/__init__.py +0 -0
  61. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/categories/categories.py +0 -0
  62. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/categories/resources.py +0 -0
  63. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/ingest.py +0 -0
  64. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/limits/__init__.py +0 -0
  65. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/limits/limits.py +0 -0
  66. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/limits/properties.py +0 -0
  67. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/__init__.py +0 -0
  68. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/request_id/__init__.py +0 -0
  69. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/request_id/properties.py +0 -0
  70. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/request_id/request_id.py +0 -0
  71. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/request_id/result.py +0 -0
  72. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/requests.py +0 -0
  73. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/response_id/__init__.py +0 -0
  74. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/response_id/properties.py +0 -0
  75. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/response_id/response_id.py +0 -0
  76. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/requests/response_id/result.py +0 -0
  77. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/__init__.py +0 -0
  78. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/definitions/__init__.py +0 -0
  79. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/definitions/definitions.py +0 -0
  80. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/definitions/kpis.py +0 -0
  81. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/definitions/limit_config.py +0 -0
  82. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/definitions/version.py +0 -0
  83. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/kpis.py +0 -0
  84. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/properties.py +0 -0
  85. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/resources/use_cases/use_cases.py +0 -0
  86. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/__init__.py +0 -0
  87. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/bulk_ingest_response.py +0 -0
  88. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/categories/__init__.py +0 -0
  89. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/categories/resource_create_params.py +0 -0
  90. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/categories/resource_list_params.py +0 -0
  91. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/category_delete_resource_response.py +0 -0
  92. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/category_delete_response.py +0 -0
  93. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/category_list_params.py +0 -0
  94. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/category_list_resources_params.py +0 -0
  95. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/category_resource_response.py +0 -0
  96. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/category_response.py +0 -0
  97. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/cost_data.py +0 -0
  98. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/cost_details.py +0 -0
  99. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/default_response.py +0 -0
  100. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/ingest_bulk_params.py +0 -0
  101. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/ingest_event_param.py +0 -0
  102. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/ingest_response.py +0 -0
  103. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/ingest_units_params.py +0 -0
  104. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_create_params.py +0 -0
  105. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_history_response.py +0 -0
  106. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_list_params.py +0 -0
  107. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_list_response.py +0 -0
  108. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_reset_params.py +0 -0
  109. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_response.py +0 -0
  110. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limit_update_params.py +0 -0
  111. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limits/__init__.py +0 -0
  112. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limits/property_update_params.py +0 -0
  113. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/limits/property_update_response.py +0 -0
  114. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/pay_i_common_models_api_router_header_info_param.py +0 -0
  115. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/request_result.py +0 -0
  116. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/requests/__init__.py +0 -0
  117. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/requests/request_id/__init__.py +0 -0
  118. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/requests/request_id/property_update_params.py +0 -0
  119. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/requests/response_id/__init__.py +0 -0
  120. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/requests/response_id/property_update_params.py +0 -0
  121. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/requests_data.py +0 -0
  122. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/__init__.py +0 -0
  123. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/api_error.py +0 -0
  124. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/evaluation_response.py +0 -0
  125. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/ingest_units.py +0 -0
  126. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/pay_i_common_models_budget_management_cost_details_base.py +0 -0
  127. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/pay_i_common_models_budget_management_create_limit_base.py +0 -0
  128. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/properties_request.py +0 -0
  129. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/properties_response.py +0 -0
  130. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/xproxy_error.py +0 -0
  131. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared/xproxy_result.py +0 -0
  132. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared_params/__init__.py +0 -0
  133. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared_params/ingest_units.py +0 -0
  134. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/shared_params/pay_i_common_models_budget_management_create_limit_base.py +0 -0
  135. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/total_cost_data.py +0 -0
  136. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_case_instance_response.py +0 -0
  137. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/__init__.py +0 -0
  138. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definition_create_params.py +0 -0
  139. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definition_list_params.py +0 -0
  140. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definition_update_params.py +0 -0
  141. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/__init__.py +0 -0
  142. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_create_params.py +0 -0
  143. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_create_response.py +0 -0
  144. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_delete_response.py +0 -0
  145. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_list_params.py +0 -0
  146. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_list_response.py +0 -0
  147. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_retrieve_response.py +0 -0
  148. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_update_params.py +0 -0
  149. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/kpi_update_response.py +0 -0
  150. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/definitions/limit_config_create_params.py +0 -0
  151. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/kpi_list_params.py +0 -0
  152. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/kpi_list_response.py +0 -0
  153. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/kpi_update_params.py +0 -0
  154. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/property_update_params.py +0 -0
  155. {payi-0.1.0a133 → payi-0.1.0a134}/src/payi/types/use_cases/use_case_definition.py +0 -0
  156. {payi-0.1.0a133 → payi-0.1.0a134}/tests/__init__.py +0 -0
  157. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/__init__.py +0 -0
  158. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/categories/__init__.py +0 -0
  159. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/categories/test_resources.py +0 -0
  160. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/limits/__init__.py +0 -0
  161. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/limits/test_properties.py +0 -0
  162. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/__init__.py +0 -0
  163. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/request_id/__init__.py +0 -0
  164. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/request_id/test_properties.py +0 -0
  165. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/request_id/test_result.py +0 -0
  166. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/response_id/__init__.py +0 -0
  167. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/response_id/test_properties.py +0 -0
  168. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/requests/response_id/test_result.py +0 -0
  169. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/test_categories.py +0 -0
  170. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/test_ingest.py +0 -0
  171. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/test_limits.py +0 -0
  172. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/test_use_cases.py +0 -0
  173. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/__init__.py +0 -0
  174. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/definitions/__init__.py +0 -0
  175. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/definitions/test_kpis.py +0 -0
  176. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/definitions/test_limit_config.py +0 -0
  177. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/definitions/test_version.py +0 -0
  178. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/test_definitions.py +0 -0
  179. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/test_kpis.py +0 -0
  180. {payi-0.1.0a133 → payi-0.1.0a134}/tests/api_resources/use_cases/test_properties.py +0 -0
  181. {payi-0.1.0a133 → payi-0.1.0a134}/tests/conftest.py +0 -0
  182. {payi-0.1.0a133 → payi-0.1.0a134}/tests/sample_file.txt +0 -0
  183. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_client.py +0 -0
  184. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_deepcopy.py +0 -0
  185. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_extract_files.py +0 -0
  186. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_files.py +0 -0
  187. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_models.py +0 -0
  188. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_qs.py +0 -0
  189. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_required_args.py +0 -0
  190. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_response.py +0 -0
  191. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_streaming.py +0 -0
  192. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_transform.py +0 -0
  193. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_utils/test_datetime_parse.py +0 -0
  194. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_utils/test_proxy.py +0 -0
  195. {payi-0.1.0a133 → payi-0.1.0a134}/tests/test_utils/test_typing.py +0 -0
  196. {payi-0.1.0a133 → payi-0.1.0a134}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.134"
3
+ }
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.134 (2025-10-30)
4
+
5
+ Full Changelog: [v0.1.0-alpha.133...v0.1.0-alpha.134](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.133...v0.1.0-alpha.134)
6
+
7
+ ### Features
8
+
9
+ * model mapping configuration ([#388](https://github.com/Pay-i/pay-i-python/issues/388)) ([dd3c9da](https://github.com/Pay-i/pay-i-python/commit/dd3c9da33328b8005e416341f2017dbe17c2fc1e))
10
+
3
11
  ## 0.1.0-alpha.133 (2025-10-30)
4
12
 
5
13
  Full Changelog: [v0.1.0-alpha.132...v0.1.0-alpha.133](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.132...v0.1.0-alpha.133)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a133
3
+ Version: 0.1.0a134
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.133"
3
+ version = "0.1.0-alpha.134"
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.133" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.134" # x-release-please-version
@@ -195,15 +195,26 @@ class _AnthropicProviderRequest(_ProviderRequest):
195
195
 
196
196
  return None
197
197
 
198
+ def _update_resource_name(self, model: str) -> str:
199
+ return ("anthropic." if self._is_vertex else "") + model
200
+
198
201
  @override
199
- def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
200
- self._ingest["resource"] = ("anthropic." if self._is_vertex else "") + kwargs.get("model", "")
202
+ def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
203
+ self._ingest["resource"] = self._update_resource_name(kwargs.get("model", ""))
204
+
205
+ if self._price_as.resource_scope:
206
+ self._ingest["resource_scope"] = self._price_as.resource_scope
207
+
208
+ # override defaults
209
+ if self._price_as.category:
210
+ self._ingest["category"] = self._price_as.category
211
+ if self._price_as.resource:
212
+ self._ingest["resource"] = self._update_resource_name(self._price_as.resource)
201
213
 
202
214
  self._instrumentor._logger.debug(f"Processing anthropic request: model {self._ingest['resource']}, category {self._category}")
203
215
 
204
216
  messages = kwargs.get("messages")
205
217
  if messages:
206
-
207
218
  anthropic_has_image_and_get_texts(self, messages)
208
219
 
209
220
  return True
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  import json
3
- from typing import TYPE_CHECKING, Any, Optional, Sequence
3
+ from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence
4
4
  from functools import wraps
5
5
  from typing_extensions import override
6
6
 
@@ -12,6 +12,7 @@ from payi.types.pay_i_common_models_api_router_header_info_param import PayIComm
12
12
 
13
13
  from .instrument import (
14
14
  PayiInstrumentAwsBedrockConfig,
15
+ _Context,
15
16
  _ChunkResult,
16
17
  _IsStreaming,
17
18
  _StreamingType,
@@ -35,8 +36,31 @@ class BedrockInstrumentor:
35
36
 
36
37
  _guardrail_trace: bool = True
37
38
 
39
+ _model_mapping: Dict[str, _Context] = {}
40
+
41
+ @staticmethod
42
+ def get_mapping(model_id: Optional[str]) -> _Context:
43
+ if not model_id:
44
+ return {}
45
+
46
+ return BedrockInstrumentor._model_mapping.get(model_id, {})
47
+
48
+ @staticmethod
49
+ def configure(aws_config: Optional[PayiInstrumentAwsBedrockConfig]) -> None:
50
+ if not aws_config:
51
+ return
52
+
53
+ trace = aws_config.get("guardrail_trace", True)
54
+ if trace is None:
55
+ trace = True
56
+ BedrockInstrumentor._guardrail_trace = trace
57
+
58
+ model_mappings = aws_config.get("model_mappings", [])
59
+ if model_mappings:
60
+ BedrockInstrumentor._model_mapping = _PayiInstrumentor._model_mapping_to_context_dict(model_mappings)
61
+
38
62
  @staticmethod
39
- def instrument(instrumentor: _PayiInstrumentor, aws_config: Optional[PayiInstrumentAwsBedrockConfig]) -> None:
63
+ def instrument(instrumentor: _PayiInstrumentor) -> None:
40
64
  BedrockInstrumentor._instrumentor = instrumentor
41
65
 
42
66
  BedrockInstrumentor._module_version = get_version_helper(BedrockInstrumentor._module_name)
@@ -58,9 +82,6 @@ class BedrockInstrumentor:
58
82
  instrumentor._logger.debug(f"Error instrumenting bedrock: {e}")
59
83
  return
60
84
 
61
- if aws_config:
62
- BedrockInstrumentor._guardrail_trace = aws_config.get("guardrail_trace", True)
63
-
64
85
  @_PayiInstrumentor.payi_wrapper
65
86
  def create_client_wrapper(instrumentor: _PayiInstrumentor, wrapped: Any, instance: Any, *args: Any, **kwargs: Any) -> Any: # noqa: ARG001
66
87
  if kwargs.get("service_name") != "bedrock-runtime":
@@ -69,10 +90,10 @@ def create_client_wrapper(instrumentor: _PayiInstrumentor, wrapped: Any, instanc
69
90
 
70
91
  try:
71
92
  client: Any = wrapped(*args, **kwargs)
72
- client.invoke_model = wrap_invoke(instrumentor, client.invoke_model)
73
- client.invoke_model_with_response_stream = wrap_invoke_stream(instrumentor, client.invoke_model_with_response_stream)
74
- client.converse = wrap_converse(instrumentor, client.converse)
75
- client.converse_stream = wrap_converse_stream(instrumentor, client.converse_stream)
93
+ client.invoke_model = wrap_invoke(instrumentor, client.invoke_model, client)
94
+ client.invoke_model_with_response_stream = wrap_invoke_stream(instrumentor, client.invoke_model_with_response_stream, client)
95
+ client.converse = wrap_converse(instrumentor, client.converse, client)
96
+ client.converse_stream = wrap_converse_stream(instrumentor, client.converse_stream, client)
76
97
 
77
98
  instrumentor._logger.debug(f"Instrumented bedrock client")
78
99
 
@@ -221,7 +242,7 @@ class InvokeResponseWrapper(ObjectProxy): # type: ignore
221
242
 
222
243
  return data # type: ignore
223
244
 
224
- def wrap_invoke(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
245
+ def wrap_invoke(instrumentor: _PayiInstrumentor, wrapped: Any, instance: Any) -> Any:
225
246
  @wraps(wrapped)
226
247
  def invoke_wrapper(*args: Any, **kwargs: 'dict[str, Any]') -> Any:
227
248
  modelId:str = kwargs.get("modelId", "") # type: ignore
@@ -230,14 +251,14 @@ def wrap_invoke(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
230
251
  _BedrockInvokeProviderRequest(instrumentor=instrumentor, model_id=modelId),
231
252
  _IsStreaming.false,
232
253
  wrapped,
233
- None,
254
+ instance,
234
255
  args,
235
256
  kwargs,
236
257
  )
237
258
 
238
259
  return invoke_wrapper
239
260
 
240
- def wrap_invoke_stream(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
261
+ def wrap_invoke_stream(instrumentor: _PayiInstrumentor, wrapped: Any, instance: Any) -> Any:
241
262
  @wraps(wrapped)
242
263
  def invoke_wrapper(*args: Any, **kwargs: Any) -> Any:
243
264
  modelId: str = kwargs.get("modelId", "") # type: ignore
@@ -247,14 +268,14 @@ def wrap_invoke_stream(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
247
268
  _BedrockInvokeProviderRequest(instrumentor=instrumentor, model_id=modelId),
248
269
  _IsStreaming.true,
249
270
  wrapped,
250
- None,
271
+ instance,
251
272
  args,
252
273
  kwargs,
253
274
  )
254
275
 
255
276
  return invoke_wrapper
256
277
 
257
- def wrap_converse(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
278
+ def wrap_converse(instrumentor: _PayiInstrumentor, wrapped: Any, instance: Any) -> Any:
258
279
  @wraps(wrapped)
259
280
  def invoke_wrapper(*args: Any, **kwargs: 'dict[str, Any]') -> Any:
260
281
  modelId:str = kwargs.get("modelId", "") # type: ignore
@@ -264,14 +285,14 @@ def wrap_converse(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
264
285
  _BedrockConverseProviderRequest(instrumentor=instrumentor),
265
286
  _IsStreaming.false,
266
287
  wrapped,
267
- None,
288
+ instance,
268
289
  args,
269
290
  kwargs,
270
291
  )
271
292
 
272
293
  return invoke_wrapper
273
294
 
274
- def wrap_converse_stream(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
295
+ def wrap_converse_stream(instrumentor: _PayiInstrumentor, wrapped: Any, instance: Any) -> Any:
275
296
  @wraps(wrapped)
276
297
  def invoke_wrapper(*args: Any, **kwargs: Any) -> Any:
277
298
  modelId: str = kwargs.get("modelId", "") # type: ignore
@@ -281,7 +302,7 @@ def wrap_converse_stream(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
281
302
  _BedrockConverseProviderRequest(instrumentor=instrumentor),
282
303
  _IsStreaming.true,
283
304
  wrapped,
284
- None,
305
+ instance,
285
306
  args,
286
307
  kwargs,
287
308
  )
@@ -301,10 +322,25 @@ class _BedrockProviderRequest(_ProviderRequest):
301
322
  )
302
323
 
303
324
  @override
304
- def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
305
- # boto3 doesn't allow extra_headers
306
- kwargs.pop("extra_headers", None)
307
- self._ingest["resource"] = kwargs.get("modelId", "")
325
+ def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
326
+ modelId = kwargs.get("modelId", "")
327
+ self._ingest["resource"] = modelId
328
+
329
+ if not self._price_as.resource and not self._price_as.category and BedrockInstrumentor._model_mapping:
330
+ deployment = BedrockInstrumentor._model_mapping.get(modelId, {})
331
+ self._price_as.category = deployment.get("price_as_category", "")
332
+ self._price_as.resource = deployment.get("price_as_resource", "")
333
+ self._price_as.resource_scope = deployment.get("resource_scope", None)
334
+
335
+ if self._price_as.resource_scope:
336
+ self._ingest["resource_scope"] = self._price_as.resource_scope
337
+
338
+ # override defaults
339
+ if self._price_as.category:
340
+ self._ingest["category"] = self._price_as.category
341
+ if self._price_as.resource:
342
+ self._ingest["resource"] = self._price_as.resource
343
+
308
344
  return True
309
345
 
310
346
  @override
@@ -384,11 +420,25 @@ class _BedrockProviderRequest(_ProviderRequest):
384
420
  class _BedrockInvokeProviderRequest(_BedrockProviderRequest):
385
421
  def __init__(self, instrumentor: _PayiInstrumentor, model_id: str):
386
422
  super().__init__(instrumentor=instrumentor)
387
- self._is_anthropic: bool = 'anthropic' in model_id
388
- self._is_nova: bool = 'nova' in model_id
389
- self._is_meta: bool = 'meta' in model_id
390
- self._is_amazon_titan_embed_text_v1: bool = 'amazon.titan-embed-text-v1' == model_id
391
- self._is_cohere_embed_english_v3: bool = 'cohere.embed-english-v3' == model_id
423
+
424
+ price_as_resource = BedrockInstrumentor._model_mapping.get(model_id, {}).get("price_as_resource", None)
425
+ if price_as_resource:
426
+ model_id = price_as_resource
427
+
428
+ self._is_anthropic: bool = False
429
+ self._is_nova: bool = False
430
+ self._is_meta: bool = False
431
+ self._is_amazon_titan_embed_text_v1: bool = False
432
+ self._is_cohere_embed_english_v3: bool = False
433
+
434
+ self._assign_model_state(model_id=model_id)
435
+
436
+ def _assign_model_state(self, model_id: str) -> None:
437
+ self._is_anthropic = 'anthropic' in model_id
438
+ self._is_nova = 'nova' in model_id
439
+ self._is_meta = 'meta' in model_id
440
+ self._is_amazon_titan_embed_text_v1 = 'amazon.titan-embed-text-v1' == model_id
441
+ self._is_cohere_embed_english_v3 = 'cohere.embed-english-v3' == model_id
392
442
 
393
443
  @override
394
444
  def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
@@ -396,6 +446,10 @@ class _BedrockInvokeProviderRequest(_BedrockProviderRequest):
396
446
 
397
447
  super().process_request(instance, extra_headers, args, kwargs)
398
448
 
449
+ # super().process_request will assign price_as mapping from global state, so evaluate afterwards
450
+ if self._price_as.resource:
451
+ self._assign_model_state(model_id=self._price_as.resource)
452
+
399
453
  guardrail_id = kwargs.get("guardrailIdentifier", "")
400
454
  if guardrail_id:
401
455
  self.add_internal_request_property(PayiPropertyNames.aws_bedrock_guardrail_id, guardrail_id)
@@ -524,7 +578,7 @@ class _BedrockConverseProviderRequest(_BedrockProviderRequest):
524
578
  @override
525
579
  def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
526
580
  super().process_request(instance, extra_headers, args, kwargs)
527
-
581
+
528
582
  guardrail_config = kwargs.get("guardrailConfig", {})
529
583
  if guardrail_config:
530
584
  guardrailIdentifier = guardrail_config.get("guardrailIdentifier", "")
@@ -1,15 +1,23 @@
1
1
  import json
2
- from typing import Any, Union, Optional, Sequence
2
+ from typing import Any, Dict, Union, Optional, Sequence
3
3
  from typing_extensions import override
4
4
  from importlib.metadata import version
5
5
 
6
6
  import tiktoken # type: ignore
7
7
  from wrapt import wrap_function_wrapper # type: ignore
8
8
 
9
- from payi.lib.helpers import PayiCategories, PayiHeaderNames
9
+ from payi.lib.helpers import PayiCategories
10
10
  from payi.types.ingest_units_params import Units
11
11
 
12
- from .instrument import _ChunkResult, _IsStreaming, _StreamingType, _ProviderRequest, _PayiInstrumentor
12
+ from .instrument import (
13
+ PayiInstrumentAzureOpenAiConfig,
14
+ _Context,
15
+ _ChunkResult,
16
+ _IsStreaming,
17
+ _StreamingType,
18
+ _ProviderRequest,
19
+ _PayiInstrumentor,
20
+ )
13
21
  from .version_helper import get_version_helper
14
22
 
15
23
 
@@ -17,12 +25,20 @@ class OpenAiInstrumentor:
17
25
  _module_name: str = "openai"
18
26
  _module_version: str = ""
19
27
 
28
+ _azure_openai_deployments: Dict[str, _Context] = {}
29
+
20
30
  @staticmethod
21
31
  def is_azure(instance: Any) -> bool:
22
32
  from openai import AzureOpenAI, AsyncAzureOpenAI # type: ignore # noqa: I001
23
33
 
24
34
  return isinstance(instance._client, (AsyncAzureOpenAI, AzureOpenAI))
25
35
 
36
+ @staticmethod
37
+ def configure(azure_openai_config: Optional[PayiInstrumentAzureOpenAiConfig]) -> None:
38
+ if azure_openai_config:
39
+ model_mappings = azure_openai_config.get("model_mappings", [])
40
+ OpenAiInstrumentor._azure_openai_deployments = _PayiInstrumentor._model_mapping_to_context_dict(model_mappings)
41
+
26
42
  @staticmethod
27
43
  def instrument(instrumentor: _PayiInstrumentor) -> None:
28
44
  try:
@@ -52,7 +68,7 @@ class OpenAiInstrumentor:
52
68
  aembeddings_wrapper(instrumentor),
53
69
  )
54
70
  except Exception as e:
55
- instrumentor._logger.debug(f"Error instrumenting openai: {e}")
71
+ instrumentor._logger.debug(f"Error instrumenting openai completions: {e}")
56
72
 
57
73
  # responses separately as they are relatively new and the client may not be using the latest openai module
58
74
  try:
@@ -69,7 +85,7 @@ class OpenAiInstrumentor:
69
85
  )
70
86
 
71
87
  except Exception as e:
72
- instrumentor._logger.debug(f"Error instrumenting openai: {e}")
88
+ instrumentor._logger.debug(f"Error instrumenting openai responses: {e}")
73
89
 
74
90
  @_PayiInstrumentor.payi_wrapper
75
91
  def embeddings_wrapper(
@@ -201,44 +217,39 @@ class _OpenAiProviderRequest(_ProviderRequest):
201
217
  self._input_tokens_details_key = input_tokens_details_key
202
218
 
203
219
  @override
204
- def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool: # type: ignore
205
- self._ingest["resource"] = kwargs.get("model", "")
220
+ def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool: # type: ignore
221
+ model = kwargs.get("model", "")
206
222
 
207
223
  if not (instance and hasattr(instance, "_client")) or OpenAiInstrumentor.is_azure(instance) is False:
224
+ self._ingest["resource"] = model
208
225
  return True
209
226
 
210
- context = self._instrumentor.get_context_safe()
211
- price_as_category = extra_headers.get(PayiHeaderNames.price_as_category) or context.get("price_as_category")
212
- price_as_resource = extra_headers.get(PayiHeaderNames.price_as_resource) or context.get("price_as_resource")
213
- resource_scope = extra_headers.get(PayiHeaderNames.resource_scope) or context.get("resource_scope")
214
-
215
- if PayiHeaderNames.price_as_category in extra_headers:
216
- del extra_headers[PayiHeaderNames.price_as_category]
217
- if PayiHeaderNames.price_as_resource in extra_headers:
218
- del extra_headers[PayiHeaderNames.price_as_resource]
219
- if PayiHeaderNames.resource_scope in extra_headers:
220
- del extra_headers[PayiHeaderNames.resource_scope]
221
-
222
- if not price_as_resource and not price_as_category:
227
+ if not self._price_as.resource and not self._price_as.category and OpenAiInstrumentor._azure_openai_deployments:
228
+ deployment = OpenAiInstrumentor._azure_openai_deployments.get(model, {})
229
+ self._price_as.category = deployment.get("price_as_category", None)
230
+ self._price_as.resource = deployment.get("price_as_resource", None)
231
+ self._price_as.resource_scope = deployment.get("resource_scope", None)
232
+
233
+ if not self._price_as.resource and not self._price_as.category:
223
234
  self._instrumentor._logger.error("Azure OpenAI requires price as resource and/or category to be specified, not ingesting")
224
235
  return False
225
236
 
226
- if resource_scope:
227
- if not(resource_scope in ["global", "datazone"] or resource_scope.startswith("region")):
237
+ if self._price_as.resource_scope:
238
+ if not (self._price_as.resource_scope in ["global", "datazone"] or self._price_as.resource_scope.startswith("region")):
228
239
  self._instrumentor._logger.error("Azure OpenAI invalid resource scope, not ingesting")
229
240
  return False
230
241
 
231
- self._ingest["resource_scope"] = resource_scope
242
+ self._ingest["resource_scope"] = self._price_as.resource_scope
232
243
 
233
244
  self._category = PayiCategories.azure_openai
234
245
 
235
246
  self._ingest["category"] = self._category
236
247
 
237
- if price_as_category:
248
+ if self._price_as.category:
238
249
  # price as category overrides default
239
- self._ingest["category"] = price_as_category
240
- if price_as_resource:
241
- self._ingest["resource"] = price_as_resource
250
+ self._ingest["category"] = self._price_as.category
251
+ if self._price_as.resource:
252
+ self._ingest["resource"] = self._price_as.resource
242
253
 
243
254
  return True
244
255
 
@@ -1,15 +1,18 @@
1
1
  import os
2
- from typing import Dict, List, Union
2
+ import json
3
+ from typing import Any, Dict, List, Union
3
4
 
4
5
  PAYI_BASE_URL = "https://api.pay-i.com"
5
6
 
6
7
  class PayiHeaderNames:
7
8
  limit_ids:str = "xProxy-Limit-IDs"
8
9
  request_tags:str = "xProxy-Request-Tags"
10
+ request_properties:str = "xProxy-Request-Properties"
9
11
  use_case_id:str = "xProxy-UseCase-ID"
10
12
  use_case_name:str = "xProxy-UseCase-Name"
11
13
  use_case_version:str = "xProxy-UseCase-Version"
12
14
  use_case_step:str = "xProxy-UseCase-Step"
15
+ use_case_properties:str = "xProxy-UseCase-Properties"
13
16
  user_id:str = "xProxy-User-ID"
14
17
  account_name:str = "xProxy-Account-Name"
15
18
  price_as_category:str = "xProxy-PriceAs-Category"
@@ -37,6 +40,11 @@ class PayiPropertyNames:
37
40
  aws_bedrock_guardrail_version:str = "system.aws.bedrock.guardrail.version"
38
41
  aws_bedrock_guardrail_action:str = "system.aws.bedrock.guardrail.action"
39
42
 
43
+ class PayiResourceScopes:
44
+ global_scope: str = "global"
45
+ datazone_scope: str = "datazone"
46
+ region_scope: str = "region"
47
+
40
48
  def create_limit_header_from_ids(*, limit_ids: List[str]) -> Dict[str, str]:
41
49
  if not isinstance(limit_ids, list): # type: ignore
42
50
  raise TypeError("limit_ids must be a list")
@@ -53,6 +61,9 @@ def create_request_header_from_tags(*, request_tags: List[str]) -> Dict[str, str
53
61
 
54
62
  return { PayiHeaderNames.request_tags: ",".join(valid_tags) } if valid_tags else {}
55
63
 
64
+ def _compact_json(data: Any) -> str:
65
+ return json.dumps(data, separators=(',', ':'))
66
+
56
67
  def create_headers(
57
68
  *,
58
69
  limit_ids: Union[List[str], None] = None,
@@ -63,6 +74,8 @@ def create_headers(
63
74
  use_case_name: Union[str, None] = None,
64
75
  use_case_version: Union[int, None] = None,
65
76
  use_case_step: Union[str, None] = None,
77
+ use_case_properties: Union[Dict[str, str], None] = None,
78
+ request_properties: Union[Dict[str, str], None] = None,
66
79
  price_as_category: Union[str, None] = None,
67
80
  price_as_resource: Union[str, None] = None,
68
81
  resource_scope: Union[str, None] = None,
@@ -83,6 +96,10 @@ def create_headers(
83
96
  headers.update({ PayiHeaderNames.use_case_name: use_case_name})
84
97
  if use_case_version:
85
98
  headers.update({ PayiHeaderNames.use_case_version: str(use_case_version)})
99
+ if use_case_properties:
100
+ headers.update({ PayiHeaderNames.use_case_properties: _compact_json(use_case_properties) })
101
+ if request_properties:
102
+ headers.update({ PayiHeaderNames.request_properties: _compact_json(request_properties) })
86
103
  if use_case_step:
87
104
  headers.update({ PayiHeaderNames.use_case_step: use_case_step})
88
105
  if price_as_category: