osmosis-ai 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
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 osmosis-ai might be problematic. Click here for more details.
- osmosis_ai/__init__.py +13 -4
- osmosis_ai/consts.py +1 -1
- osmosis_ai/providers/__init__.py +36 -0
- osmosis_ai/providers/anthropic_provider.py +85 -0
- osmosis_ai/providers/base.py +60 -0
- osmosis_ai/providers/gemini_provider.py +269 -0
- osmosis_ai/providers/openai_family.py +607 -0
- osmosis_ai/providers/shared.py +92 -0
- osmosis_ai/rubric_eval.py +537 -0
- osmosis_ai/rubric_types.py +49 -0
- osmosis_ai/utils.py +392 -1
- osmosis_ai-0.2.2.dist-info/METADATA +241 -0
- osmosis_ai-0.2.2.dist-info/RECORD +16 -0
- osmosis_ai-0.2.1.dist-info/METADATA +0 -143
- osmosis_ai-0.2.1.dist-info/RECORD +0 -8
- {osmosis_ai-0.2.1.dist-info → osmosis_ai-0.2.2.dist-info}/WHEEL +0 -0
- {osmosis_ai-0.2.1.dist-info → osmosis_ai-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {osmosis_ai-0.2.1.dist-info → osmosis_ai-0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: osmosis-ai
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: A Python library for reward function validation with strict type enforcement.
|
|
5
|
-
Author-email: Osmosis AI <jake@osmosis.ai>
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Gulp AI
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
Project-URL: Homepage, https://github.com/Osmosis-AI/osmosis-sdk-python
|
|
28
|
-
Project-URL: Issues, https://github.com/Osmosis-AI/osmosis-sdk-python/issues
|
|
29
|
-
Classifier: Programming Language :: Python :: 3
|
|
30
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
-
Classifier: Operating System :: OS Independent
|
|
32
|
-
Requires-Python: >=3.6
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
License-File: LICENSE
|
|
35
|
-
Dynamic: license-file
|
|
36
|
-
|
|
37
|
-
# osmosis-ai
|
|
38
|
-
|
|
39
|
-
A Python library that provides reward functionality for LLM applications with strict type enforcement.
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install osmosis-ai
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
For development:
|
|
48
|
-
```bash
|
|
49
|
-
git clone https://github.com/Osmosis-AI/osmosis-sdk-python
|
|
50
|
-
cd osmosis-sdk-python
|
|
51
|
-
pip install -e .
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Quick Start
|
|
55
|
-
|
|
56
|
-
```python
|
|
57
|
-
from osmosis_ai import osmosis_reward
|
|
58
|
-
|
|
59
|
-
@osmosis_reward
|
|
60
|
-
def simple_reward(solution_str: str, ground_truth: str, extra_info: dict = None) -> float:
|
|
61
|
-
"""Basic exact match reward function."""
|
|
62
|
-
return 1.0 if solution_str.strip() == ground_truth.strip() else 0.0
|
|
63
|
-
|
|
64
|
-
# Use the reward function
|
|
65
|
-
score = simple_reward("hello world", "hello world") # Returns 1.0
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Required Function Signature
|
|
69
|
-
|
|
70
|
-
All functions decorated with `@osmosis_reward` must have exactly this signature:
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
@osmosis_reward
|
|
74
|
-
def your_function(solution_str: str, ground_truth: str, extra_info: dict = None) -> float:
|
|
75
|
-
# Your reward logic here
|
|
76
|
-
return float_score
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Parameters
|
|
80
|
-
|
|
81
|
-
- **`solution_str: str`** - The solution string to evaluate (required)
|
|
82
|
-
- **`ground_truth: str`** - The correct/expected answer (required)
|
|
83
|
-
- **`extra_info: dict = None`** - Optional dictionary for additional configuration
|
|
84
|
-
|
|
85
|
-
### Return Value
|
|
86
|
-
|
|
87
|
-
- **`-> float`** - Must return a float value representing the reward score
|
|
88
|
-
|
|
89
|
-
The decorator will raise a `TypeError` if the function doesn't match this exact signature or doesn't return a float.
|
|
90
|
-
|
|
91
|
-
## Examples
|
|
92
|
-
|
|
93
|
-
See the [`examples/`](examples/) directory for complete examples:
|
|
94
|
-
|
|
95
|
-
```python
|
|
96
|
-
@osmosis_reward
|
|
97
|
-
def case_insensitive_match(solution_str: str, ground_truth: str, extra_info: dict = None) -> float:
|
|
98
|
-
"""Case-insensitive string matching with partial credit."""
|
|
99
|
-
match = solution_str.lower().strip() == ground_truth.lower().strip()
|
|
100
|
-
|
|
101
|
-
if extra_info and 'partial_credit' in extra_info:
|
|
102
|
-
if not match and extra_info['partial_credit']:
|
|
103
|
-
len_diff = abs(len(solution_str) - len(ground_truth))
|
|
104
|
-
if len_diff <= 2:
|
|
105
|
-
return 0.5
|
|
106
|
-
|
|
107
|
-
return 1.0 if match else 0.0
|
|
108
|
-
|
|
109
|
-
@osmosis_reward
|
|
110
|
-
def numeric_tolerance(solution_str: str, ground_truth: str, extra_info: dict = None) -> float:
|
|
111
|
-
"""Numeric comparison with configurable tolerance."""
|
|
112
|
-
try:
|
|
113
|
-
solution_num = float(solution_str.strip())
|
|
114
|
-
truth_num = float(ground_truth.strip())
|
|
115
|
-
|
|
116
|
-
tolerance = extra_info.get('tolerance', 0.01) if extra_info else 0.01
|
|
117
|
-
return 1.0 if abs(solution_num - truth_num) <= tolerance else 0.0
|
|
118
|
-
except ValueError:
|
|
119
|
-
return 0.0
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Running Examples
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
python examples/reward_functions.py
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## License
|
|
129
|
-
|
|
130
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
131
|
-
|
|
132
|
-
## Contributing
|
|
133
|
-
|
|
134
|
-
1. Fork the repository
|
|
135
|
-
2. Create a feature branch
|
|
136
|
-
3. Make your changes
|
|
137
|
-
4. Run tests and examples
|
|
138
|
-
5. Submit a pull request
|
|
139
|
-
|
|
140
|
-
## Links
|
|
141
|
-
|
|
142
|
-
- [Homepage](https://github.com/Osmosis-AI/osmosis-sdk-python)
|
|
143
|
-
- [Issues](https://github.com/Osmosis-AI/osmosis-sdk-python/issues)
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
osmosis_ai/__init__.py,sha256=P1w65jE23XhFLW6BEOaiMat-EoANgKwSYBIQFPCS3Xc,445
|
|
2
|
-
osmosis_ai/consts.py,sha256=qnleJ6zIbS-AqX-pviqiNI5KV5w7dlmghvhbl75y048,73
|
|
3
|
-
osmosis_ai/utils.py,sha256=1UmSC2HXRhryoHJ5c016VitHsRH38XRsXhacv2kGLPM,2505
|
|
4
|
-
osmosis_ai-0.2.1.dist-info/licenses/LICENSE,sha256=FV2ZmyhdCYinoLLvU_ci-7pZ3DeNYY9XqZjVjOd3h94,1064
|
|
5
|
-
osmosis_ai-0.2.1.dist-info/METADATA,sha256=JDg33fTpMwdiTilgoswWF9nvCQiqvQsNWIYT_eL9omY,4753
|
|
6
|
-
osmosis_ai-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
osmosis_ai-0.2.1.dist-info/top_level.txt,sha256=UPNRTKIBSrxsJVNxwXnLCqSoBS4bAiL_3jMtjvf5zEY,11
|
|
8
|
-
osmosis_ai-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|