metricai 0.2.0__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.
Files changed (92) hide show
  1. metricai-0.2.0/.github/workflows/publish-metricai-pypi.yml +51 -0
  2. metricai-0.2.0/.gitignore +8 -0
  3. metricai-0.2.0/LICENSE +21 -0
  4. metricai-0.2.0/METRICAI_SDK.md +899 -0
  5. metricai-0.2.0/PKG-INFO +0 -0
  6. metricai-0.2.0/README.md +0 -0
  7. metricai-0.2.0/examples/_provider_env.py +130 -0
  8. metricai-0.2.0/examples/byok_openai_sdk.py +73 -0
  9. metricai-0.2.0/examples/crewai_crew.py +59 -0
  10. metricai-0.2.0/examples/langchain_callback.py +76 -0
  11. metricai-0.2.0/examples/langchain_metricai_sample.py +108 -0
  12. metricai-0.2.0/examples/langgraph_tracer.py +129 -0
  13. metricai-0.2.0/examples/metricaiclient_example.py +253 -0
  14. metricai-0.2.0/examples/provider_sdk_check.py +107 -0
  15. metricai-0.2.0/examples/standalone_workflow.py +24 -0
  16. metricai-0.2.0/metricai/__init__.py +66 -0
  17. metricai-0.2.0/metricai/billing_event.py +100 -0
  18. metricai-0.2.0/metricai/client.py +1094 -0
  19. metricai-0.2.0/metricai/config.py +89 -0
  20. metricai-0.2.0/metricai/context.py +82 -0
  21. metricai-0.2.0/metricai/context_estimate.py +37 -0
  22. metricai-0.2.0/metricai/conversation_budget.py +69 -0
  23. metricai-0.2.0/metricai/data/bedrock_pricing.json +23 -0
  24. metricai-0.2.0/metricai/data/tavily_pricing.json +8 -0
  25. metricai-0.2.0/metricai/data/tavily_pricing_meta.json +8 -0
  26. metricai-0.2.0/metricai/exceptions.py +68 -0
  27. metricai-0.2.0/metricai/headers.py +70 -0
  28. metricai-0.2.0/metricai/integrations/__init__.py +59 -0
  29. metricai-0.2.0/metricai/integrations/_token_utils.py +42 -0
  30. metricai-0.2.0/metricai/integrations/autogen.py +41 -0
  31. metricai-0.2.0/metricai/integrations/crewai.py +118 -0
  32. metricai-0.2.0/metricai/integrations/langchain.py +218 -0
  33. metricai-0.2.0/metricai/integrations/langchain_chat.py +148 -0
  34. metricai-0.2.0/metricai/integrations/langgraph.py +165 -0
  35. metricai-0.2.0/metricai/integrations/llamaindex.py +108 -0
  36. metricai-0.2.0/metricai/langchain.py +311 -0
  37. metricai-0.2.0/metricai/langgraph.py +91 -0
  38. metricai-0.2.0/metricai/mcp_track.py +48 -0
  39. metricai-0.2.0/metricai/message_context.py +58 -0
  40. metricai-0.2.0/metricai/metricai_session.py +277 -0
  41. metricai-0.2.0/metricai/payload.py +228 -0
  42. metricai-0.2.0/metricai/providers/__init__.py +14 -0
  43. metricai-0.2.0/metricai/providers/base.py +25 -0
  44. metricai-0.2.0/metricai/providers/bedrock.py +422 -0
  45. metricai-0.2.0/metricai/providers/claude_route.py +27 -0
  46. metricai-0.2.0/metricai/providers/gemini_route.py +27 -0
  47. metricai-0.2.0/metricai/providers/grok_route.py +27 -0
  48. metricai-0.2.0/metricai/providers/openai_route.py +27 -0
  49. metricai-0.2.0/metricai/providers/registry.py +46 -0
  50. metricai-0.2.0/metricai/providers/tavily_provider.py +156 -0
  51. metricai-0.2.0/metricai/proxy.py +251 -0
  52. metricai-0.2.0/metricai/proxy_client_session.py +92 -0
  53. metricai-0.2.0/metricai/py.typed +0 -0
  54. metricai-0.2.0/metricai/routing_sdk.py +99 -0
  55. metricai-0.2.0/metricai/runtime.py +57 -0
  56. metricai-0.2.0/metricai/session.py +39 -0
  57. metricai-0.2.0/metricai/stream_track.py +206 -0
  58. metricai-0.2.0/metricai/streaming.py +126 -0
  59. metricai-0.2.0/metricai/telemetry_http.py +252 -0
  60. metricai-0.2.0/metricai/timing.py +29 -0
  61. metricai-0.2.0/metricai/tool_output_policy.py +65 -0
  62. metricai-0.2.0/metricai/types.py +229 -0
  63. metricai-0.2.0/metricai/usage_normalizer.py +140 -0
  64. metricai-0.2.0/metricai/workflow/__init__.py +21 -0
  65. metricai-0.2.0/metricai/workflow/agent.py +394 -0
  66. metricai-0.2.0/metricai/workflow/pipeline.py +63 -0
  67. metricai-0.2.0/pyproject.toml +64 -0
  68. metricai-0.2.0/scripts/local_sdk_smoke.py +108 -0
  69. metricai-0.2.0/scripts/publish_to_pypi.ps1 +17 -0
  70. metricai-0.2.0/sdk_tests/__init__.py +1 -0
  71. metricai-0.2.0/sdk_tests/_common.py +64 -0
  72. metricai-0.2.0/sdk_tests/run_anthropic_proxy.py +42 -0
  73. metricai-0.2.0/sdk_tests/run_gemini_grok_proxy.py +58 -0
  74. metricai-0.2.0/sdk_tests/run_metricai_session.py +46 -0
  75. metricai-0.2.0/sdk_tests/run_named_session.py +39 -0
  76. metricai-0.2.0/sdk_tests/run_openai_proxy.py +37 -0
  77. metricai-0.2.0/sdk_tests/run_runtime_init.py +49 -0
  78. metricai-0.2.0/sdk_tests/run_track_telemetry.py +75 -0
  79. metricai-0.2.0/tests/__init__.py +0 -0
  80. metricai-0.2.0/tests/test_bedrock_pricing_and_stream.py +167 -0
  81. metricai-0.2.0/tests/test_billing_event.py +90 -0
  82. metricai-0.2.0/tests/test_client.py +210 -0
  83. metricai-0.2.0/tests/test_config_headers.py +55 -0
  84. metricai-0.2.0/tests/test_crewai_cost_summary.py +14 -0
  85. metricai-0.2.0/tests/test_governance_v1.py +195 -0
  86. metricai-0.2.0/tests/test_langchain_chat.py +15 -0
  87. metricai-0.2.0/tests/test_patterns.py +161 -0
  88. metricai-0.2.0/tests/test_session_concurrency.py +48 -0
  89. metricai-0.2.0/tests/test_tavily_pricing.py +53 -0
  90. metricai-0.2.0/tests/test_telemetry.py +312 -0
  91. metricai-0.2.0/tests/test_telemetry_buffer_and_background.py +68 -0
  92. metricai-0.2.0/tests/test_token_extraction.py +26 -0
@@ -0,0 +1,51 @@
1
+ # Build and upload the `metricai` distribution (repo root) to PyPI.
2
+ #
3
+ # Prerequisites (one-time on https://pypi.org ):
4
+ # 1. Create the `metricai` project (or gain maintainer access) if it does not exist.
5
+ # 2. Add repository secret PYPI_API_TOKEN = a PyPI API token with "Entire account" or
6
+ # "Project: metricai" scope (user menu → Account settings → API tokens).
7
+ #
8
+ # Before each release:
9
+ # - Bump `version` in pyproject.toml (PEP 440, e.g. 0.2.1).
10
+ # - Commit and push, then either:
11
+ # A) Run this workflow manually (Actions → "Publish metricai to PyPI" → Run workflow), or
12
+ # B) Push an annotated tag matching the release convention, e.g. metricai-v0.2.1
13
+ #
14
+ # Install for users: pip install metricai
15
+ # Extras: pip install "metricai[openai,langchain]"
16
+
17
+ name: Publish metricai to PyPI
18
+
19
+ on:
20
+ workflow_dispatch:
21
+ push:
22
+ tags:
23
+ - "metricai-v*"
24
+
25
+ jobs:
26
+ publish:
27
+ runs-on: ubuntu-latest
28
+ permissions:
29
+ contents: read
30
+
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - uses: actions/setup-python@v5
35
+ with:
36
+ python-version: "3.11"
37
+
38
+ - name: Install build tools
39
+ run: pip install --upgrade pip build twine
40
+
41
+ - name: Build sdist and wheel
42
+ run: python -m build
43
+
44
+ - name: Check artifacts
45
+ run: python -m twine check dist/*
46
+
47
+ - name: Upload to PyPI
48
+ env:
49
+ TWINE_USERNAME: __token__
50
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
51
+ run: python -m twine upload --non-interactive dist/*
@@ -0,0 +1,8 @@
1
+ /dist/
2
+ /build/
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ __pycache__/
6
+ *.pyc
7
+ .venv/
8
+ venv/
metricai-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) MetricAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.