swarmauri_metric_angular 0.1.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.
@@ -0,0 +1,201 @@
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 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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2025] [Jacob Stewart @ Swarmauri]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ Swarmauri SDK
2
+
3
+ This package is part of the Swarmauri SDK and is distributed under the
4
+ Apache License, Version 2.0. See LICENSE for the license terms.
@@ -0,0 +1,316 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_metric_angular
3
+ Version: 0.1.0
4
+ Summary: Angular distance on the unit sphere of real vectors.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Keywords: swarmauri,angular,unit-vector,inner-product
9
+ Author: Jacob Stewart
10
+ Author-email: jacob@swarmauri.com
11
+ Requires-Python: >=3.10,<3.15
12
+ Classifier: Development Status :: 1 - Planning
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Dist: swarmauri_base (>=0.11.1,<0.12)
19
+ Requires-Dist: swarmauri_core (>=0.11.2,<0.12)
20
+ Project-URL: Repository, https://github.com/swarmauri/swarmauri-sdk
21
+ Description-Content-Type: text/markdown
22
+
23
+ # swarmauri_metric_angular
24
+
25
+ <!-- readme-standards:begin branding -->
26
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
27
+ <p align="center"><strong>swarmauri_metric_angular</strong></p>
28
+ <p align="center">Angular distance on the unit sphere of real vectors.</p>
29
+ <p align="center">
30
+ <a href="https://pypi.org/project/swarmauri_metric_angular/"><img alt="pypi: swarmauri_metric_angular unpublished" src="https://img.shields.io/static/v1?label=pypi&amp;message=swarmauri_metric_angular%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
31
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/pyproject.toml"><img alt="Source version: 0.1.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.1.0&amp;labelColor=292421&amp;color=994525"></a>
32
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=292421&amp;color=994525"></a>
33
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&amp;message=standards&amp;labelColor=292421&amp;color=994525"></a>
34
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=292421&amp;color=24654A"></a>
35
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=292421&amp;color=994525"></a>
36
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=292421&amp;color=994525"></a>
37
+ </p>
38
+ <p align="center">
39
+ <a href="https://pypi.org/project/swarmauri_metric_angular/"><img alt="pypi downloads: swarmauri_metric_angular: unpublished" src="https://img.shields.io/static/v1?label=pypi%20downloads&amp;message=swarmauri_metric_angular%3A%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
40
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md"><img alt="README hits: swarmauri_metric_angular" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_metric_angular/README.md.svg?label=README%20hits&amp;labelColor=292421&amp;color=08704E"></a>
41
+ </p>
42
+ <p align="center">
43
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=292421&amp;color=67437E"></a>
44
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=292421&amp;color=67437E"></a>
45
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=292421&amp;color=805500"></a>
46
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=292421&amp;color=67437E"></a>
47
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=292421&amp;color=67437E"></a>
48
+ </p>
49
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
50
+ <!-- readme-standards:end branding -->
51
+
52
+ ---
53
+
54
+ ## Overview
55
+
56
+ ### Summary
57
+
58
+ Angular distance on the unit sphere of real vectors.
59
+
60
+ ### Why This Package
61
+
62
+ `AngularMetric` provides a separately installable implementation for Swarmauri callers.
63
+
64
+ ### When to Use
65
+
66
+ Orthogonal unit vectors return pi divided by two radians. Supply vectors already normalized to unit length.
67
+
68
+ ### Features
69
+
70
+ - Angular distance on the unit sphere of real vectors.
71
+ - Use `AngularMetric` directly from Python.
72
+
73
+ ### Non-Goals
74
+
75
+ The public surface is the component and its documented options.
76
+
77
+ ---
78
+
79
+ ## Getting Started
80
+
81
+ ### Prerequisites
82
+
83
+ Use Python 3.10 through 3.14. The source example runs in the SDK workspace.
84
+
85
+ ### Installation
86
+
87
+ #### Install with uv
88
+
89
+ <!-- readme-standards:begin installation.uv -->
90
+ `swarmauri_metric_angular` is not declared published. From the source checkout:
91
+
92
+ ```bash
93
+ uv pip install .
94
+ ```
95
+ <!-- readme-standards:end installation.uv -->
96
+
97
+ #### Install with pip
98
+
99
+ <!-- readme-standards:begin installation.pip -->
100
+ `swarmauri_metric_angular` is not declared published. From the source checkout:
101
+
102
+ ```bash
103
+ python -m pip install .
104
+ ```
105
+ <!-- readme-standards:end installation.pip -->
106
+
107
+ #### Install with Poetry
108
+
109
+ <!-- readme-standards:begin installation.poetry -->
110
+ `swarmauri_metric_angular` is not declared published. From a separate Poetry project, replace the path with your checkout:
111
+
112
+ ```bash
113
+ poetry add /path/to/swarmauri_metric_angular
114
+ ```
115
+ <!-- readme-standards:end installation.poetry -->
116
+
117
+ ### Quick Start
118
+
119
+ #### Example
120
+
121
+ <!-- readme-standards:begin example.quick-start -->
122
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/docs/readme/quick_start.py).
123
+
124
+ ```python
125
+ from swarmauri_metric_angular import AngularMetric
126
+
127
+ print(AngularMetric().distance([1, 0], [0, 1]))
128
+ ```
129
+ <!-- readme-standards:end example.quick-start -->
130
+
131
+ #### Expected Result
132
+
133
+ The example demonstrates the documented `swarmauri_metric_angular` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
134
+
135
+ ---
136
+
137
+ ## Usage
138
+
139
+ ### Common Workflows
140
+
141
+ <!-- readme-standards:begin example.usage -->
142
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/docs/readme/usage.py).
143
+
144
+ ```python
145
+ from swarmauri_metric_angular import AngularMetric
146
+
147
+ print(AngularMetric().distance([1, 0], [0, 1]))
148
+ ```
149
+ <!-- readme-standards:end example.usage -->
150
+
151
+ Pass the store to `AgentRunner` to persist a conversation. Use `runner.load(run_id)`
152
+ to read the typed run state.
153
+
154
+ ### Configuration
155
+
156
+ Configure the component at construction. See [the source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/swarmauri_metric_angular/AngularMetric.py) for supported inputs.
157
+
158
+ ### Error Handling
159
+
160
+ Invalid inputs raise an exception before a result is returned. See the API and package regression tests for concrete cases.
161
+
162
+ ### Best Practices
163
+
164
+ Use the provided example to exercise the component with your configuration before depending on it.
165
+
166
+ ---
167
+
168
+ ## Package Boundary
169
+
170
+ ### What It Owns
171
+
172
+ Angular distance on the unit sphere of real vectors.
173
+
174
+ ### Public API and Import Surfaces
175
+
176
+ Import `AngularMetric` from `swarmauri_metric_angular`.
177
+
178
+ ### Entry Points
179
+
180
+ <!-- readme-standards:begin entry-points -->
181
+ - `swarmauri.metrics` → `AngularMetric` → `swarmauri_metric_angular:AngularMetric`
182
+ <!-- readme-standards:end entry-points -->
183
+
184
+ ### Injected Dependencies
185
+
186
+ The package manifest declares the Swarmauri collaborators used by this component.
187
+
188
+ ### Protocol Consumers
189
+
190
+ Applications can construct the component directly using the import shown above.
191
+
192
+ ### Extensions
193
+
194
+ Use the corresponding SDK interface when adding another implementation.
195
+
196
+ ---
197
+
198
+ ## Operations and Readiness
199
+
200
+ ### Operational Requirements
201
+
202
+ Configure the component as shown in the example. Match the lifetime of stored records and injected collaborators to the application.
203
+
204
+ ### Health and Observability
205
+
206
+ Use package tests and inspect exceptions from component calls.
207
+
208
+ ### Security and Resource Limits
209
+
210
+ Supply application-appropriate input sizes and access controls for your use case.
211
+
212
+ ### Compatibility
213
+
214
+ Version 0.1.0 declares Python 3.10 through 3.14.
215
+
216
+ ---
217
+
218
+ ## Verification
219
+
220
+ ### Tests
221
+
222
+ Run `uv run --package swarmauri_metric_angular pytest` from the package directory.
223
+
224
+ ### Certification Status
225
+
226
+ Planning release.
227
+
228
+ ### Evidence
229
+
230
+ The distribution ships the Lean source in its import package under proofs/Metric.lean.
231
+
232
+ The source examples and package tests document the supported behavior.
233
+
234
+ ---
235
+
236
+ ## FAQ
237
+
238
+ ### Why
239
+
240
+ Angular distance on the unit sphere of real vectors.
241
+
242
+ ### How
243
+
244
+ Run the source example under Getting Started.
245
+
246
+ ### When
247
+
248
+ Re-run the package tests after changing the backend, distance model, or embedding configuration used by your application.
249
+
250
+ ---
251
+
252
+ ## Documentation and Related Packages
253
+
254
+ ### More Documentation
255
+
256
+ See the [component source](https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/40-standards/swarmauri_metric_angular).
257
+
258
+ ### Related Packages
259
+
260
+ See [swarmauri-core](https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/10-interfaces/swarmauri_core) for interfaces and shared types.
261
+
262
+ ### Project Links
263
+
264
+ <!-- readme-standards:begin project-links -->
265
+ - [Repository](https://github.com/swarmauri/swarmauri-sdk)
266
+ - [pypi: swarmauri_metric_angular](https://pypi.org/project/swarmauri_metric_angular/)
267
+ <!-- readme-standards:end project-links -->
268
+
269
+ ---
270
+
271
+ ## Contributing
272
+
273
+ ### How to Contribute
274
+
275
+ See the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md).
276
+
277
+ ### Development Setup
278
+
279
+ Use the SDK workspace to run package tests and the README examples.
280
+
281
+ ### Notes for Maintainers
282
+
283
+ Update both maintained examples when changing the public API.
284
+
285
+ ---
286
+
287
+ ## Governance
288
+
289
+ ### Ownership and Decision Making
290
+
291
+ The SDK maintainer review process applies.
292
+
293
+ ### Standards and Policies
294
+
295
+ See the [README policy](https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md).
296
+
297
+ ### Lifecycle and Migration
298
+
299
+ Planning version 0.1.0. Install from a checkout while the package is unpublished.
300
+
301
+ ---
302
+
303
+ ## License and Attribution
304
+
305
+ ### License
306
+
307
+ <!-- readme-standards:begin license -->
308
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/LICENSE).
309
+ <!-- readme-standards:end license -->
310
+
311
+ ### Notices
312
+
313
+ <!-- readme-standards:begin notices -->
314
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/NOTICE) for attribution.
315
+ <!-- readme-standards:end notices -->
316
+
@@ -0,0 +1,293 @@
1
+ # swarmauri_metric_angular
2
+
3
+ <!-- readme-standards:begin branding -->
4
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
5
+ <p align="center"><strong>swarmauri_metric_angular</strong></p>
6
+ <p align="center">Angular distance on the unit sphere of real vectors.</p>
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/swarmauri_metric_angular/"><img alt="pypi: swarmauri_metric_angular unpublished" src="https://img.shields.io/static/v1?label=pypi&amp;message=swarmauri_metric_angular%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
9
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/pyproject.toml"><img alt="Source version: 0.1.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.1.0&amp;labelColor=292421&amp;color=994525"></a>
10
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=292421&amp;color=994525"></a>
11
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&amp;message=standards&amp;labelColor=292421&amp;color=994525"></a>
12
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=292421&amp;color=24654A"></a>
13
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=292421&amp;color=994525"></a>
14
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=292421&amp;color=994525"></a>
15
+ </p>
16
+ <p align="center">
17
+ <a href="https://pypi.org/project/swarmauri_metric_angular/"><img alt="pypi downloads: swarmauri_metric_angular: unpublished" src="https://img.shields.io/static/v1?label=pypi%20downloads&amp;message=swarmauri_metric_angular%3A%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
18
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md"><img alt="README hits: swarmauri_metric_angular" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_metric_angular/README.md.svg?label=README%20hits&amp;labelColor=292421&amp;color=08704E"></a>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=292421&amp;color=67437E"></a>
22
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=292421&amp;color=67437E"></a>
23
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=292421&amp;color=805500"></a>
24
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=292421&amp;color=67437E"></a>
25
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=292421&amp;color=67437E"></a>
26
+ </p>
27
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
28
+ <!-- readme-standards:end branding -->
29
+
30
+ ---
31
+
32
+ ## Overview
33
+
34
+ ### Summary
35
+
36
+ Angular distance on the unit sphere of real vectors.
37
+
38
+ ### Why This Package
39
+
40
+ `AngularMetric` provides a separately installable implementation for Swarmauri callers.
41
+
42
+ ### When to Use
43
+
44
+ Orthogonal unit vectors return pi divided by two radians. Supply vectors already normalized to unit length.
45
+
46
+ ### Features
47
+
48
+ - Angular distance on the unit sphere of real vectors.
49
+ - Use `AngularMetric` directly from Python.
50
+
51
+ ### Non-Goals
52
+
53
+ The public surface is the component and its documented options.
54
+
55
+ ---
56
+
57
+ ## Getting Started
58
+
59
+ ### Prerequisites
60
+
61
+ Use Python 3.10 through 3.14. The source example runs in the SDK workspace.
62
+
63
+ ### Installation
64
+
65
+ #### Install with uv
66
+
67
+ <!-- readme-standards:begin installation.uv -->
68
+ `swarmauri_metric_angular` is not declared published. From the source checkout:
69
+
70
+ ```bash
71
+ uv pip install .
72
+ ```
73
+ <!-- readme-standards:end installation.uv -->
74
+
75
+ #### Install with pip
76
+
77
+ <!-- readme-standards:begin installation.pip -->
78
+ `swarmauri_metric_angular` is not declared published. From the source checkout:
79
+
80
+ ```bash
81
+ python -m pip install .
82
+ ```
83
+ <!-- readme-standards:end installation.pip -->
84
+
85
+ #### Install with Poetry
86
+
87
+ <!-- readme-standards:begin installation.poetry -->
88
+ `swarmauri_metric_angular` is not declared published. From a separate Poetry project, replace the path with your checkout:
89
+
90
+ ```bash
91
+ poetry add /path/to/swarmauri_metric_angular
92
+ ```
93
+ <!-- readme-standards:end installation.poetry -->
94
+
95
+ ### Quick Start
96
+
97
+ #### Example
98
+
99
+ <!-- readme-standards:begin example.quick-start -->
100
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/docs/readme/quick_start.py).
101
+
102
+ ```python
103
+ from swarmauri_metric_angular import AngularMetric
104
+
105
+ print(AngularMetric().distance([1, 0], [0, 1]))
106
+ ```
107
+ <!-- readme-standards:end example.quick-start -->
108
+
109
+ #### Expected Result
110
+
111
+ The example demonstrates the documented `swarmauri_metric_angular` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
112
+
113
+ ---
114
+
115
+ ## Usage
116
+
117
+ ### Common Workflows
118
+
119
+ <!-- readme-standards:begin example.usage -->
120
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/docs/readme/usage.py).
121
+
122
+ ```python
123
+ from swarmauri_metric_angular import AngularMetric
124
+
125
+ print(AngularMetric().distance([1, 0], [0, 1]))
126
+ ```
127
+ <!-- readme-standards:end example.usage -->
128
+
129
+ Pass the store to `AgentRunner` to persist a conversation. Use `runner.load(run_id)`
130
+ to read the typed run state.
131
+
132
+ ### Configuration
133
+
134
+ Configure the component at construction. See [the source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/swarmauri_metric_angular/AngularMetric.py) for supported inputs.
135
+
136
+ ### Error Handling
137
+
138
+ Invalid inputs raise an exception before a result is returned. See the API and package regression tests for concrete cases.
139
+
140
+ ### Best Practices
141
+
142
+ Use the provided example to exercise the component with your configuration before depending on it.
143
+
144
+ ---
145
+
146
+ ## Package Boundary
147
+
148
+ ### What It Owns
149
+
150
+ Angular distance on the unit sphere of real vectors.
151
+
152
+ ### Public API and Import Surfaces
153
+
154
+ Import `AngularMetric` from `swarmauri_metric_angular`.
155
+
156
+ ### Entry Points
157
+
158
+ <!-- readme-standards:begin entry-points -->
159
+ - `swarmauri.metrics` → `AngularMetric` → `swarmauri_metric_angular:AngularMetric`
160
+ <!-- readme-standards:end entry-points -->
161
+
162
+ ### Injected Dependencies
163
+
164
+ The package manifest declares the Swarmauri collaborators used by this component.
165
+
166
+ ### Protocol Consumers
167
+
168
+ Applications can construct the component directly using the import shown above.
169
+
170
+ ### Extensions
171
+
172
+ Use the corresponding SDK interface when adding another implementation.
173
+
174
+ ---
175
+
176
+ ## Operations and Readiness
177
+
178
+ ### Operational Requirements
179
+
180
+ Configure the component as shown in the example. Match the lifetime of stored records and injected collaborators to the application.
181
+
182
+ ### Health and Observability
183
+
184
+ Use package tests and inspect exceptions from component calls.
185
+
186
+ ### Security and Resource Limits
187
+
188
+ Supply application-appropriate input sizes and access controls for your use case.
189
+
190
+ ### Compatibility
191
+
192
+ Version 0.1.0 declares Python 3.10 through 3.14.
193
+
194
+ ---
195
+
196
+ ## Verification
197
+
198
+ ### Tests
199
+
200
+ Run `uv run --package swarmauri_metric_angular pytest` from the package directory.
201
+
202
+ ### Certification Status
203
+
204
+ Planning release.
205
+
206
+ ### Evidence
207
+
208
+ The distribution ships the Lean source in its import package under proofs/Metric.lean.
209
+
210
+ The source examples and package tests document the supported behavior.
211
+
212
+ ---
213
+
214
+ ## FAQ
215
+
216
+ ### Why
217
+
218
+ Angular distance on the unit sphere of real vectors.
219
+
220
+ ### How
221
+
222
+ Run the source example under Getting Started.
223
+
224
+ ### When
225
+
226
+ Re-run the package tests after changing the backend, distance model, or embedding configuration used by your application.
227
+
228
+ ---
229
+
230
+ ## Documentation and Related Packages
231
+
232
+ ### More Documentation
233
+
234
+ See the [component source](https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/40-standards/swarmauri_metric_angular).
235
+
236
+ ### Related Packages
237
+
238
+ See [swarmauri-core](https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/10-interfaces/swarmauri_core) for interfaces and shared types.
239
+
240
+ ### Project Links
241
+
242
+ <!-- readme-standards:begin project-links -->
243
+ - [Repository](https://github.com/swarmauri/swarmauri-sdk)
244
+ - [pypi: swarmauri_metric_angular](https://pypi.org/project/swarmauri_metric_angular/)
245
+ <!-- readme-standards:end project-links -->
246
+
247
+ ---
248
+
249
+ ## Contributing
250
+
251
+ ### How to Contribute
252
+
253
+ See the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md).
254
+
255
+ ### Development Setup
256
+
257
+ Use the SDK workspace to run package tests and the README examples.
258
+
259
+ ### Notes for Maintainers
260
+
261
+ Update both maintained examples when changing the public API.
262
+
263
+ ---
264
+
265
+ ## Governance
266
+
267
+ ### Ownership and Decision Making
268
+
269
+ The SDK maintainer review process applies.
270
+
271
+ ### Standards and Policies
272
+
273
+ See the [README policy](https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md).
274
+
275
+ ### Lifecycle and Migration
276
+
277
+ Planning version 0.1.0. Install from a checkout while the package is unpublished.
278
+
279
+ ---
280
+
281
+ ## License and Attribution
282
+
283
+ ### License
284
+
285
+ <!-- readme-standards:begin license -->
286
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/LICENSE).
287
+ <!-- readme-standards:end license -->
288
+
289
+ ### Notices
290
+
291
+ <!-- readme-standards:begin notices -->
292
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/NOTICE) for attribution.
293
+ <!-- readme-standards:end notices -->
@@ -0,0 +1,88 @@
1
+ [project]
2
+ name = "swarmauri_metric_angular"
3
+ version = "0.1.0"
4
+ description = "Angular distance on the unit sphere of real vectors."
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ requires-python = ">=3.10,<3.15"
8
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
9
+ keywords = ["swarmauri", "angular", "unit-vector", "inner-product"]
10
+ classifiers = [
11
+ "Development Status :: 1 - Planning",
12
+ "Programming Language :: Python :: 3.10",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13",
16
+ "Programming Language :: Python :: 3.14",
17
+ ]
18
+ dependencies = ["swarmauri_core>=0.11.2,<0.12", "swarmauri_base>=0.11.1,<0.12"]
19
+ license-files = ["LICENSE", "NOTICE"]
20
+
21
+ [project.urls]
22
+ Repository = "https://github.com/swarmauri/swarmauri-sdk"
23
+
24
+ [project.entry-points."swarmauri.metrics"]
25
+ AngularMetric = "swarmauri_metric_angular:AngularMetric"
26
+
27
+ [tool.uv.sources]
28
+ swarmauri_tests_lean_proof = { workspace = true }
29
+ swarmauri_core = { workspace = true }
30
+ swarmauri_base = { workspace = true }
31
+
32
+ [tool.readme_standards]
33
+ policy = "package-guide-v1"
34
+ readme = "README.md"
35
+ brand = "swarmauri"
36
+ brand_catalog = "../../../tools/readme/brands.toml"
37
+ repository = "https://github.com/swarmauri/swarmauri-sdk"
38
+ ref = "master"
39
+ package_path = "pkgs/40-standards/swarmauri_metric_angular"
40
+ layer = "standards"
41
+ lifecycle = "active"
42
+ license_file = "LICENSE"
43
+ notice_file = "NOTICE"
44
+
45
+ [tool.readme_standards.distributions.pypi]
46
+ name = "swarmauri_metric_angular"
47
+ published = false
48
+
49
+ [tool.readme_standards.examples.quick_start]
50
+ source = "docs/readme/quick_start.py"
51
+ test = "tests/unit/test_readme_sources.py"
52
+ language = "python"
53
+ expected_exit_code = 0
54
+
55
+ [tool.readme_standards.examples.usage]
56
+ source = "docs/readme/usage.py"
57
+ test = "tests/unit/test_readme_sources.py"
58
+ language = "python"
59
+ expected_exit_code = 0
60
+
61
+ [tool.readme_standards.statuses.readme]
62
+ label = "CI gate"
63
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
64
+
65
+ [tool.readme_standards.statuses.tests]
66
+ label = "example source"
67
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/tests/unit/test_readme_sources.py"
68
+
69
+ [tool.readme_standards.statuses.certification]
70
+ label = "not certified"
71
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_metric_angular/README.md#certification-status"
72
+
73
+ [tool.readme_standards.statuses.governance]
74
+ label = "repository policy"
75
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
76
+
77
+ [tool.readme_standards.statuses.evidence]
78
+ label = "source and CI"
79
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
80
+ [build-system]
81
+ requires = ["poetry-core>=2.0"]
82
+ build-backend = "poetry.core.masonry.api"
83
+
84
+ [dependency-groups]
85
+ dev = ["pytest>=8.0", "swarmauri_tests_lean_proof", "ruff>=0.9.9", "readme-standards==0.1.6; python_version >= \"3.11\""]
86
+
87
+ [tool.poetry]
88
+ include = [{ path = "swarmauri_metric_angular/proofs", format = ["sdist", "wheel"] }]
@@ -0,0 +1,33 @@
1
+ from math import atan2, isclose, isfinite, sqrt
2
+ from typing import Literal, Sequence
3
+
4
+ from swarmauri_base.ComponentBase import ComponentBase
5
+ from swarmauri_base.metrics.MetricBase import MetricBase
6
+ from swarmauri_base.metrics.MetricChecksMixin import MetricChecksMixin
7
+ from swarmauri_base.vectors.VectorBase import VectorBase
8
+
9
+
10
+ @ComponentBase.register_type(MetricBase, "AngularMetric")
11
+ class AngularMetric(MetricChecksMixin, MetricBase):
12
+ """Angular distance in radians on the unit sphere."""
13
+
14
+ type: Literal["AngularMetric"] = "AngularMetric"
15
+
16
+ def _norm(self, vector: Sequence[float]) -> float:
17
+ values = VectorBase(value=list(vector))
18
+ if not all(isfinite(value) for value in values.value):
19
+ raise ValueError("angular distance requires finite vectors")
20
+ return sqrt(values.dot(values))
21
+
22
+ def _same_point(self, x: Sequence[float], y: Sequence[float]) -> bool:
23
+ return tuple(x) == tuple(y)
24
+
25
+ def distance(self, x: Sequence[float], y: Sequence[float]) -> float:
26
+ if not len(x) or len(x) != len(y):
27
+ raise ValueError("vectors must have the same positive dimension")
28
+ if not all(isclose(self._norm(v), 1, rel_tol=1e-12) for v in (x, y)):
29
+ raise ValueError("angular distance requires unit vectors")
30
+ # Use the half-angle form near coincidence and antipodes.
31
+ difference = [a - b for a, b in zip(x, y)]
32
+ total = [a + b for a, b in zip(x, y)]
33
+ return 2 * atan2(self._norm(difference), self._norm(total))
@@ -0,0 +1,10 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+
3
+ from .AngularMetric import AngularMetric
4
+
5
+ try:
6
+ __version__ = version("swarmauri_metric_angular")
7
+ except PackageNotFoundError:
8
+ __version__ = "0.1.0"
9
+
10
+ __all__ = ["AngularMetric"]
@@ -0,0 +1,43 @@
1
+ import Mathlib.Geometry.Euclidean.Angle.Unoriented.TriangleInequality
2
+
3
+ namespace SwarmauriProofs
4
+
5
+ structure MetricAxioms {X : Type*} (d : X → X → ℝ) : Prop where
6
+ nonnegative : ∀ x y, 0 ≤ d x y
7
+ separates : ∀ x y, d x y = 0 ↔ x = y
8
+ symmetric : ∀ x y, d x y = d y x
9
+ triangle : ∀ x y z, d x z ≤ d x y + d y z
10
+
11
+ section Angular
12
+
13
+ variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
14
+
15
+ abbrev UnitVector (V : Type*) [Norm V] := {v : V // ‖v‖ = 1}
16
+
17
+ noncomputable def angular (x y : UnitVector V) : ℝ :=
18
+ InnerProductGeometry.angle x.val y.val
19
+
20
+ theorem angular_axioms : MetricAxioms (angular (V := V)) where
21
+ nonnegative x y := InnerProductGeometry.angle_nonneg x.val y.val
22
+ separates x y := by
23
+ constructor
24
+ · intro h
25
+ exact Subtype.ext
26
+ (InnerProductGeometry.eq_of_angle_eq_zero_of_norm_eq h
27
+ (x.property.trans y.property.symm))
28
+ · rintro rfl
29
+ have hx : x.val ≠ 0 := by
30
+ intro h
31
+ have hn : (0 : ℝ) = 1 := by simpa [h] using x.property
32
+ exact zero_ne_one hn
33
+ exact InnerProductGeometry.angle_self hx
34
+ symmetric x y := InnerProductGeometry.angle_comm x.val y.val
35
+ triangle x y z :=
36
+ InnerProductGeometry.angle_le_angle_add_angle x.val y.val z.val
37
+
38
+ end Angular
39
+
40
+
41
+ #print axioms angular_axioms
42
+
43
+ end SwarmauriProofs