osmosis-ai 0.1.5__tar.gz → 0.1.7__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.5 → osmosis_ai-0.1.7}/PKG-INFO +9 -9
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/README.md +6 -6
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/__init__.py +41 -17
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/adapters/__init__.py +2 -2
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/adapters/anthropic.py +210 -130
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/adapters/langchain.py +261 -147
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/adapters/langchain_anthropic.py +152 -79
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/adapters/langchain_openai.py +266 -139
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/adapters/openai.py +345 -232
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/consts.py +4 -3
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/logger.py +12 -6
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai/utils.py +31 -22
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/pyproject.toml +3 -3
- osmosis_ai-0.1.7/requirements.txt +11 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/setup.py +1 -1
- osmosis_ai-0.1.5/requirements.txt +0 -16
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/.env.sample +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/LICENSE +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/MANIFEST.in +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/osmosis_ai.egg-info/SOURCES.txt +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/pytest.ini +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/setup.cfg +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/setup_env.bat +0 -0
- {osmosis_ai-0.1.5 → osmosis_ai-0.1.7}/setup_env.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: osmosis-ai
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Monkey patches LLM client libraries to print all prompts and responses
|
|
5
5
|
Author-email: Gulp AI <jake@gulp.ai>
|
|
6
6
|
License: MIT License
|
|
@@ -24,8 +24,8 @@ License: MIT License
|
|
|
24
24
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
|
-
Project-URL: Homepage, https://github.com/Gulp-AI/osmosis-
|
|
28
|
-
Project-URL: Issues, https://github.com/Gulp-AI/osmosis-
|
|
27
|
+
Project-URL: Homepage, https://github.com/Gulp-AI/osmosis-sdk-python
|
|
28
|
+
Project-URL: Issues, https://github.com/Gulp-AI/osmosis-sdk-python/issues
|
|
29
29
|
Classifier: Programming Language :: Python :: 3
|
|
30
30
|
Classifier: License :: OSI Approved :: MIT License
|
|
31
31
|
Classifier: Operating System :: OS Independent
|
|
@@ -57,11 +57,11 @@ Requires-Dist: langchain-openai>=0.0.200; extra == "all"
|
|
|
57
57
|
Requires-Dist: langchain-anthropic>=0.0.200; extra == "all"
|
|
58
58
|
Dynamic: license-file
|
|
59
59
|
|
|
60
|
-
[](https://github.com/Gulp-AI/osmosis-sdk-python/actions/workflows/test.yml)
|
|
61
61
|
|
|
62
|
-
# Osmosis
|
|
62
|
+
# Osmosis
|
|
63
63
|
|
|
64
|
-
A Python library that monkey patches LLM client libraries to send all prompts and responses to the
|
|
64
|
+
A Python library that monkey patches LLM client libraries to send all prompts and responses to the Osmosis API for logging and monitoring.
|
|
65
65
|
|
|
66
66
|
## Supported Libraries
|
|
67
67
|
|
|
@@ -93,7 +93,7 @@ pip install "osmosis-ai[all]"
|
|
|
93
93
|
Or install from source:
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
|
-
git clone https://github.com/your-username/osmosis-
|
|
96
|
+
git clone https://github.com/your-username/osmosis-sdk-python.git
|
|
97
97
|
cd osmosis-ai
|
|
98
98
|
pip install -e .
|
|
99
99
|
```
|
|
@@ -106,7 +106,7 @@ pip install -r requirements.txt
|
|
|
106
106
|
|
|
107
107
|
## Environment Setup
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
osmosisrequires a OSMOSIS API key to log LLM usage. Create a `.env` file in your project directory:
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
112
|
# Copy the sample .env file
|
|
@@ -128,7 +128,7 @@ OPENAI_API_KEY=your_openai_key_here
|
|
|
128
128
|
|
|
129
129
|
## Usage
|
|
130
130
|
|
|
131
|
-
First, import and initialize
|
|
131
|
+
First, import and initialize osmosiswith your OSMOSIS API key:
|
|
132
132
|
|
|
133
133
|
```python
|
|
134
134
|
import os
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[](https://github.com/Gulp-AI/osmosis-sdk-python/actions/workflows/test.yml)
|
|
2
2
|
|
|
3
|
-
# Osmosis
|
|
3
|
+
# Osmosis
|
|
4
4
|
|
|
5
|
-
A Python library that monkey patches LLM client libraries to send all prompts and responses to the
|
|
5
|
+
A Python library that monkey patches LLM client libraries to send all prompts and responses to the Osmosis API for logging and monitoring.
|
|
6
6
|
|
|
7
7
|
## Supported Libraries
|
|
8
8
|
|
|
@@ -34,7 +34,7 @@ pip install "osmosis-ai[all]"
|
|
|
34
34
|
Or install from source:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
git clone https://github.com/your-username/osmosis-
|
|
37
|
+
git clone https://github.com/your-username/osmosis-sdk-python.git
|
|
38
38
|
cd osmosis-ai
|
|
39
39
|
pip install -e .
|
|
40
40
|
```
|
|
@@ -47,7 +47,7 @@ pip install -r requirements.txt
|
|
|
47
47
|
|
|
48
48
|
## Environment Setup
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
osmosisrequires a OSMOSIS API key to log LLM usage. Create a `.env` file in your project directory:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
# Copy the sample .env file
|
|
@@ -69,7 +69,7 @@ OPENAI_API_KEY=your_openai_key_here
|
|
|
69
69
|
|
|
70
70
|
## Usage
|
|
71
71
|
|
|
72
|
-
First, import and initialize
|
|
72
|
+
First, import and initialize osmosiswith your OSMOSIS API key:
|
|
73
73
|
|
|
74
74
|
```python
|
|
75
75
|
import os
|
|
@@ -10,38 +10,41 @@ Currently supported adapters:
|
|
|
10
10
|
- LangChain (LLMs, Chat Models, and Prompt Templates)
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
+
|
|
13
14
|
# Use lazy imports to avoid importing modules during setup
|
|
14
15
|
def _import_modules():
|
|
15
16
|
global utils, logger, reconfigure_logger
|
|
16
17
|
global set_log_destination, log_destination, LogDestination
|
|
17
18
|
global init, enabled, disable_osmosis, enable_osmosis
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
from . import utils
|
|
20
21
|
from .logger import logger, reconfigure_logger, set_log_destination, log_destination
|
|
21
22
|
from .consts import LogDestination
|
|
23
|
+
|
|
22
24
|
# Re-export configuration flags for easy access
|
|
23
25
|
enabled = utils.enabled
|
|
24
|
-
|
|
26
|
+
|
|
25
27
|
# Export disable and enable functions
|
|
26
28
|
disable_osmosis = utils.disable_osmosis
|
|
27
29
|
enable_osmosis = utils.enable_osmosis
|
|
28
|
-
|
|
30
|
+
|
|
29
31
|
# Re-export initialization function
|
|
30
32
|
init = utils.init
|
|
31
|
-
|
|
33
|
+
|
|
32
34
|
# Initialize wrappers as None
|
|
33
35
|
global wrap_anthropic, wrap_openai, wrap_langchain
|
|
34
36
|
global wrap_langchain_openai, wrap_langchain_anthropic
|
|
35
|
-
|
|
37
|
+
|
|
36
38
|
wrap_anthropic = None
|
|
37
39
|
wrap_openai = None
|
|
38
40
|
wrap_langchain = None
|
|
39
41
|
wrap_langchain_openai = None
|
|
40
42
|
wrap_langchain_anthropic = None
|
|
41
|
-
|
|
43
|
+
|
|
42
44
|
# Lazily set up anthropic wrapper if available
|
|
43
45
|
try:
|
|
44
46
|
from .adapters import anthropic
|
|
47
|
+
|
|
45
48
|
wrap_anthropic = anthropic.wrap_anthropic
|
|
46
49
|
# Apply the wrapper, but don't fail if it doesn't work
|
|
47
50
|
try:
|
|
@@ -49,12 +52,16 @@ def _import_modules():
|
|
|
49
52
|
except Exception as e:
|
|
50
53
|
logger.warning(f"Failed to wrap Anthropic: {str(e)}")
|
|
51
54
|
except ImportError:
|
|
55
|
+
|
|
52
56
|
def wrap_anthropic():
|
|
53
|
-
logger.warning(
|
|
54
|
-
|
|
57
|
+
logger.warning(
|
|
58
|
+
"Anthropic support not available. Install Anthropic to use this feature."
|
|
59
|
+
)
|
|
60
|
+
|
|
55
61
|
# Lazily set up OpenAI wrapper if available
|
|
56
62
|
try:
|
|
57
63
|
from .adapters import openai
|
|
64
|
+
|
|
58
65
|
wrap_openai = openai.wrap_openai
|
|
59
66
|
# Apply the wrapper, but don't fail if it doesn't work
|
|
60
67
|
try:
|
|
@@ -62,12 +69,16 @@ def _import_modules():
|
|
|
62
69
|
except Exception as e:
|
|
63
70
|
logger.warning(f"Failed to wrap OpenAI: {str(e)}")
|
|
64
71
|
except ImportError:
|
|
72
|
+
|
|
65
73
|
def wrap_openai():
|
|
66
|
-
logger.warning(
|
|
67
|
-
|
|
74
|
+
logger.warning(
|
|
75
|
+
"OpenAI support not available. Install OpenAI to use this feature."
|
|
76
|
+
)
|
|
77
|
+
|
|
68
78
|
# Lazily set up LangChain wrapper if available
|
|
69
79
|
try:
|
|
70
80
|
from .adapters import langchain
|
|
81
|
+
|
|
71
82
|
wrap_langchain = langchain.wrap_langchain
|
|
72
83
|
# Apply the wrapper, but don't fail if it doesn't work
|
|
73
84
|
try:
|
|
@@ -75,12 +86,16 @@ def _import_modules():
|
|
|
75
86
|
except Exception as e:
|
|
76
87
|
logger.warning(f"Failed to wrap LangChain: {str(e)}")
|
|
77
88
|
except ImportError:
|
|
89
|
+
|
|
78
90
|
def wrap_langchain():
|
|
79
|
-
logger.warning(
|
|
80
|
-
|
|
91
|
+
logger.warning(
|
|
92
|
+
"LangChain support not available. Install LangChain to use this feature."
|
|
93
|
+
)
|
|
94
|
+
|
|
81
95
|
# Lazily set up LangChain-OpenAI wrapper if available
|
|
82
96
|
try:
|
|
83
97
|
from .adapters import langchain_openai
|
|
98
|
+
|
|
84
99
|
wrap_langchain_openai = langchain_openai.wrap_langchain_openai
|
|
85
100
|
# Apply the wrapper, but don't fail if it doesn't work
|
|
86
101
|
try:
|
|
@@ -88,12 +103,16 @@ def _import_modules():
|
|
|
88
103
|
except Exception as e:
|
|
89
104
|
logger.warning(f"Failed to wrap LangChain-OpenAI: {str(e)}")
|
|
90
105
|
except ImportError:
|
|
106
|
+
|
|
91
107
|
def wrap_langchain_openai():
|
|
92
|
-
logger.warning(
|
|
93
|
-
|
|
108
|
+
logger.warning(
|
|
109
|
+
"LangChain-OpenAI support not available. Install LangChain and OpenAI to use this feature."
|
|
110
|
+
)
|
|
111
|
+
|
|
94
112
|
# Lazily set up LangChain-Anthropic wrapper if available
|
|
95
113
|
try:
|
|
96
114
|
from .adapters import langchain_anthropic
|
|
115
|
+
|
|
97
116
|
wrap_langchain_anthropic = langchain_anthropic.wrap_langchain_anthropic
|
|
98
117
|
# Apply the wrapper, but don't fail if it doesn't work
|
|
99
118
|
try:
|
|
@@ -101,10 +120,15 @@ def _import_modules():
|
|
|
101
120
|
except Exception as e:
|
|
102
121
|
logger.warning(f"Failed to wrap LangChain-Anthropic: {str(e)}")
|
|
103
122
|
except ImportError:
|
|
123
|
+
|
|
104
124
|
def wrap_langchain_anthropic():
|
|
105
|
-
logger.warning(
|
|
125
|
+
logger.warning(
|
|
126
|
+
"LangChain-Anthropic support not available. Install LangChain and Anthropic to use this feature."
|
|
127
|
+
)
|
|
128
|
+
|
|
106
129
|
|
|
107
130
|
# Initialize the module on first import, but not during installation
|
|
108
131
|
import sys
|
|
109
|
-
|
|
110
|
-
|
|
132
|
+
|
|
133
|
+
if "pip" not in sys.modules:
|
|
134
|
+
_import_modules()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Adapters package for Osmosis
|
|
2
|
+
Adapters package for Osmosis
|
|
3
3
|
|
|
4
4
|
This package contains various adapters for different LLM providers.
|
|
5
5
|
Each adapter is conditionally imported based on installed dependencies.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
# Don't include adapters in __all__ as they're imported conditionally
|
|
9
|
-
__all__ = []
|
|
9
|
+
__all__ = []
|