osmosis-ai 0.1.7__tar.gz → 0.1.8__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 osmosis-ai might be problematic. Click here for more details.
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/PKG-INFO +1 -1
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/__init__.py +4 -1
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/consts.py +1 -1
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/utils.py +24 -1
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/pyproject.toml +1 -1
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/.env.sample +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/LICENSE +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/MANIFEST.in +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/README.md +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/adapters/__init__.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/adapters/anthropic.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/adapters/langchain.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/adapters/langchain_anthropic.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/adapters/langchain_openai.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/adapters/openai.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai/logger.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/osmosis_ai.egg-info/SOURCES.txt +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/pytest.ini +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/requirements.txt +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/setup.cfg +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/setup.py +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/setup_env.bat +0 -0
- {osmosis_ai-0.1.7 → osmosis_ai-0.1.8}/setup_env.sh +0 -0
|
@@ -15,7 +15,7 @@ Currently supported adapters:
|
|
|
15
15
|
def _import_modules():
|
|
16
16
|
global utils, logger, reconfigure_logger
|
|
17
17
|
global set_log_destination, log_destination, LogDestination
|
|
18
|
-
global init, enabled, disable_osmosis, enable_osmosis
|
|
18
|
+
global init, enabled, disable_osmosis, enable_osmosis, osmosis_reward
|
|
19
19
|
|
|
20
20
|
from . import utils
|
|
21
21
|
from .logger import logger, reconfigure_logger, set_log_destination, log_destination
|
|
@@ -30,6 +30,9 @@ def _import_modules():
|
|
|
30
30
|
|
|
31
31
|
# Re-export initialization function
|
|
32
32
|
init = utils.init
|
|
33
|
+
|
|
34
|
+
# Export the reward decorator
|
|
35
|
+
osmosis_reward = utils.osmosis_reward
|
|
33
36
|
|
|
34
37
|
# Initialize wrappers as None
|
|
35
38
|
global wrap_anthropic, wrap_openai, wrap_langchain
|
|
@@ -4,8 +4,9 @@ Utility functions for osmosisadapters
|
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
from datetime import datetime, timezone
|
|
7
|
-
from typing import Any, Dict
|
|
7
|
+
from typing import Any, Dict, Callable
|
|
8
8
|
import xxhash
|
|
9
|
+
import functools
|
|
9
10
|
|
|
10
11
|
# Import constants
|
|
11
12
|
from .consts import osmosis_api_url
|
|
@@ -95,3 +96,25 @@ def send_to_osmosis(
|
|
|
95
96
|
)
|
|
96
97
|
except Exception as e:
|
|
97
98
|
logger.warning(f"Failed to send data to OSMOSIS API: {str(e)}")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def osmosis_reward(func: Callable) -> Callable:
|
|
102
|
+
"""
|
|
103
|
+
Decorator for reward functions.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
func: The reward function to be wrapped
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
The wrapped function
|
|
110
|
+
|
|
111
|
+
Example:
|
|
112
|
+
@osmosis_reward
|
|
113
|
+
def calculate_reward(state, action):
|
|
114
|
+
return state.score + action.value
|
|
115
|
+
"""
|
|
116
|
+
@functools.wraps(func)
|
|
117
|
+
def wrapper(*args, **kwargs):
|
|
118
|
+
return func(*args, **kwargs)
|
|
119
|
+
|
|
120
|
+
return wrapper
|
|
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
|