osmosis-ai 0.1.9__tar.gz → 0.2.1__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.

@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osmosis-ai
3
- Version: 0.1.9
4
- Summary: Adds reward functionality to LLM client libraries
3
+ Version: 0.2.1
4
+ Summary: A Python library for reward function validation with strict type enforcement.
5
5
  Author-email: Osmosis AI <jake@osmosis.ai>
6
6
  License: MIT License
7
7
 
@@ -0,0 +1,15 @@
1
+ """
2
+ osmosis-ai: A Python library for reward function validation with strict type enforcement.
3
+
4
+ This library provides the @osmosis_reward decorator that enforces standardized
5
+ function signatures for reward functions used in LLM applications.
6
+
7
+ Features:
8
+ - Type-safe reward function decoration
9
+ - Parameter name and type validation
10
+ - Support for optional configuration parameters
11
+ """
12
+
13
+ from .utils import osmosis_reward
14
+
15
+ __all__ = ["osmosis_reward"]
@@ -1,3 +1,3 @@
1
1
  # package metadata
2
2
  package_name = "osmosis-ai"
3
- package_version = "0.1.9"
3
+ package_version = "0.2.1"
@@ -54,6 +54,7 @@ def osmosis_reward(func: Callable) -> Callable:
54
54
 
55
55
  @functools.wraps(func)
56
56
  def wrapper(*args, **kwargs):
57
+ kwargs.pop("data_source", None)
57
58
  result = func(*args, **kwargs)
58
59
  if not isinstance(result, float):
59
60
  raise TypeError(f"Function {func.__name__} must return a float, got {type(result).__name__}")
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "osmosis-ai"
7
- version = "0.1.9"
8
- description = "Adds reward functionality to LLM client libraries"
7
+ version = "0.2.1"
8
+ description = "A Python library for reward function validation with strict type enforcement."
9
9
  readme = "README.md"
10
10
  authors = [
11
11
  {name = "Osmosis AI", email = "jake@osmosis.ai"}
@@ -1,137 +0,0 @@
1
- """
2
- osmosis-ai: A library for monkey patching LLM APIs to print all prompts and responses.
3
-
4
- This module patches various LLM client libraries to send all prompts and responses
5
- to the OSMOSIS API for logging and monitoring.
6
-
7
- Currently supported adapters:
8
- - Anthropic (both sync and async clients)
9
- - OpenAI (both sync and async clients, v1 and v2 API versions)
10
- - LangChain (LLMs, Chat Models, and Prompt Templates)
11
- """
12
-
13
-
14
- # Use lazy imports to avoid importing modules during setup
15
- def _import_modules():
16
- global utils, logger, reconfigure_logger
17
- global set_log_destination, log_destination, LogDestination
18
- global init, enabled, disable_osmosis, enable_osmosis, osmosis_reward
19
-
20
- from . import utils
21
- from .logger import logger, reconfigure_logger, set_log_destination, log_destination
22
- from .consts import LogDestination
23
-
24
- # Re-export configuration flags for easy access
25
- enabled = utils.enabled
26
-
27
- # Export disable and enable functions
28
- disable_osmosis = utils.disable_osmosis
29
- enable_osmosis = utils.enable_osmosis
30
-
31
- # Re-export initialization function
32
- init = utils.init
33
-
34
- # Export the reward decorator
35
- osmosis_reward = utils.osmosis_reward
36
-
37
- # Initialize wrappers as None
38
- global wrap_anthropic, wrap_openai, wrap_langchain
39
- global wrap_langchain_openai, wrap_langchain_anthropic
40
-
41
- wrap_anthropic = None
42
- wrap_openai = None
43
- wrap_langchain = None
44
- wrap_langchain_openai = None
45
- wrap_langchain_anthropic = None
46
-
47
- # Lazily set up anthropic wrapper if available
48
- try:
49
- from .adapters import anthropic
50
-
51
- wrap_anthropic = anthropic.wrap_anthropic
52
- # Apply the wrapper, but don't fail if it doesn't work
53
- try:
54
- wrap_anthropic()
55
- except Exception as e:
56
- logger.warning(f"Failed to wrap Anthropic: {str(e)}")
57
- except ImportError:
58
-
59
- def wrap_anthropic():
60
- logger.warning(
61
- "Anthropic support not available. Install Anthropic to use this feature."
62
- )
63
-
64
- # Lazily set up OpenAI wrapper if available
65
- try:
66
- from .adapters import openai
67
-
68
- wrap_openai = openai.wrap_openai
69
- # Apply the wrapper, but don't fail if it doesn't work
70
- try:
71
- wrap_openai()
72
- except Exception as e:
73
- logger.warning(f"Failed to wrap OpenAI: {str(e)}")
74
- except ImportError:
75
-
76
- def wrap_openai():
77
- logger.warning(
78
- "OpenAI support not available. Install OpenAI to use this feature."
79
- )
80
-
81
- # Lazily set up LangChain wrapper if available
82
- try:
83
- from .adapters import langchain
84
-
85
- wrap_langchain = langchain.wrap_langchain
86
- # Apply the wrapper, but don't fail if it doesn't work
87
- try:
88
- wrap_langchain()
89
- except Exception as e:
90
- logger.warning(f"Failed to wrap LangChain: {str(e)}")
91
- except ImportError:
92
-
93
- def wrap_langchain():
94
- logger.warning(
95
- "LangChain support not available. Install LangChain to use this feature."
96
- )
97
-
98
- # Lazily set up LangChain-OpenAI wrapper if available
99
- try:
100
- from .adapters import langchain_openai
101
-
102
- wrap_langchain_openai = langchain_openai.wrap_langchain_openai
103
- # Apply the wrapper, but don't fail if it doesn't work
104
- try:
105
- wrap_langchain_openai()
106
- except Exception as e:
107
- logger.warning(f"Failed to wrap LangChain-OpenAI: {str(e)}")
108
- except ImportError:
109
-
110
- def wrap_langchain_openai():
111
- logger.warning(
112
- "LangChain-OpenAI support not available. Install LangChain and OpenAI to use this feature."
113
- )
114
-
115
- # Lazily set up LangChain-Anthropic wrapper if available
116
- try:
117
- from .adapters import langchain_anthropic
118
-
119
- wrap_langchain_anthropic = langchain_anthropic.wrap_langchain_anthropic
120
- # Apply the wrapper, but don't fail if it doesn't work
121
- try:
122
- wrap_langchain_anthropic()
123
- except Exception as e:
124
- logger.warning(f"Failed to wrap LangChain-Anthropic: {str(e)}")
125
- except ImportError:
126
-
127
- def wrap_langchain_anthropic():
128
- logger.warning(
129
- "LangChain-Anthropic support not available. Install LangChain and Anthropic to use this feature."
130
- )
131
-
132
-
133
- # Initialize the module on first import, but not during installation
134
- import sys
135
-
136
- if "pip" not in sys.modules:
137
- _import_modules()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes