payi 0.1.0a47__tar.gz → 0.1.0a49__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 (169) hide show
  1. payi-0.1.0a49/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a47 → payi-0.1.0a49}/CHANGELOG.md +17 -0
  3. {payi-0.1.0a47 → payi-0.1.0a49}/PKG-INFO +1 -1
  4. {payi-0.1.0a47 → payi-0.1.0a49}/pyproject.toml +1 -1
  5. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_models.py +7 -1
  6. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_transform.py +11 -1
  7. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_version.py +1 -1
  8. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/AnthropicInstrumentor.py +5 -1
  9. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/BedrockInstrumentor.py +6 -6
  10. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/OpenAIInstrumentor.py +9 -0
  11. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/helpers.py +28 -0
  12. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/instrument.py +10 -8
  13. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/ingest.py +4 -0
  14. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/ingest_event_param.py +2 -0
  15. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/ingest_units_params.py +2 -0
  16. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/test_ingest.py +2 -0
  17. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_transform.py +10 -1
  18. payi-0.1.0a47/.release-please-manifest.json +0 -3
  19. payi-0.1.0a47/src/payi/lib/Instruments.py +0 -8
  20. {payi-0.1.0a47 → payi-0.1.0a49}/.gitignore +0 -0
  21. {payi-0.1.0a47 → payi-0.1.0a49}/CONTRIBUTING.md +0 -0
  22. {payi-0.1.0a47 → payi-0.1.0a49}/LICENSE +0 -0
  23. {payi-0.1.0a47 → payi-0.1.0a49}/README.md +0 -0
  24. {payi-0.1.0a47 → payi-0.1.0a49}/SECURITY.md +0 -0
  25. {payi-0.1.0a47 → payi-0.1.0a49}/api.md +0 -0
  26. {payi-0.1.0a47 → payi-0.1.0a49}/bin/check-release-environment +0 -0
  27. {payi-0.1.0a47 → payi-0.1.0a49}/bin/publish-pypi +0 -0
  28. {payi-0.1.0a47 → payi-0.1.0a49}/examples/.keep +0 -0
  29. {payi-0.1.0a47 → payi-0.1.0a49}/mypy.ini +0 -0
  30. {payi-0.1.0a47 → payi-0.1.0a49}/noxfile.py +0 -0
  31. {payi-0.1.0a47 → payi-0.1.0a49}/release-please-config.json +0 -0
  32. {payi-0.1.0a47 → payi-0.1.0a49}/requirements-dev.lock +0 -0
  33. {payi-0.1.0a47 → payi-0.1.0a49}/requirements.lock +0 -0
  34. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/__init__.py +0 -0
  35. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_base_client.py +0 -0
  36. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_client.py +0 -0
  37. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_compat.py +0 -0
  38. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_constants.py +0 -0
  39. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_exceptions.py +0 -0
  40. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_files.py +0 -0
  41. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_qs.py +0 -0
  42. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_resource.py +0 -0
  43. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_response.py +0 -0
  44. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_streaming.py +0 -0
  45. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_types.py +0 -0
  46. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/__init__.py +0 -0
  47. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_logs.py +0 -0
  48. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_proxy.py +0 -0
  49. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_reflection.py +0 -0
  50. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_streams.py +0 -0
  51. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_sync.py +0 -0
  52. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_typing.py +0 -0
  53. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/_utils/_utils.py +0 -0
  54. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/.keep +0 -0
  55. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/lib/Stopwatch.py +0 -0
  56. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/py.typed +0 -0
  57. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/__init__.py +0 -0
  58. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/billing_models.py +0 -0
  59. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/categories/__init__.py +0 -0
  60. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/categories/categories.py +0 -0
  61. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/categories/resources.py +0 -0
  62. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/experiences/__init__.py +0 -0
  63. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/experiences/experiences.py +0 -0
  64. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/experiences/properties.py +0 -0
  65. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/experiences/types/__init__.py +0 -0
  66. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/experiences/types/limit_config.py +0 -0
  67. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/experiences/types/types.py +0 -0
  68. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/limits/__init__.py +0 -0
  69. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/limits/limits.py +0 -0
  70. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/limits/tags.py +0 -0
  71. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/price_modifiers.py +0 -0
  72. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/requests/__init__.py +0 -0
  73. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/requests/properties.py +0 -0
  74. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/requests/requests.py +0 -0
  75. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/resources/requests/result.py +0 -0
  76. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/__init__.py +0 -0
  77. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/billing_model.py +0 -0
  78. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/billing_model_create_params.py +0 -0
  79. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/billing_model_list_response.py +0 -0
  80. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/billing_model_update_params.py +0 -0
  81. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/bulk_ingest_response.py +0 -0
  82. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/categories/__init__.py +0 -0
  83. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/categories/resource_create_params.py +0 -0
  84. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/categories/resource_list_response.py +0 -0
  85. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/category_delete_resource_response.py +0 -0
  86. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/category_delete_response.py +0 -0
  87. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/category_list_resources_response.py +0 -0
  88. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/category_list_response.py +0 -0
  89. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/category_resource_response.py +0 -0
  90. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/category_response.py +0 -0
  91. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/cost_data.py +0 -0
  92. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/cost_details.py +0 -0
  93. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/default_response.py +0 -0
  94. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experience_instance_response.py +0 -0
  95. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/__init__.py +0 -0
  96. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/experience_type.py +0 -0
  97. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/properties_response.py +0 -0
  98. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/property_create_params.py +0 -0
  99. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/type_create_params.py +0 -0
  100. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/type_list_params.py +0 -0
  101. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/type_list_response.py +0 -0
  102. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/type_update_params.py +0 -0
  103. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/types/__init__.py +0 -0
  104. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/experiences/types/limit_config_create_params.py +0 -0
  105. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/ingest_bulk_params.py +0 -0
  106. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/ingest_response.py +0 -0
  107. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limit_create_params.py +0 -0
  108. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limit_history_response.py +0 -0
  109. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limit_list_params.py +0 -0
  110. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limit_reset_params.py +0 -0
  111. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limit_response.py +0 -0
  112. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limit_update_params.py +0 -0
  113. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/__init__.py +0 -0
  114. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/limit_tags.py +0 -0
  115. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_create_params.py +0 -0
  116. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_create_response.py +0 -0
  117. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_delete_response.py +0 -0
  118. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_list_response.py +0 -0
  119. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_remove_params.py +0 -0
  120. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_remove_response.py +0 -0
  121. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_update_params.py +0 -0
  122. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/limits/tag_update_response.py +0 -0
  123. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/paged_limit_list.py +0 -0
  124. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/pay_i_common_models_api_router_header_info_param.py +0 -0
  125. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/price_modifier.py +0 -0
  126. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/price_modifier_create_params.py +0 -0
  127. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/price_modifier_retrieve_response.py +0 -0
  128. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/price_modifier_update_params.py +0 -0
  129. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/requests/__init__.py +0 -0
  130. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/requests/property_create_params.py +0 -0
  131. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/requests/request_result.py +0 -0
  132. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/requests_data.py +0 -0
  133. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/shared/__init__.py +0 -0
  134. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/shared/evaluation_response.py +0 -0
  135. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/shared/pay_i_common_models_budget_management_cost_details_base.py +0 -0
  136. {payi-0.1.0a47 → payi-0.1.0a49}/src/payi/types/total_cost_data.py +0 -0
  137. {payi-0.1.0a47 → payi-0.1.0a49}/tests/__init__.py +0 -0
  138. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/__init__.py +0 -0
  139. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/categories/__init__.py +0 -0
  140. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/categories/test_resources.py +0 -0
  141. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/experiences/__init__.py +0 -0
  142. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/experiences/test_properties.py +0 -0
  143. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/experiences/test_types.py +0 -0
  144. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/experiences/types/__init__.py +0 -0
  145. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/experiences/types/test_limit_config.py +0 -0
  146. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/limits/__init__.py +0 -0
  147. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/limits/test_tags.py +0 -0
  148. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/requests/__init__.py +0 -0
  149. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/requests/test_properties.py +0 -0
  150. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/requests/test_result.py +0 -0
  151. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/test_billing_models.py +0 -0
  152. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/test_categories.py +0 -0
  153. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/test_experiences.py +0 -0
  154. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/test_limits.py +0 -0
  155. {payi-0.1.0a47 → payi-0.1.0a49}/tests/api_resources/test_price_modifiers.py +0 -0
  156. {payi-0.1.0a47 → payi-0.1.0a49}/tests/conftest.py +0 -0
  157. {payi-0.1.0a47 → payi-0.1.0a49}/tests/sample_file.txt +0 -0
  158. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_client.py +0 -0
  159. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_deepcopy.py +0 -0
  160. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_extract_files.py +0 -0
  161. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_files.py +0 -0
  162. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_models.py +0 -0
  163. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_qs.py +0 -0
  164. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_required_args.py +0 -0
  165. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_response.py +0 -0
  166. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_streaming.py +0 -0
  167. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_utils/test_proxy.py +0 -0
  168. {payi-0.1.0a47 → payi-0.1.0a49}/tests/test_utils/test_typing.py +0 -0
  169. {payi-0.1.0a47 → payi-0.1.0a49}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.49"
3
+ }
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.49 (2025-02-10)
4
+
5
+ Full Changelog: [v0.1.0-alpha.48...v0.1.0-alpha.49](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.48...v0.1.0-alpha.49)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([#227](https://github.com/Pay-i/pay-i-python/issues/227)) ([e32a7a1](https://github.com/Pay-i/pay-i-python/commit/e32a7a161132b2a0c85244db62a6bf3a37b37444))
10
+
11
+ ## 0.1.0-alpha.48 (2025-02-08)
12
+
13
+ Full Changelog: [v0.1.0-alpha.47...v0.1.0-alpha.48](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.47...v0.1.0-alpha.48)
14
+
15
+ ### Chores
16
+
17
+ * **internal:** fix type traversing dictionary params ([#223](https://github.com/Pay-i/pay-i-python/issues/223)) ([a68875f](https://github.com/Pay-i/pay-i-python/commit/a68875ff18bff2222b50567d2aeab5e3da1f2491))
18
+ * **internal:** minor type handling changes ([#225](https://github.com/Pay-i/pay-i-python/issues/225)) ([d0085cf](https://github.com/Pay-i/pay-i-python/commit/d0085cf20ded356b6e00c4969bef62cd4fb68bc8))
19
+
3
20
  ## 0.1.0-alpha.47 (2025-02-08)
4
21
 
5
22
  Full Changelog: [v0.1.0-alpha.46...v0.1.0-alpha.47](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.46...v0.1.0-alpha.47)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payi
3
- Version: 0.1.0a47
3
+ Version: 0.1.0a49
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.47"
3
+ version = "0.1.0-alpha.49"
4
4
  description = "The official Python library for the payi API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -426,10 +426,16 @@ def construct_type(*, value: object, type_: object) -> object:
426
426
 
427
427
  If the given value does not match the expected type then it is returned as-is.
428
428
  """
429
+
430
+ # store a reference to the original type we were given before we extract any inner
431
+ # types so that we can properly resolve forward references in `TypeAliasType` annotations
432
+ original_type = None
433
+
429
434
  # we allow `object` as the input type because otherwise, passing things like
430
435
  # `Literal['value']` will be reported as a type error by type checkers
431
436
  type_ = cast("type[object]", type_)
432
437
  if is_type_alias_type(type_):
438
+ original_type = type_ # type: ignore[unreachable]
433
439
  type_ = type_.__value__ # type: ignore[unreachable]
434
440
 
435
441
  # unwrap `Annotated[T, ...]` -> `T`
@@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object:
446
452
 
447
453
  if is_union(origin):
448
454
  try:
449
- return validate_type(type_=cast("type[object]", type_), value=value)
455
+ return validate_type(type_=cast("type[object]", original_type or type_), value=value)
450
456
  except Exception:
451
457
  pass
452
458
 
@@ -25,7 +25,7 @@ from ._typing import (
25
25
  is_annotated_type,
26
26
  strip_annotated_type,
27
27
  )
28
- from .._compat import model_dump, is_typeddict
28
+ from .._compat import get_origin, model_dump, is_typeddict
29
29
 
30
30
  _T = TypeVar("_T")
31
31
 
@@ -164,9 +164,14 @@ def _transform_recursive(
164
164
  inner_type = annotation
165
165
 
166
166
  stripped_type = strip_annotated_type(inner_type)
167
+ origin = get_origin(stripped_type) or stripped_type
167
168
  if is_typeddict(stripped_type) and is_mapping(data):
168
169
  return _transform_typeddict(data, stripped_type)
169
170
 
171
+ if origin == dict and is_mapping(data):
172
+ items_type = get_args(stripped_type)[1]
173
+ return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()}
174
+
170
175
  if (
171
176
  # List[T]
172
177
  (is_list_type(stripped_type) and is_list(data))
@@ -307,9 +312,14 @@ async def _async_transform_recursive(
307
312
  inner_type = annotation
308
313
 
309
314
  stripped_type = strip_annotated_type(inner_type)
315
+ origin = get_origin(stripped_type) or stripped_type
310
316
  if is_typeddict(stripped_type) and is_mapping(data):
311
317
  return await _async_transform_typeddict(data, stripped_type)
312
318
 
319
+ if origin == dict and is_mapping(data):
320
+ items_type = get_args(stripped_type)[1]
321
+ return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()}
322
+
313
323
  if (
314
324
  # List[T]
315
325
  (is_list_type(stripped_type) and is_list(data))
@@ -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.47" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.49" # x-release-please-version
@@ -88,6 +88,8 @@ async def achat_wrapper(
88
88
 
89
89
  def process_chunk(chunk: Any, ingest: IngestUnitsParams) -> None:
90
90
  if chunk.type == "message_start":
91
+ ingest["provider_response_id"] = chunk.message.id
92
+
91
93
  usage = chunk.message.usage
92
94
  units = ingest["units"]
93
95
 
@@ -128,7 +130,9 @@ def process_synchronous_response(response: Any, ingest: IngestUnitsParams, log_p
128
130
 
129
131
  if log_prompt_and_response:
130
132
  ingest["provider_response_json"] = response.to_json()
131
-
133
+
134
+ ingest["provider_response_id"] = response.id
135
+
132
136
  return None
133
137
 
134
138
  def has_image_and_get_texts(encoding: tiktoken.Encoding, content: Union[str, 'list[Any]']) -> 'tuple[bool, int]':
@@ -220,9 +220,9 @@ def process_synchronous_invoke_response(
220
220
 
221
221
  metadata = response.get("ResponseMetadata", {})
222
222
 
223
- # request_id = metadata.get("RequestId", "")
224
- # if request_id:
225
- # ingest["provider_request_id"] = request_id
223
+ request_id = metadata.get("RequestId", "")
224
+ if request_id:
225
+ ingest["provider_response_id"] = request_id
226
226
 
227
227
  response_headers = metadata.get("HTTPHeaders", {}).copy()
228
228
  if response_headers:
@@ -263,9 +263,9 @@ def process_synchronous_converse_response(
263
263
 
264
264
  metadata = response.get("ResponseMetadata", {})
265
265
 
266
- # request_id = metadata.get("RequestId", "")
267
- # if request_id:
268
- # ingest["provider_request_id"] = request_id
266
+ request_id = metadata.get("RequestId", "")
267
+ if request_id:
268
+ ingest["provider_response_id"] = request_id
269
269
 
270
270
  response_headers = metadata.get("HTTPHeaders", {})
271
271
  if response_headers:
@@ -144,10 +144,19 @@ def process_chat_synchronous_response(response: str, ingest: IngestUnitsParams,
144
144
  if log_prompt_and_response:
145
145
  ingest["provider_response_json"] = [json.dumps(response_dict)]
146
146
 
147
+ if "id" in response_dict:
148
+ ingest["provider_response_id"] = response_dict["id"]
149
+
147
150
  return None
148
151
 
149
152
  def process_chat_chunk(chunk: Any, ingest: IngestUnitsParams) -> None:
150
153
  model = model_to_dict(chunk)
154
+
155
+ if "provider_response_id" not in ingest:
156
+ response_id = model.get("id", None)
157
+ if response_id:
158
+ ingest["provider_response_id"] = response_id
159
+
151
160
  usage = model.get("usage")
152
161
  if usage:
153
162
  add_usage_units(usage, ingest["units"])
@@ -1,5 +1,7 @@
1
+ from enum import Enum
1
2
  from typing import Dict, List, Union
2
3
 
4
+ PAYI_BASE_URL = "https://api.pay-i.com"
3
5
 
4
6
  class PayiHeaderNames:
5
7
  limit_ids:str = "xProxy-Limit-IDs"
@@ -10,6 +12,12 @@ class PayiHeaderNames:
10
12
  route_as_resource:str = "xProxy-RouteAs-Resource"
11
13
  provider_base_uri = "xProxy-Provider-BaseUri"
12
14
 
15
+ class PayiCategories(Enum):
16
+ anthropic = "system.anthropic"
17
+ openai = "system.openai"
18
+ azure_openai = "system.azureopenai"
19
+ aws_bedrock = "system.aws.bedrock"
20
+
13
21
  def create_limit_header_from_ids(limit_ids: List[str]) -> Dict[str, str]:
14
22
  if not isinstance(limit_ids, list): # type: ignore
15
23
  raise TypeError("limit_ids must be a list")
@@ -49,3 +57,23 @@ def create_headers(
49
57
  headers.update({ PayiHeaderNames.experience_name: experience_name})
50
58
 
51
59
  return headers
60
+
61
+ def payi_anthropic_url(payi_base_url: Union[str, None] = None) -> str:
62
+ if payi_base_url is None:
63
+ payi_base_url = PAYI_BASE_URL
64
+ return payi_base_url + "/api/v1/proxy/anthropic"
65
+
66
+ def payi_openai_url(payi_base_url: Union[str, None] = None) -> str:
67
+ if payi_base_url is None:
68
+ payi_base_url = PAYI_BASE_URL
69
+ return payi_base_url + "/api/v1/proxy/openai/v1"
70
+
71
+ def payi_azure_openai_url(payi_base_url: Union[str, None] = None) -> str:
72
+ if payi_base_url is None:
73
+ payi_base_url = PAYI_BASE_URL
74
+ return payi_base_url + "/api/v1/proxy/azure.openai"
75
+
76
+ def payi_aws_bedrock_url(payi_base_url: Union[str, None] = None) -> str:
77
+ if payi_base_url is None:
78
+ payi_base_url = PAYI_BASE_URL
79
+ return payi_base_url + "/api/v1/proxy/aws.bedrock"
@@ -17,8 +17,8 @@ from payi.types.ingest_response import IngestResponse
17
17
  from payi.types.ingest_units_params import Units
18
18
  from payi.types.pay_i_common_models_api_router_header_info_param import PayICommonModelsAPIRouterHeaderInfoParam
19
19
 
20
+ from .helpers import PayiCategories
20
21
  from .Stopwatch import Stopwatch
21
- from .Instruments import Instruments
22
22
 
23
23
 
24
24
  class Context(TypedDict, total=False):
@@ -41,7 +41,7 @@ class PayiInstrumentor:
41
41
  self,
42
42
  payi: Optional[Payi],
43
43
  apayi: Optional[AsyncPayi],
44
- instruments: Union[Set[Instruments], None] = None,
44
+ instruments: Union[Set[PayiCategories], 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 or Instruments.ALL in instruments:
59
+ if instruments is None:
60
60
  self._instrument_all()
61
61
  else:
62
62
  self._instrument_specific(instruments)
@@ -66,12 +66,12 @@ class PayiInstrumentor:
66
66
  self._instrument_anthropic()
67
67
  self._instrument_aws_bedrock()
68
68
 
69
- def _instrument_specific(self, instruments: Set[Instruments]) -> None:
70
- if Instruments.OPENAI in instruments:
69
+ def _instrument_specific(self, instruments: Set[PayiCategories]) -> None:
70
+ if PayiCategories.openai in instruments or PayiCategories.azure_openai in instruments:
71
71
  self._instrument_openai()
72
- if Instruments.ANTHROPIC in instruments:
72
+ if PayiCategories.anthropic in instruments:
73
73
  self._instrument_anthropic()
74
- if Instruments.AWS_BEDROCK in instruments:
74
+ if PayiCategories.aws_bedrock in instruments:
75
75
  self._instrument_aws_bedrock()
76
76
 
77
77
  def _instrument_openai(self) -> None:
@@ -736,7 +736,9 @@ class ChatStreamWrapper(ObjectProxy): # type: ignore
736
736
 
737
737
  bedrock_from_stream: bool = False
738
738
  if is_bedrock:
739
+ ingest["provider_response_id"] = response["ResponseMetadata"]["RequestId"]
739
740
  stream = response.get("stream", None)
741
+
740
742
  if stream:
741
743
  response = stream
742
744
  bedrock_from_stream = True
@@ -862,7 +864,7 @@ _instrumentor: Optional[PayiInstrumentor] = None
862
864
 
863
865
  def payi_instrument(
864
866
  payi: Optional[Union[Payi, AsyncPayi, 'list[Union[Payi, AsyncPayi]]']] = None,
865
- instruments: Optional[Set[Instruments]] = None,
867
+ instruments: Optional[Set[PayiCategories]] = None,
866
868
  log_prompt_and_response: bool = True,
867
869
  prompt_and_response_logger: Optional[Callable[[str, "dict[str, str]"], None]] = None,
868
870
  ) -> None:
@@ -97,6 +97,7 @@ class IngestResource(SyncAPIResource):
97
97
  provider_request_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | NotGiven = NOT_GIVEN,
98
98
  provider_request_json: Optional[str] | NotGiven = NOT_GIVEN,
99
99
  provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | NotGiven = NOT_GIVEN,
100
+ provider_response_id: Optional[str] | NotGiven = NOT_GIVEN,
100
101
  provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
101
102
  provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
102
103
  time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
@@ -201,6 +202,7 @@ class IngestResource(SyncAPIResource):
201
202
  "provider_request_headers": provider_request_headers,
202
203
  "provider_request_json": provider_request_json,
203
204
  "provider_response_headers": provider_response_headers,
205
+ "provider_response_id": provider_response_id,
204
206
  "provider_response_json": provider_response_json,
205
207
  "provider_uri": provider_uri,
206
208
  "time_to_first_token_ms": time_to_first_token_ms,
@@ -280,6 +282,7 @@ class AsyncIngestResource(AsyncAPIResource):
280
282
  provider_request_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | NotGiven = NOT_GIVEN,
281
283
  provider_request_json: Optional[str] | NotGiven = NOT_GIVEN,
282
284
  provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | NotGiven = NOT_GIVEN,
285
+ provider_response_id: Optional[str] | NotGiven = NOT_GIVEN,
283
286
  provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
284
287
  provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
285
288
  time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
@@ -383,6 +386,7 @@ class AsyncIngestResource(AsyncAPIResource):
383
386
  "provider_request_headers": provider_request_headers,
384
387
  "provider_request_json": provider_request_json,
385
388
  "provider_response_headers": provider_response_headers,
389
+ "provider_response_id": provider_response_id,
386
390
  "provider_response_json": provider_response_json,
387
391
  "provider_uri": provider_uri,
388
392
  "time_to_first_token_ms": time_to_first_token_ms,
@@ -49,6 +49,8 @@ class IngestEventParam(TypedDict, total=False):
49
49
 
50
50
  provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]]
51
51
 
52
+ provider_response_id: Optional[str]
53
+
52
54
  provider_response_json: Union[str, List[str], None]
53
55
 
54
56
  provider_uri: Optional[str]
@@ -35,6 +35,8 @@ class IngestUnitsParams(TypedDict, total=False):
35
35
 
36
36
  provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]]
37
37
 
38
+ provider_response_id: Optional[str]
39
+
38
40
  provider_response_json: Union[str, List[str], None]
39
41
 
40
42
  provider_uri: Optional[str]
@@ -105,6 +105,7 @@ class TestIngest:
105
105
  "value": "value",
106
106
  }
107
107
  ],
108
+ provider_response_id="provider_response_id",
108
109
  provider_response_json="string",
109
110
  provider_uri="provider_uri",
110
111
  time_to_first_token_ms=0,
@@ -235,6 +236,7 @@ class TestAsyncIngest:
235
236
  "value": "value",
236
237
  }
237
238
  ],
239
+ provider_response_id="provider_response_id",
238
240
  provider_response_json="string",
239
241
  provider_uri="provider_uri",
240
242
  time_to_first_token_ms=0,
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import io
4
4
  import pathlib
5
- from typing import Any, List, Union, TypeVar, Iterable, Optional, cast
5
+ from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
6
6
  from datetime import date, datetime
7
7
  from typing_extensions import Required, Annotated, TypedDict
8
8
 
@@ -388,6 +388,15 @@ async def test_iterable_of_dictionaries(use_async: bool) -> None:
388
388
  }
389
389
 
390
390
 
391
+ @parametrize
392
+ @pytest.mark.asyncio
393
+ async def test_dictionary_items(use_async: bool) -> None:
394
+ class DictItems(TypedDict):
395
+ foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")]
396
+
397
+ assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}}
398
+
399
+
391
400
  class TypedDictIterableUnionStr(TypedDict):
392
401
  foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")]
393
402
 
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.1.0-alpha.47"
3
- }
@@ -1,8 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class Instruments(Enum):
5
- ALL = "all"
6
- OPENAI = "openai"
7
- ANTHROPIC = "anthropic"
8
- AWS_BEDROCK = "aws.bedrock"
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