headroom-ai 0.2.2__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 (134) hide show
  1. headroom_ai-0.2.2/.gitignore +168 -0
  2. headroom_ai-0.2.2/CHANGELOG.md +129 -0
  3. headroom_ai-0.2.2/LICENSE +190 -0
  4. headroom_ai-0.2.2/NOTICE +43 -0
  5. headroom_ai-0.2.2/PKG-INFO +252 -0
  6. headroom_ai-0.2.2/README.md +190 -0
  7. headroom_ai-0.2.2/headroom/__init__.py +205 -0
  8. headroom_ai-0.2.2/headroom/cache/__init__.py +76 -0
  9. headroom_ai-0.2.2/headroom/cache/anthropic.py +517 -0
  10. headroom_ai-0.2.2/headroom/cache/base.py +342 -0
  11. headroom_ai-0.2.2/headroom/cache/compression_feedback.py +613 -0
  12. headroom_ai-0.2.2/headroom/cache/compression_store.py +787 -0
  13. headroom_ai-0.2.2/headroom/cache/dynamic_detector.py +1017 -0
  14. headroom_ai-0.2.2/headroom/cache/google.py +884 -0
  15. headroom_ai-0.2.2/headroom/cache/openai.py +584 -0
  16. headroom_ai-0.2.2/headroom/cache/registry.py +175 -0
  17. headroom_ai-0.2.2/headroom/cache/semantic.py +451 -0
  18. headroom_ai-0.2.2/headroom/ccr/__init__.py +77 -0
  19. headroom_ai-0.2.2/headroom/ccr/context_tracker.py +582 -0
  20. headroom_ai-0.2.2/headroom/ccr/mcp_server.py +318 -0
  21. headroom_ai-0.2.2/headroom/ccr/response_handler.py +772 -0
  22. headroom_ai-0.2.2/headroom/ccr/tool_injection.py +415 -0
  23. headroom_ai-0.2.2/headroom/cli.py +189 -0
  24. headroom_ai-0.2.2/headroom/client.py +977 -0
  25. headroom_ai-0.2.2/headroom/config.py +474 -0
  26. headroom_ai-0.2.2/headroom/exceptions.py +192 -0
  27. headroom_ai-0.2.2/headroom/integrations/__init__.py +42 -0
  28. headroom_ai-0.2.2/headroom/integrations/langchain.py +905 -0
  29. headroom_ai-0.2.2/headroom/integrations/mcp.py +533 -0
  30. headroom_ai-0.2.2/headroom/models/__init__.py +39 -0
  31. headroom_ai-0.2.2/headroom/models/registry.py +749 -0
  32. headroom_ai-0.2.2/headroom/parser.py +293 -0
  33. headroom_ai-0.2.2/headroom/pricing/__init__.py +36 -0
  34. headroom_ai-0.2.2/headroom/pricing/anthropic_prices.py +81 -0
  35. headroom_ai-0.2.2/headroom/pricing/openai_prices.py +91 -0
  36. headroom_ai-0.2.2/headroom/pricing/registry.py +188 -0
  37. headroom_ai-0.2.2/headroom/providers/__init__.py +61 -0
  38. headroom_ai-0.2.2/headroom/providers/anthropic.py +356 -0
  39. headroom_ai-0.2.2/headroom/providers/base.py +131 -0
  40. headroom_ai-0.2.2/headroom/providers/cohere.py +313 -0
  41. headroom_ai-0.2.2/headroom/providers/google.py +372 -0
  42. headroom_ai-0.2.2/headroom/providers/litellm.py +291 -0
  43. headroom_ai-0.2.2/headroom/providers/openai.py +297 -0
  44. headroom_ai-0.2.2/headroom/providers/openai_compatible.py +521 -0
  45. headroom_ai-0.2.2/headroom/proxy/__init__.py +19 -0
  46. headroom_ai-0.2.2/headroom/proxy/server.py +2187 -0
  47. headroom_ai-0.2.2/headroom/py.typed +0 -0
  48. headroom_ai-0.2.2/headroom/relevance/__init__.py +124 -0
  49. headroom_ai-0.2.2/headroom/relevance/base.py +106 -0
  50. headroom_ai-0.2.2/headroom/relevance/bm25.py +255 -0
  51. headroom_ai-0.2.2/headroom/relevance/embedding.py +255 -0
  52. headroom_ai-0.2.2/headroom/relevance/hybrid.py +259 -0
  53. headroom_ai-0.2.2/headroom/reporting/__init__.py +5 -0
  54. headroom_ai-0.2.2/headroom/reporting/generator.py +549 -0
  55. headroom_ai-0.2.2/headroom/storage/__init__.py +41 -0
  56. headroom_ai-0.2.2/headroom/storage/base.py +125 -0
  57. headroom_ai-0.2.2/headroom/storage/jsonl.py +220 -0
  58. headroom_ai-0.2.2/headroom/storage/sqlite.py +289 -0
  59. headroom_ai-0.2.2/headroom/telemetry/__init__.py +91 -0
  60. headroom_ai-0.2.2/headroom/telemetry/collector.py +764 -0
  61. headroom_ai-0.2.2/headroom/telemetry/models.py +581 -0
  62. headroom_ai-0.2.2/headroom/telemetry/toin.py +1361 -0
  63. headroom_ai-0.2.2/headroom/tokenizer.py +80 -0
  64. headroom_ai-0.2.2/headroom/tokenizers/__init__.py +75 -0
  65. headroom_ai-0.2.2/headroom/tokenizers/base.py +199 -0
  66. headroom_ai-0.2.2/headroom/tokenizers/estimator.py +198 -0
  67. headroom_ai-0.2.2/headroom/tokenizers/huggingface.py +317 -0
  68. headroom_ai-0.2.2/headroom/tokenizers/mistral.py +245 -0
  69. headroom_ai-0.2.2/headroom/tokenizers/registry.py +398 -0
  70. headroom_ai-0.2.2/headroom/tokenizers/tiktoken_counter.py +248 -0
  71. headroom_ai-0.2.2/headroom/transforms/__init__.py +72 -0
  72. headroom_ai-0.2.2/headroom/transforms/base.py +57 -0
  73. headroom_ai-0.2.2/headroom/transforms/cache_aligner.py +357 -0
  74. headroom_ai-0.2.2/headroom/transforms/content_detector.py +335 -0
  75. headroom_ai-0.2.2/headroom/transforms/llmlingua_compressor.py +633 -0
  76. headroom_ai-0.2.2/headroom/transforms/log_compressor.py +529 -0
  77. headroom_ai-0.2.2/headroom/transforms/pipeline.py +297 -0
  78. headroom_ai-0.2.2/headroom/transforms/rolling_window.py +350 -0
  79. headroom_ai-0.2.2/headroom/transforms/search_compressor.py +365 -0
  80. headroom_ai-0.2.2/headroom/transforms/smart_crusher.py +2539 -0
  81. headroom_ai-0.2.2/headroom/transforms/text_compressor.py +259 -0
  82. headroom_ai-0.2.2/headroom/transforms/tool_crusher.py +338 -0
  83. headroom_ai-0.2.2/headroom/utils.py +215 -0
  84. headroom_ai-0.2.2/pyproject.toml +193 -0
  85. headroom_ai-0.2.2/tests/__init__.py +1 -0
  86. headroom_ai-0.2.2/tests/conftest.py +206 -0
  87. headroom_ai-0.2.2/tests/test_acceptance.py +608 -0
  88. headroom_ai-0.2.2/tests/test_cache/__init__.py +1 -0
  89. headroom_ai-0.2.2/tests/test_cache/test_anthropic.py +184 -0
  90. headroom_ai-0.2.2/tests/test_cache/test_base.py +140 -0
  91. headroom_ai-0.2.2/tests/test_cache/test_client_integration.py +221 -0
  92. headroom_ai-0.2.2/tests/test_cache/test_dynamic_detector.py +512 -0
  93. headroom_ai-0.2.2/tests/test_cache/test_google.py +272 -0
  94. headroom_ai-0.2.2/tests/test_cache/test_openai.py +197 -0
  95. headroom_ai-0.2.2/tests/test_cache/test_registry.py +136 -0
  96. headroom_ai-0.2.2/tests/test_cache/test_semantic.py +299 -0
  97. headroom_ai-0.2.2/tests/test_ccr.py +617 -0
  98. headroom_ai-0.2.2/tests/test_ccr_context_tracker.py +741 -0
  99. headroom_ai-0.2.2/tests/test_ccr_feedback.py +376 -0
  100. headroom_ai-0.2.2/tests/test_ccr_response_handler.py +701 -0
  101. headroom_ai-0.2.2/tests/test_ccr_tool_injection.py +346 -0
  102. headroom_ai-0.2.2/tests/test_config.py +541 -0
  103. headroom_ai-0.2.2/tests/test_critical_fixes.py +448 -0
  104. headroom_ai-0.2.2/tests/test_critical_gaps.py +1346 -0
  105. headroom_ai-0.2.2/tests/test_crushability.py +423 -0
  106. headroom_ai-0.2.2/tests/test_integrations/__init__.py +1 -0
  107. headroom_ai-0.2.2/tests/test_integrations/test_langchain.py +617 -0
  108. headroom_ai-0.2.2/tests/test_integrations/test_langchain_evals.py +594 -0
  109. headroom_ai-0.2.2/tests/test_integrations/test_mcp.py +612 -0
  110. headroom_ai-0.2.2/tests/test_models.py +259 -0
  111. headroom_ai-0.2.2/tests/test_parser.py +593 -0
  112. headroom_ai-0.2.2/tests/test_providers/__init__.py +0 -0
  113. headroom_ai-0.2.2/tests/test_providers/test_anthropic.py +62 -0
  114. headroom_ai-0.2.2/tests/test_providers/test_cohere.py +124 -0
  115. headroom_ai-0.2.2/tests/test_providers/test_openai.py +115 -0
  116. headroom_ai-0.2.2/tests/test_providers/test_universal.py +294 -0
  117. headroom_ai-0.2.2/tests/test_proxy_ccr.py +333 -0
  118. headroom_ai-0.2.2/tests/test_proxy_llmlingua.py +458 -0
  119. headroom_ai-0.2.2/tests/test_quality_retention.py +374 -0
  120. headroom_ai-0.2.2/tests/test_relevance.py +358 -0
  121. headroom_ai-0.2.2/tests/test_storage/__init__.py +1 -0
  122. headroom_ai-0.2.2/tests/test_storage/test_sqlite.py +795 -0
  123. headroom_ai-0.2.2/tests/test_telemetry.py +704 -0
  124. headroom_ai-0.2.2/tests/test_text_compressors.py +434 -0
  125. headroom_ai-0.2.2/tests/test_toin.py +958 -0
  126. headroom_ai-0.2.2/tests/test_toin_fixes.py +685 -0
  127. headroom_ai-0.2.2/tests/test_toin_integration.py +372 -0
  128. headroom_ai-0.2.2/tests/test_tokenizers.py +445 -0
  129. headroom_ai-0.2.2/tests/test_transforms/__init__.py +1 -0
  130. headroom_ai-0.2.2/tests/test_transforms/test_cache_aligner.py +777 -0
  131. headroom_ai-0.2.2/tests/test_transforms/test_llmlingua_compressor.py +941 -0
  132. headroom_ai-0.2.2/tests/test_transforms/test_rolling_window.py +859 -0
  133. headroom_ai-0.2.2/tests/test_transforms/test_smart_crusher.py +1359 -0
  134. headroom_ai-0.2.2/tests/test_transforms/test_tool_crusher.py +154 -0
@@ -0,0 +1,168 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ pytest_cache/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Environments
57
+ .env
58
+ .env.*
59
+ .venv
60
+ env/
61
+ venv/
62
+ ENV/
63
+ env.bak/
64
+ venv.bak/
65
+ .python-version
66
+
67
+ # Secrets and API keys - NEVER commit these
68
+ *.pem
69
+ *.key
70
+ secrets.json
71
+ credentials.json
72
+ .secrets
73
+ api_keys.txt
74
+ .anthropic
75
+ .openai
76
+
77
+ # IDE and editors
78
+ .idea/
79
+ .vscode/
80
+ *.swp
81
+ *.swo
82
+ *~
83
+ .project
84
+ .pydevproject
85
+ .settings/
86
+ *.sublime-project
87
+ *.sublime-workspace
88
+ .spyproject
89
+ .spyderproject
90
+
91
+ # Jupyter Notebook
92
+ .ipynb_checkpoints
93
+ *.ipynb
94
+
95
+ # macOS
96
+ .DS_Store
97
+ .AppleDouble
98
+ .LSOverride
99
+ ._*
100
+
101
+ # Thumbnails
102
+ Icon?
103
+ ._*
104
+
105
+ # Windows
106
+ Thumbs.db
107
+ ehthumbs.db
108
+ Desktop.ini
109
+
110
+ # Linux
111
+ *~
112
+
113
+ # Local configuration
114
+ local_settings.py
115
+ *.local.py
116
+ *.local.json
117
+ *.local.yaml
118
+
119
+ # Database files
120
+ *.db
121
+ *.sqlite
122
+ *.sqlite3
123
+
124
+ # Log files
125
+ *.log
126
+ logs/
127
+ log/
128
+
129
+ # Temporary files
130
+ tmp/
131
+ temp/
132
+ *.tmp
133
+ *.bak
134
+ *.swp
135
+
136
+ # Benchmark results (keep framework, not results)
137
+ .benchmarks/
138
+ benchmark_results.json
139
+ benchmark_results/
140
+
141
+ # DeepEval cache
142
+ .deepeval/
143
+
144
+ # Headroom specific
145
+ headroom.db
146
+ headroom_*.db
147
+ *.jsonl
148
+ !tests/fixtures/*.jsonl
149
+
150
+ # Documentation build
151
+ docs/_build/
152
+ site/
153
+
154
+ # mypy
155
+ .mypy_cache/
156
+ .dmypy.json
157
+ dmypy.json
158
+
159
+ # Ruff
160
+ .ruff_cache/
161
+
162
+ # pyright
163
+ pyrightconfig.json
164
+
165
+ # Editor backup files
166
+ *~
167
+ \#*\#
168
+ .\#*
@@ -0,0 +1,129 @@
1
+ # Changelog
2
+
3
+ All notable changes to Headroom will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Production-ready proxy server with caching, rate limiting, and metrics
12
+ - CLI command `headroom proxy` to start the proxy server
13
+ - **LLMLingua-2 Integration** (opt-in ML-based compression)
14
+ - `LLMLinguaCompressor` transform using Microsoft's LLMLingua-2 model
15
+ - Content-aware compression rates (code: 0.4, JSON: 0.35, text: 0.3)
16
+ - Memory management utilities: `unload_llmlingua_model()`, `is_llmlingua_model_loaded()`
17
+ - Proxy integration via `--llmlingua` flag
18
+ - Device selection: `--llmlingua-device` (auto/cuda/cpu/mps)
19
+ - Custom compression rate: `--llmlingua-rate`
20
+ - Helpful startup hints when llmlingua is available but not enabled
21
+ - Install with: `pip install headroom-ai[llmlingua]`
22
+
23
+ ## [0.2.0] - 2025-01-07
24
+
25
+ ### Added
26
+ - **SmartCrusher**: Statistical compression for tool outputs
27
+ - Keeps first/last K items, errors, anomalies, and relevance matches
28
+ - Variance-based change point detection
29
+ - Pattern detection (time series, logs, search results)
30
+ - **Relevance Scoring Engine**: ML-powered item relevance
31
+ - `BM25Scorer`: Fast keyword matching (zero dependencies)
32
+ - `EmbeddingScorer`: Semantic similarity with sentence-transformers
33
+ - `HybridScorer`: Adaptive combination of both methods
34
+ - **CacheAligner**: Prefix stabilization for better cache hits
35
+ - Dynamic date extraction
36
+ - Whitespace normalization
37
+ - Stable prefix hashing
38
+ - **RollingWindow**: Context management within token limits
39
+ - Drops oldest tool units first
40
+ - Never orphans tool results
41
+ - Preserves recent turns
42
+ - **Multi-Provider Support**:
43
+ - Anthropic with official `count_tokens` API
44
+ - Google with official `countTokens` API
45
+ - Cohere with official `tokenize` API
46
+ - Mistral with official tokenizer
47
+ - LiteLLM for unified interface
48
+ - **Integrations**:
49
+ - LangChain callback handler (`HeadroomOptimizer`)
50
+ - MCP (Model Context Protocol) utilities
51
+ - **Proxy Server** (`headroom.proxy`):
52
+ - Semantic caching with LRU eviction
53
+ - Token bucket rate limiting
54
+ - Retry with exponential backoff
55
+ - Cost tracking with budget enforcement
56
+ - Prometheus metrics endpoint
57
+ - Request logging (JSONL)
58
+ - **Pricing Registry**: Centralized model pricing with staleness tracking
59
+ - **Benchmarks**: Performance benchmarks for transforms and relevance scoring
60
+
61
+ ### Changed
62
+ - Improved token counting accuracy across all providers
63
+ - Enhanced tool output compression with relevance-aware selection
64
+
65
+ ### Fixed
66
+ - Mistral tokenizer API compatibility
67
+ - Google token counting for multi-turn conversations
68
+
69
+ ## [0.1.0] - 2025-01-05
70
+
71
+ ### Added
72
+ - Initial release
73
+ - `HeadroomClient`: OpenAI-compatible client wrapper
74
+ - `ToolCrusher`: Basic tool output compression
75
+ - Audit mode for observation without modification
76
+ - Optimize mode for applying transforms
77
+ - Simulate mode for previewing changes
78
+ - SQLite and JSONL storage backends
79
+ - HTML report generation
80
+ - Streaming support
81
+
82
+ ### Safety Guarantees
83
+ - Never removes human content
84
+ - Never breaks tool ordering
85
+ - Parse failures are no-ops
86
+ - Preserves recency (last N turns)
87
+
88
+ ---
89
+
90
+ ## Migration Guide
91
+
92
+ ### From 0.1.x to 0.2.x
93
+
94
+ The 0.2.0 release is backward compatible. New features are opt-in:
95
+
96
+ ```python
97
+ # Old code still works
98
+ from headroom import HeadroomClient, OpenAIProvider
99
+
100
+ # New SmartCrusher (replaces ToolCrusher for better compression)
101
+ from headroom import SmartCrusher, SmartCrusherConfig
102
+
103
+ config = SmartCrusherConfig(
104
+ min_tokens_to_crush=200,
105
+ max_items_after_crush=50,
106
+ )
107
+ crusher = SmartCrusher(config)
108
+
109
+ # New relevance scoring
110
+ from headroom import create_scorer
111
+
112
+ scorer = create_scorer("hybrid") # or "bm25" for zero deps
113
+ ```
114
+
115
+ ### Using the Proxy
116
+
117
+ New in 0.2.0 - run Headroom as a proxy server:
118
+
119
+ ```bash
120
+ # Start the proxy
121
+ python -m headroom.proxy.server --port 8787
122
+
123
+ # Use with Claude Code
124
+ ANTHROPIC_BASE_URL=http://localhost:8787 claude
125
+ ```
126
+
127
+ [Unreleased]: https://github.com/headroom-sdk/headroom/compare/v0.2.0...HEAD
128
+ [0.2.0]: https://github.com/headroom-sdk/headroom/compare/v0.1.0...v0.2.0
129
+ [0.1.0]: https://github.com/headroom-sdk/headroom/releases/tag/v0.1.0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Headroom Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,43 @@
1
+ Headroom
2
+ Copyright 2025 Headroom Contributors
3
+
4
+ This product includes software developed by the Headroom Contributors.
5
+
6
+ Third-Party Licenses
7
+ ====================
8
+
9
+ This software uses the following third-party libraries:
10
+
11
+ tiktoken
12
+ --------
13
+ Copyright (c) 2022 OpenAI, Shantanu Jain
14
+ Licensed under the MIT License
15
+ https://github.com/openai/tiktoken
16
+
17
+ Pydantic
18
+ --------
19
+ Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors
20
+ Licensed under the MIT License
21
+ https://github.com/pydantic/pydantic
22
+
23
+ sentence-transformers (optional dependency)
24
+ -------------------------------------------
25
+ Copyright 2019 Nils Reimers
26
+ Licensed under the Apache License 2.0
27
+ https://github.com/UKPLab/sentence-transformers
28
+
29
+ Note: Some pretrained sentence-transformer models may have additional licensing
30
+ restrictions based on their training data. Please verify model-specific licenses
31
+ before commercial use.
32
+
33
+ FastAPI (optional dependency)
34
+ -----------------------------
35
+ Copyright (c) 2018 Sebastián Ramírez
36
+ Licensed under the MIT License
37
+ https://github.com/tiangolo/fastapi
38
+
39
+ NumPy (optional dependency)
40
+ ---------------------------
41
+ Copyright (c) 2005-2024, NumPy Developers
42
+ Licensed under the BSD 3-Clause License
43
+ https://github.com/numpy/numpy