payi 0.1.0a60__tar.gz → 0.1.0a61__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 (198) hide show
  1. payi-0.1.0a61/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a60 → payi-0.1.0a61}/CHANGELOG.md +8 -0
  3. {payi-0.1.0a60 → payi-0.1.0a61}/PKG-INFO +1 -1
  4. {payi-0.1.0a60 → payi-0.1.0a61}/pyproject.toml +1 -1
  5. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_version.py +1 -1
  6. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/AnthropicInstrumentor.py +11 -11
  7. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/BedrockInstrumentor.py +15 -15
  8. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/OpenAIInstrumentor.py +16 -16
  9. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/helpers.py +16 -12
  10. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/instrument.py +56 -25
  11. payi-0.1.0a60/.release-please-manifest.json +0 -3
  12. {payi-0.1.0a60 → payi-0.1.0a61}/.gitignore +0 -0
  13. {payi-0.1.0a60 → payi-0.1.0a61}/CONTRIBUTING.md +0 -0
  14. {payi-0.1.0a60 → payi-0.1.0a61}/LICENSE +0 -0
  15. {payi-0.1.0a60 → payi-0.1.0a61}/README.md +0 -0
  16. {payi-0.1.0a60 → payi-0.1.0a61}/SECURITY.md +0 -0
  17. {payi-0.1.0a60 → payi-0.1.0a61}/api.md +0 -0
  18. {payi-0.1.0a60 → payi-0.1.0a61}/bin/check-release-environment +0 -0
  19. {payi-0.1.0a60 → payi-0.1.0a61}/bin/publish-pypi +0 -0
  20. {payi-0.1.0a60 → payi-0.1.0a61}/examples/.keep +0 -0
  21. {payi-0.1.0a60 → payi-0.1.0a61}/mypy.ini +0 -0
  22. {payi-0.1.0a60 → payi-0.1.0a61}/noxfile.py +0 -0
  23. {payi-0.1.0a60 → payi-0.1.0a61}/release-please-config.json +0 -0
  24. {payi-0.1.0a60 → payi-0.1.0a61}/requirements-dev.lock +0 -0
  25. {payi-0.1.0a60 → payi-0.1.0a61}/requirements.lock +0 -0
  26. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/__init__.py +0 -0
  27. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_base_client.py +0 -0
  28. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_client.py +0 -0
  29. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_compat.py +0 -0
  30. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_constants.py +0 -0
  31. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_exceptions.py +0 -0
  32. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_files.py +0 -0
  33. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_models.py +0 -0
  34. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_qs.py +0 -0
  35. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_resource.py +0 -0
  36. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_response.py +0 -0
  37. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_streaming.py +0 -0
  38. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_types.py +0 -0
  39. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/__init__.py +0 -0
  40. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_logs.py +0 -0
  41. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_proxy.py +0 -0
  42. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_reflection.py +0 -0
  43. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_streams.py +0 -0
  44. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_sync.py +0 -0
  45. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_transform.py +0 -0
  46. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_typing.py +0 -0
  47. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/_utils/_utils.py +0 -0
  48. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/.keep +0 -0
  49. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/lib/Stopwatch.py +0 -0
  50. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/pagination.py +0 -0
  51. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/py.typed +0 -0
  52. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/__init__.py +0 -0
  53. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/categories/__init__.py +0 -0
  54. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/categories/categories.py +0 -0
  55. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/categories/resources.py +0 -0
  56. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/experiences/__init__.py +0 -0
  57. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/experiences/experiences.py +0 -0
  58. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/experiences/properties.py +0 -0
  59. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/experiences/types/__init__.py +0 -0
  60. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/experiences/types/limit_config.py +0 -0
  61. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/experiences/types/types.py +0 -0
  62. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/ingest.py +0 -0
  63. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/limits/__init__.py +0 -0
  64. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/limits/limits.py +0 -0
  65. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/limits/tags.py +0 -0
  66. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/requests/__init__.py +0 -0
  67. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/requests/properties.py +0 -0
  68. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/requests/requests.py +0 -0
  69. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/requests/result.py +0 -0
  70. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/__init__.py +0 -0
  71. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/definitions/__init__.py +0 -0
  72. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/definitions/definitions.py +0 -0
  73. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/definitions/kpis.py +0 -0
  74. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/definitions/limit_config.py +0 -0
  75. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/definitions/version.py +0 -0
  76. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/kpis.py +0 -0
  77. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/properties.py +0 -0
  78. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/resources/use_cases/use_cases.py +0 -0
  79. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/__init__.py +0 -0
  80. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/bulk_ingest_response.py +0 -0
  81. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/categories/__init__.py +0 -0
  82. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/categories/resource_create_params.py +0 -0
  83. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/categories/resource_list_params.py +0 -0
  84. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/category_delete_resource_response.py +0 -0
  85. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/category_delete_response.py +0 -0
  86. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/category_list_params.py +0 -0
  87. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/category_list_resources_params.py +0 -0
  88. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/category_resource_response.py +0 -0
  89. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/category_response.py +0 -0
  90. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/cost_data.py +0 -0
  91. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/cost_details.py +0 -0
  92. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/default_response.py +0 -0
  93. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experience_instance_response.py +0 -0
  94. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/__init__.py +0 -0
  95. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/experience_type.py +0 -0
  96. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/property_create_params.py +0 -0
  97. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/type_create_params.py +0 -0
  98. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/type_list_params.py +0 -0
  99. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/type_update_params.py +0 -0
  100. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/types/__init__.py +0 -0
  101. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/experiences/types/limit_config_create_params.py +0 -0
  102. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/ingest_bulk_params.py +0 -0
  103. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/ingest_event_param.py +0 -0
  104. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/ingest_response.py +0 -0
  105. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/ingest_units_params.py +0 -0
  106. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_create_params.py +0 -0
  107. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_history_response.py +0 -0
  108. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_list_params.py +0 -0
  109. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_list_response.py +0 -0
  110. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_reset_params.py +0 -0
  111. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_response.py +0 -0
  112. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limit_update_params.py +0 -0
  113. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/__init__.py +0 -0
  114. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/limit_tags.py +0 -0
  115. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_create_params.py +0 -0
  116. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_create_response.py +0 -0
  117. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_delete_response.py +0 -0
  118. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_list_response.py +0 -0
  119. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_remove_params.py +0 -0
  120. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_remove_response.py +0 -0
  121. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_update_params.py +0 -0
  122. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/limits/tag_update_response.py +0 -0
  123. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/pay_i_common_models_api_router_header_info_param.py +0 -0
  124. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/requests/__init__.py +0 -0
  125. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/requests/property_create_params.py +0 -0
  126. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/requests/request_result.py +0 -0
  127. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/requests_data.py +0 -0
  128. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared/__init__.py +0 -0
  129. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared/evaluation_response.py +0 -0
  130. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared/pay_i_common_models_budget_management_cost_details_base.py +0 -0
  131. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared/pay_i_common_models_budget_management_create_limit_base.py +0 -0
  132. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared/properties_response.py +0 -0
  133. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared_params/__init__.py +0 -0
  134. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/shared_params/pay_i_common_models_budget_management_create_limit_base.py +0 -0
  135. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/total_cost_data.py +0 -0
  136. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_case_instance_response.py +0 -0
  137. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/__init__.py +0 -0
  138. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definition_create_params.py +0 -0
  139. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definition_list_params.py +0 -0
  140. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definition_update_params.py +0 -0
  141. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/__init__.py +0 -0
  142. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_create_params.py +0 -0
  143. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_create_response.py +0 -0
  144. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_delete_response.py +0 -0
  145. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_list_params.py +0 -0
  146. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_list_response.py +0 -0
  147. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_retrieve_response.py +0 -0
  148. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_update_params.py +0 -0
  149. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/kpi_update_response.py +0 -0
  150. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/definitions/limit_config_create_params.py +0 -0
  151. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/kpi_create_params.py +0 -0
  152. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/kpi_list_params.py +0 -0
  153. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/kpi_list_response.py +0 -0
  154. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/kpi_update_params.py +0 -0
  155. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/property_create_params.py +0 -0
  156. {payi-0.1.0a60 → payi-0.1.0a61}/src/payi/types/use_cases/use_case_definition.py +0 -0
  157. {payi-0.1.0a60 → payi-0.1.0a61}/tests/__init__.py +0 -0
  158. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/__init__.py +0 -0
  159. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/categories/__init__.py +0 -0
  160. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/categories/test_resources.py +0 -0
  161. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/experiences/__init__.py +0 -0
  162. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/experiences/test_properties.py +0 -0
  163. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/experiences/test_types.py +0 -0
  164. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/experiences/types/__init__.py +0 -0
  165. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/experiences/types/test_limit_config.py +0 -0
  166. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/limits/__init__.py +0 -0
  167. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/limits/test_tags.py +0 -0
  168. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/requests/__init__.py +0 -0
  169. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/requests/test_properties.py +0 -0
  170. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/requests/test_result.py +0 -0
  171. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/test_categories.py +0 -0
  172. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/test_experiences.py +0 -0
  173. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/test_ingest.py +0 -0
  174. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/test_limits.py +0 -0
  175. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/test_use_cases.py +0 -0
  176. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/__init__.py +0 -0
  177. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/definitions/__init__.py +0 -0
  178. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/definitions/test_kpis.py +0 -0
  179. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/definitions/test_limit_config.py +0 -0
  180. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/definitions/test_version.py +0 -0
  181. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/test_definitions.py +0 -0
  182. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/test_kpis.py +0 -0
  183. {payi-0.1.0a60 → payi-0.1.0a61}/tests/api_resources/use_cases/test_properties.py +0 -0
  184. {payi-0.1.0a60 → payi-0.1.0a61}/tests/conftest.py +0 -0
  185. {payi-0.1.0a60 → payi-0.1.0a61}/tests/sample_file.txt +0 -0
  186. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_client.py +0 -0
  187. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_deepcopy.py +0 -0
  188. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_extract_files.py +0 -0
  189. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_files.py +0 -0
  190. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_models.py +0 -0
  191. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_qs.py +0 -0
  192. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_required_args.py +0 -0
  193. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_response.py +0 -0
  194. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_streaming.py +0 -0
  195. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_transform.py +0 -0
  196. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_utils/test_proxy.py +0 -0
  197. {payi-0.1.0a60 → payi-0.1.0a61}/tests/test_utils/test_typing.py +0 -0
  198. {payi-0.1.0a60 → payi-0.1.0a61}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.61"
3
+ }
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.61 (2025-04-07)
4
+
5
+ Full Changelog: [v0.1.0-alpha.60...v0.1.0-alpha.61](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.60...v0.1.0-alpha.61)
6
+
7
+ ### Features
8
+
9
+ * feat(api): global instrumentation ([6977d0c](https://github.com/Pay-i/pay-i-python/commit/6977d0c78ffaa12bb43a439827b0fba08b258e55))
10
+
3
11
  ## 0.1.0-alpha.60 (2025-04-07)
4
12
 
5
13
  Full Changelog: [v0.1.0-alpha.59...v0.1.0-alpha.60](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.59...v0.1.0-alpha.60)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a60
3
+ Version: 0.1.0a61
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.60"
3
+ version = "0.1.0-alpha.61"
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.60" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.61" # x-release-please-version
@@ -7,12 +7,12 @@ from wrapt import wrap_function_wrapper # type: ignore
7
7
  from payi.types import IngestUnitsParams
8
8
  from payi.types.ingest_units_params import Units
9
9
 
10
- from .instrument import IsStreaming, PayiInstrumentor
10
+ from .instrument import _IsStreaming, _PayiInstrumentor
11
11
 
12
12
 
13
13
  class AnthropicIntrumentor:
14
14
  @staticmethod
15
- def instrument(instrumentor: PayiInstrumentor) -> None:
15
+ def instrument(instrumentor: _PayiInstrumentor) -> None:
16
16
  try:
17
17
  import anthropic # type: ignore # noqa: F401 I001
18
18
 
@@ -45,9 +45,9 @@ class AnthropicIntrumentor:
45
45
  return
46
46
 
47
47
 
48
- @PayiInstrumentor.payi_wrapper
48
+ @_PayiInstrumentor.payi_wrapper
49
49
  def chat_wrapper(
50
- instrumentor: PayiInstrumentor,
50
+ instrumentor: _PayiInstrumentor,
51
51
  wrapped: Any,
52
52
  instance: Any,
53
53
  *args: Any,
@@ -58,16 +58,16 @@ def chat_wrapper(
58
58
  process_chunk,
59
59
  process_request,
60
60
  process_synchronous_response,
61
- IsStreaming.kwargs,
61
+ _IsStreaming.kwargs,
62
62
  wrapped,
63
63
  instance,
64
64
  args,
65
65
  kwargs,
66
66
  )
67
67
 
68
- @PayiInstrumentor.payi_awrapper
68
+ @_PayiInstrumentor.payi_awrapper
69
69
  async def achat_wrapper(
70
- instrumentor: PayiInstrumentor,
70
+ instrumentor: _PayiInstrumentor,
71
71
  wrapped: Any,
72
72
  instance: Any,
73
73
  *args: Any,
@@ -78,7 +78,7 @@ async def achat_wrapper(
78
78
  process_chunk,
79
79
  process_request,
80
80
  process_synchronous_response,
81
- IsStreaming.kwargs,
81
+ _IsStreaming.kwargs,
82
82
  wrapped,
83
83
  instance,
84
84
  args,
@@ -93,7 +93,7 @@ def process_chunk(chunk: Any, ingest: IngestUnitsParams) -> None:
93
93
  usage = chunk.message.usage
94
94
  units = ingest["units"]
95
95
 
96
- input = PayiInstrumentor.update_for_vision(usage.input_tokens, units)
96
+ input = _PayiInstrumentor.update_for_vision(usage.input_tokens, units)
97
97
 
98
98
  units["text"] = Units(input=input, output=0)
99
99
 
@@ -124,7 +124,7 @@ def process_synchronous_response(response: Any, ingest: IngestUnitsParams, log_p
124
124
  text_cache_read = usage.cache_read_input_tokens
125
125
  units["text_cache_read"] = Units(input=text_cache_read, output=0)
126
126
 
127
- input = PayiInstrumentor.update_for_vision(input, units)
127
+ input = _PayiInstrumentor.update_for_vision(input, units)
128
128
 
129
129
  units["text"] = Units(input=input, output=output)
130
130
 
@@ -165,4 +165,4 @@ def process_request(ingest: IngestUnitsParams, *args: Any, **kwargs: Any) -> Non
165
165
  if not has_image or estimated_token_count == 0:
166
166
  return
167
167
 
168
- ingest["units"][PayiInstrumentor.estimated_prompt_tokens] = Units(input=estimated_token_count, output=0)
168
+ ingest["units"][_PayiInstrumentor.estimated_prompt_tokens] = Units(input=estimated_token_count, output=0)
@@ -8,12 +8,12 @@ from wrapt import ObjectProxy, wrap_function_wrapper # type: ignore
8
8
  from payi.types.ingest_units_params import Units, IngestUnitsParams
9
9
  from payi.types.pay_i_common_models_api_router_header_info_param import PayICommonModelsAPIRouterHeaderInfoParam
10
10
 
11
- from .instrument import IsStreaming, PayiInstrumentor
11
+ from .instrument import _IsStreaming, _PayiInstrumentor
12
12
 
13
13
 
14
14
  class BedrockInstrumentor:
15
15
  @staticmethod
16
- def instrument(instrumentor: PayiInstrumentor) -> None:
16
+ def instrument(instrumentor: _PayiInstrumentor) -> None:
17
17
  try:
18
18
  import boto3 # type: ignore # noqa: F401 I001
19
19
 
@@ -33,8 +33,8 @@ class BedrockInstrumentor:
33
33
  logging.debug(f"Error instrumenting bedrock: {e}")
34
34
  return
35
35
 
36
- @PayiInstrumentor.payi_wrapper
37
- def create_client_wrapper(instrumentor: PayiInstrumentor, wrapped: Any, instance: Any, *args: Any, **kwargs: Any) -> Any: # noqa: ARG001
36
+ @_PayiInstrumentor.payi_wrapper
37
+ def create_client_wrapper(instrumentor: _PayiInstrumentor, wrapped: Any, instance: Any, *args: Any, **kwargs: Any) -> Any: # noqa: ARG001
38
38
  if kwargs.get("service_name") != "bedrock-runtime":
39
39
  return wrapped(*args, **kwargs)
40
40
 
@@ -55,7 +55,7 @@ class InvokeResponseWrapper(ObjectProxy): # type: ignore
55
55
  def __init__(
56
56
  self,
57
57
  response: Any,
58
- instrumentor: PayiInstrumentor,
58
+ instrumentor: _PayiInstrumentor,
59
59
  ingest: IngestUnitsParams,
60
60
  log_prompt_and_response: bool
61
61
  ) -> None:
@@ -95,7 +95,7 @@ class InvokeResponseWrapper(ObjectProxy): # type: ignore
95
95
 
96
96
  return data
97
97
 
98
- def wrap_invoke(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
98
+ def wrap_invoke(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
99
99
  @wraps(wrapped)
100
100
  def invoke_wrapper(*args: Any, **kwargs: 'dict[str, Any]') -> Any:
101
101
  modelId:str = kwargs.get("modelId", "") # type: ignore
@@ -106,7 +106,7 @@ def wrap_invoke(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
106
106
  None,
107
107
  process_invoke_request,
108
108
  process_synchronous_invoke_response,
109
- IsStreaming.false,
109
+ _IsStreaming.false,
110
110
  wrapped,
111
111
  None,
112
112
  args,
@@ -116,7 +116,7 @@ def wrap_invoke(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
116
116
 
117
117
  return invoke_wrapper
118
118
 
119
- def wrap_invoke_stream(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
119
+ def wrap_invoke_stream(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
120
120
  @wraps(wrapped)
121
121
  def invoke_wrapper(*args: Any, **kwargs: Any) -> Any:
122
122
  modelId:str = kwargs.get("modelId", "") # type: ignore
@@ -127,7 +127,7 @@ def wrap_invoke_stream(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
127
127
  process_invoke_streaming_anthropic_chunk if modelId.startswith("anthropic.") else process_invoke_streaming_llama_chunk,
128
128
  process_invoke_request,
129
129
  None,
130
- IsStreaming.true,
130
+ _IsStreaming.true,
131
131
  wrapped,
132
132
  None,
133
133
  args,
@@ -137,7 +137,7 @@ def wrap_invoke_stream(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
137
137
 
138
138
  return invoke_wrapper
139
139
 
140
- def wrap_converse(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
140
+ def wrap_converse(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
141
141
  @wraps(wrapped)
142
142
  def invoke_wrapper(*args: Any, **kwargs: 'dict[str, Any]') -> Any:
143
143
  modelId:str = kwargs.get("modelId", "") # type: ignore
@@ -148,7 +148,7 @@ def wrap_converse(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
148
148
  None,
149
149
  process_converse_request,
150
150
  process_synchronous_converse_response,
151
- IsStreaming.false,
151
+ _IsStreaming.false,
152
152
  wrapped,
153
153
  None,
154
154
  args,
@@ -158,7 +158,7 @@ def wrap_converse(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
158
158
 
159
159
  return invoke_wrapper
160
160
 
161
- def wrap_converse_stream(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
161
+ def wrap_converse_stream(instrumentor: _PayiInstrumentor, wrapped: Any) -> Any:
162
162
  @wraps(wrapped)
163
163
  def invoke_wrapper(*args: Any, **kwargs: Any) -> Any:
164
164
  modelId:str = kwargs.get("modelId", "") # type: ignore
@@ -169,7 +169,7 @@ def wrap_converse_stream(instrumentor: PayiInstrumentor, wrapped: Any) -> Any:
169
169
  process_converse_streaming_chunk,
170
170
  process_converse_request,
171
171
  None,
172
- IsStreaming.true,
172
+ _IsStreaming.true,
173
173
  wrapped,
174
174
  None,
175
175
  args,
@@ -187,7 +187,7 @@ def process_invoke_streaming_anthropic_chunk(chunk: str, ingest: IngestUnitsPara
187
187
  usage = chunk_dict['message']['usage']
188
188
  units = ingest["units"]
189
189
 
190
- input = PayiInstrumentor.update_for_vision(usage['input_tokens'], units)
190
+ input = _PayiInstrumentor.update_for_vision(usage['input_tokens'], units)
191
191
 
192
192
  units["text"] = Units(input=input, output=0)
193
193
 
@@ -215,7 +215,7 @@ def process_synchronous_invoke_response(
215
215
  response: Any,
216
216
  ingest: IngestUnitsParams,
217
217
  log_prompt_and_response: bool,
218
- instrumentor: PayiInstrumentor,
218
+ instrumentor: _PayiInstrumentor,
219
219
  **kargs: Any) -> Any: # noqa: ARG001
220
220
 
221
221
  metadata = response.get("ResponseMetadata", {})
@@ -9,7 +9,7 @@ from wrapt import wrap_function_wrapper # type: ignore
9
9
  from payi.types import IngestUnitsParams
10
10
  from payi.types.ingest_units_params import Units
11
11
 
12
- from .instrument import IsStreaming, PayiInstrumentor
12
+ from .instrument import _IsStreaming, _PayiInstrumentor
13
13
 
14
14
 
15
15
  class OpenAiInstrumentor:
@@ -20,7 +20,7 @@ class OpenAiInstrumentor:
20
20
  return isinstance(instance._client, (AsyncAzureOpenAI, AzureOpenAI))
21
21
 
22
22
  @staticmethod
23
- def instrument(instrumentor: PayiInstrumentor) -> None:
23
+ def instrument(instrumentor: _PayiInstrumentor) -> None:
24
24
  try:
25
25
  from openai import OpenAI # type: ignore # noqa: F401 I001
26
26
 
@@ -53,9 +53,9 @@ class OpenAiInstrumentor:
53
53
  return
54
54
 
55
55
 
56
- @PayiInstrumentor.payi_wrapper
56
+ @_PayiInstrumentor.payi_wrapper
57
57
  def embeddings_wrapper(
58
- instrumentor: PayiInstrumentor,
58
+ instrumentor: _PayiInstrumentor,
59
59
  wrapped: Any,
60
60
  instance: Any,
61
61
  *args: Any,
@@ -66,16 +66,16 @@ def embeddings_wrapper(
66
66
  None, # process_chat_chunk,
67
67
  None, # process_chat_request,
68
68
  process_ebmeddings_synchronous_response,
69
- IsStreaming.false,
69
+ _IsStreaming.false,
70
70
  wrapped,
71
71
  instance,
72
72
  args,
73
73
  kwargs,
74
74
  )
75
75
 
76
- @PayiInstrumentor.payi_wrapper
76
+ @_PayiInstrumentor.payi_wrapper
77
77
  async def aembeddings_wrapper(
78
- instrumentor: PayiInstrumentor,
78
+ instrumentor: _PayiInstrumentor,
79
79
  wrapped: Any,
80
80
  instance: Any,
81
81
  *args: Any,
@@ -86,16 +86,16 @@ async def aembeddings_wrapper(
86
86
  None, # process_chat_chunk,
87
87
  None, # process_chat_request,
88
88
  process_ebmeddings_synchronous_response,
89
- IsStreaming.false,
89
+ _IsStreaming.false,
90
90
  wrapped,
91
91
  instance,
92
92
  args,
93
93
  kwargs,
94
94
  )
95
95
 
96
- @PayiInstrumentor.payi_wrapper
96
+ @_PayiInstrumentor.payi_wrapper
97
97
  def chat_wrapper(
98
- instrumentor: PayiInstrumentor,
98
+ instrumentor: _PayiInstrumentor,
99
99
  wrapped: Any,
100
100
  instance: Any,
101
101
  *args: Any,
@@ -106,16 +106,16 @@ def chat_wrapper(
106
106
  process_chat_chunk,
107
107
  process_chat_request,
108
108
  process_chat_synchronous_response,
109
- IsStreaming.kwargs,
109
+ _IsStreaming.kwargs,
110
110
  wrapped,
111
111
  instance,
112
112
  args,
113
113
  kwargs,
114
114
  )
115
115
 
116
- @PayiInstrumentor.payi_awrapper
116
+ @_PayiInstrumentor.payi_awrapper
117
117
  async def achat_wrapper(
118
- instrumentor: PayiInstrumentor,
118
+ instrumentor: _PayiInstrumentor,
119
119
  wrapped: Any,
120
120
  instance: Any,
121
121
  *args: Any,
@@ -126,7 +126,7 @@ async def achat_wrapper(
126
126
  process_chat_chunk,
127
127
  process_chat_request,
128
128
  process_chat_synchronous_response,
129
- IsStreaming.kwargs,
129
+ _IsStreaming.kwargs,
130
130
  wrapped,
131
131
  instance,
132
132
  args,
@@ -184,7 +184,7 @@ def add_usage_units(usage: "dict[str, Any]", units: "dict[str, Units]") -> None:
184
184
  if input_cache != 0:
185
185
  units["text_cache_read"] = Units(input=input_cache, output=0)
186
186
 
187
- input = PayiInstrumentor.update_for_vision(input - input_cache, units)
187
+ input = _PayiInstrumentor.update_for_vision(input - input_cache, units)
188
188
 
189
189
  units["text"] = Units(input=input, output=output)
190
190
 
@@ -221,4 +221,4 @@ def process_chat_request(ingest: IngestUnitsParams, *args: Any, **kwargs: Any) -
221
221
  if not has_image or estimated_token_count == 0:
222
222
  return
223
223
 
224
- ingest["units"][PayiInstrumentor.estimated_prompt_tokens] = Units(input=estimated_token_count, output=0)
224
+ ingest["units"][_PayiInstrumentor.estimated_prompt_tokens] = Units(input=estimated_token_count, output=0)
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from typing import Dict, List, Union
2
3
 
3
4
  PAYI_BASE_URL = "https://api.pay-i.com"
@@ -69,22 +70,25 @@ def create_headers(
69
70
  headers.update({ PayiHeaderNames.use_case_version: str(use_case_version)})
70
71
  return headers
71
72
 
73
+ def _resolve_payi_base_url(payi_base_url: Union[str, None]) -> str:
74
+ if payi_base_url:
75
+ return payi_base_url
76
+
77
+ payi_base_url = os.environ.get("PAYI_BASE_URL", None)
78
+
79
+ if payi_base_url:
80
+ return payi_base_url
81
+
82
+ return PAYI_BASE_URL
83
+
72
84
  def payi_anthropic_url(payi_base_url: Union[str, None] = None) -> str:
73
- if payi_base_url is None:
74
- payi_base_url = PAYI_BASE_URL
75
- return payi_base_url + "/api/v1/proxy/anthropic"
85
+ return _resolve_payi_base_url(payi_base_url=payi_base_url) + "/api/v1/proxy/anthropic"
76
86
 
77
87
  def payi_openai_url(payi_base_url: Union[str, None] = None) -> str:
78
- if payi_base_url is None:
79
- payi_base_url = PAYI_BASE_URL
80
- return payi_base_url + "/api/v1/proxy/openai/v1"
88
+ return _resolve_payi_base_url(payi_base_url=payi_base_url) + "/api/v1/proxy/openai/v1"
81
89
 
82
90
  def payi_azure_openai_url(payi_base_url: Union[str, None] = None) -> str:
83
- if payi_base_url is None:
84
- payi_base_url = PAYI_BASE_URL
85
- return payi_base_url + "/api/v1/proxy/azure.openai"
91
+ return _resolve_payi_base_url(payi_base_url=payi_base_url) + "/api/v1/proxy/azure.openai"
86
92
 
87
93
  def payi_aws_bedrock_url(payi_base_url: Union[str, None] = None) -> str:
88
- if payi_base_url is None:
89
- payi_base_url = PAYI_BASE_URL
90
- return payi_base_url + "/api/v1/proxy/aws.bedrock"
94
+ return _resolve_payi_base_url(payi_base_url=payi_base_url) + "/api/v1/proxy/aws.bedrock"
@@ -21,7 +21,18 @@ from .helpers import PayiCategories
21
21
  from .Stopwatch import Stopwatch
22
22
 
23
23
 
24
- class Context(TypedDict, total=False):
24
+ class PayiInstrumentConfig(TypedDict, total=False):
25
+ proxy: bool
26
+ limit_ids: Optional["list[str]"]
27
+ request_tags: Optional["list[str]"]
28
+ experience_name: Optional[str]
29
+ experience_id: Optional[str]
30
+ use_case_name: Optional[str]
31
+ use_case_id: Optional[str]
32
+ use_case_version: Optional[int]
33
+ user_id: Optional[str]
34
+
35
+ class _Context(TypedDict, total=False):
25
36
  proxy: bool
26
37
  experience_name: Optional[str]
27
38
  experience_id: Optional[str]
@@ -32,7 +43,7 @@ class Context(TypedDict, total=False):
32
43
  request_tags: Optional['list[str]']
33
44
  user_id: Optional[str]
34
45
 
35
- class ParentState(TypedDict, total=False):
46
+ class _ParentState(TypedDict, total=False):
36
47
  experience_name: Optional[str]
37
48
  experience_id: Optional[str]
38
49
  use_case_name: Optional[str]
@@ -41,12 +52,12 @@ class ParentState(TypedDict, total=False):
41
52
  limit_ids: Optional['list[str]']
42
53
  request_tags: Optional['list[str]']
43
54
 
44
- class IsStreaming(Enum):
55
+ class _IsStreaming(Enum):
45
56
  false = 0
46
57
  true = 1
47
58
  kwargs = 2
48
59
 
49
- class PayiInstrumentor:
60
+ class _PayiInstrumentor:
50
61
  estimated_prompt_tokens: str = "estimated_prompt_tokens"
51
62
 
52
63
  def __init__(
@@ -61,7 +72,12 @@ class PayiInstrumentor:
61
72
  ):
62
73
  self._payi: Optional[Payi] = payi
63
74
  self._apayi: Optional[AsyncPayi] = apayi
64
- self._context_stack: list[Context] = [] # Stack of context dictionaries
75
+
76
+ if not self._payi and not self._apayi:
77
+ self._payi = Payi()
78
+ self._apayi = AsyncPayi()
79
+
80
+ self._context_stack: list[_Context] = [] # Stack of context dictionaries
65
81
  self._log_prompt_and_response: bool = log_prompt_and_response
66
82
  self._prompt_and_response_logger: Optional[Callable[[str, dict[str, str]], None]] = prompt_and_response_logger
67
83
 
@@ -233,9 +249,9 @@ class PayiInstrumentor:
233
249
 
234
250
  def _setup_call_func(
235
251
  self
236
- ) -> 'tuple[Context, ParentState]':
237
- context: Context = {}
238
- parentState: ParentState = {}
252
+ ) -> 'tuple[_Context, _ParentState]':
253
+ context: _Context = {}
254
+ parentState: _ParentState = {}
239
255
 
240
256
  if len(self._context_stack) > 0:
241
257
  # copy current context into the upcoming context
@@ -253,8 +269,8 @@ class PayiInstrumentor:
253
269
 
254
270
  def _init_context(
255
271
  self,
256
- context: Context,
257
- parentState: ParentState,
272
+ context: _Context,
273
+ parentState: _ParentState,
258
274
  proxy: bool,
259
275
  limit_ids: Optional["list[str]"],
260
276
  request_tags: Optional["list[str]"],
@@ -395,12 +411,12 @@ class PayiInstrumentor:
395
411
  if self._context_stack:
396
412
  self._context_stack.pop()
397
413
 
398
- def set_context(self, context: Context) -> None:
414
+ def set_context(self, context: _Context) -> None:
399
415
  # Update the current top of the stack with the provided context
400
416
  if self._context_stack:
401
417
  self._context_stack[-1].update(context)
402
418
 
403
- def get_context(self) -> Optional[Context]:
419
+ def get_context(self) -> Optional[_Context]:
404
420
  # Return the current top of the stack
405
421
  return self._context_stack[-1] if self._context_stack else None
406
422
 
@@ -461,7 +477,7 @@ class PayiInstrumentor:
461
477
  process_chunk: Optional[Callable[[Any, IngestUnitsParams], None]],
462
478
  process_request: Optional[Callable[[IngestUnitsParams, Any, Any], None]],
463
479
  process_synchronous_response: Any,
464
- is_streaming: IsStreaming,
480
+ is_streaming: _IsStreaming,
465
481
  wrapped: Any,
466
482
  instance: Any,
467
483
  args: Any,
@@ -523,9 +539,9 @@ class PayiInstrumentor:
523
539
  sw = Stopwatch()
524
540
  stream: bool = False
525
541
 
526
- if is_streaming == IsStreaming.kwargs:
542
+ if is_streaming == _IsStreaming.kwargs:
527
543
  stream = kwargs.get("stream", False)
528
- elif is_streaming == IsStreaming.true:
544
+ elif is_streaming == _IsStreaming.true:
529
545
  stream = True
530
546
  else:
531
547
  stream = False
@@ -581,7 +597,7 @@ class PayiInstrumentor:
581
597
  process_chunk: Optional[Callable[[Any, IngestUnitsParams], None]],
582
598
  process_request: Optional[Callable[[IngestUnitsParams, Any, Any], None]],
583
599
  process_synchronous_response: Any,
584
- is_streaming: IsStreaming,
600
+ is_streaming: _IsStreaming,
585
601
  wrapped: Any,
586
602
  instance: Any,
587
603
  args: Any,
@@ -652,9 +668,9 @@ class PayiInstrumentor:
652
668
  sw = Stopwatch()
653
669
  stream: bool = False
654
670
 
655
- if is_streaming == IsStreaming.kwargs:
671
+ if is_streaming == _IsStreaming.kwargs:
656
672
  stream = kwargs.get("stream", False)
657
- elif is_streaming == IsStreaming.true:
673
+ elif is_streaming == _IsStreaming.true:
658
674
  stream = True
659
675
  else:
660
676
  stream = False
@@ -713,7 +729,7 @@ class PayiInstrumentor:
713
729
 
714
730
  @staticmethod
715
731
  def _update_headers(
716
- context: Context,
732
+ context: _Context,
717
733
  extra_headers: "dict[str, str]",
718
734
  ) -> None:
719
735
  limit_ids: Optional[list[str]] = context.get("limit_ids")
@@ -797,8 +813,8 @@ class PayiInstrumentor:
797
813
 
798
814
  @staticmethod
799
815
  def update_for_vision(input: int, units: 'dict[str, Units]') -> int:
800
- if PayiInstrumentor.estimated_prompt_tokens in units:
801
- prompt_token_estimate: int = units.pop(PayiInstrumentor.estimated_prompt_tokens)["input"] # type: ignore
816
+ if _PayiInstrumentor.estimated_prompt_tokens in units:
817
+ prompt_token_estimate: int = units.pop(_PayiInstrumentor.estimated_prompt_tokens)["input"] # type: ignore
802
818
  vision = input - prompt_token_estimate
803
819
  if (vision > 0):
804
820
  units["vision"] = Units(input=vision, output=0)
@@ -843,7 +859,7 @@ class ChatStreamWrapper(ObjectProxy): # type: ignore
843
859
  self,
844
860
  response: Any,
845
861
  instance: Any,
846
- instrumentor: PayiInstrumentor,
862
+ instrumentor: _PayiInstrumentor,
847
863
  ingest: IngestUnitsParams,
848
864
  stopwatch: Stopwatch,
849
865
  process_chunk: Optional[Callable[[Any, IngestUnitsParams], None]] = None,
@@ -977,13 +993,14 @@ class ChatStreamWrapper(ObjectProxy): # type: ignore
977
993
  return json.dumps(chunk)
978
994
 
979
995
  global _instrumentor
980
- _instrumentor: Optional[PayiInstrumentor] = None
996
+ _instrumentor: Optional[_PayiInstrumentor] = None
981
997
 
982
998
  def payi_instrument(
983
999
  payi: Optional[Union[Payi, AsyncPayi, 'list[Union[Payi, AsyncPayi]]']] = None,
984
1000
  instruments: Optional[Set[str]] = None,
985
1001
  log_prompt_and_response: bool = True,
986
1002
  prompt_and_response_logger: Optional[Callable[[str, "dict[str, str]"], None]] = None,
1003
+ config: Optional[PayiInstrumentConfig] = None,
987
1004
  ) -> None:
988
1005
  global _instrumentor
989
1006
  if _instrumentor:
@@ -1002,10 +1019,21 @@ def payi_instrument(
1002
1019
  payi_param = p
1003
1020
  elif isinstance(p, AsyncPayi): # type: ignore
1004
1021
  apayi_param = p
1022
+
1023
+ global_context: _Context = {}
1005
1024
 
1006
- # allow for both payi and apayi to be None for the @proxy case
1025
+ if config and len(config) > 0:
1026
+ if "proxy" not in config:
1027
+ config["proxy"] = False
1028
+ global_context = {**config}
1029
+
1030
+ # create the clients on their behalf if not provided for global ingest instrumentation
1031
+ if not payi_param and not apayi_param and len(global_context) > 0 and global_context.get("proxy", False):
1032
+ payi_param = Payi()
1033
+ apayi_param = AsyncPayi()
1007
1034
 
1008
- _instrumentor = PayiInstrumentor(
1035
+ # allow for both payi and apayi to be None for the @proxy case
1036
+ _instrumentor = _PayiInstrumentor(
1009
1037
  payi=payi_param,
1010
1038
  apayi=apayi_param,
1011
1039
  instruments=instruments,
@@ -1013,6 +1041,9 @@ def payi_instrument(
1013
1041
  prompt_and_response_logger=prompt_and_response_logger,
1014
1042
  )
1015
1043
 
1044
+ if len(global_context) > 0:
1045
+ _instrumentor._context_stack.append(global_context)
1046
+
1016
1047
  def ingest(
1017
1048
  limit_ids: Optional["list[str]"] = None,
1018
1049
  request_tags: Optional["list[str]"] = None,
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.1.0-alpha.60"
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