osmosis-ai 0.1.5__py3-none-any.whl → 0.1.7__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/consts.py CHANGED
@@ -2,15 +2,16 @@ from enum import Enum
2
2
 
3
3
  # Extract package metadata
4
4
  package_name = "osmosis-ai"
5
- package_version = "0.1.5"
5
+ package_version = "0.1.7"
6
6
 
7
7
  indent = 2 # Number of spaces to use for indentation in pretty print
8
- osmosis_api_url = "https://ftgrv77m9f.execute-api.us-west-2.amazonaws.com/prod"
8
+ osmosis_api_url = "https://osmosis.gulp.dev"
9
9
 
10
10
  DEFAULT_LOG_DESTINATION = "none" # "none" or "stdout" or "stderr" or "file"
11
11
 
12
+
12
13
  class LogDestination(Enum):
13
14
  NONE = "none"
14
15
  STDOUT = "stdout"
15
16
  STDERR = "stderr"
16
- FILE = "file"
17
+ FILE = "file"
osmosis_ai/logger.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """
2
- Logging utilities for Osmosis Wrap
2
+ Logging utilities for Osmosis
3
3
  """
4
4
 
5
5
  import sys
@@ -8,7 +8,7 @@ import os
8
8
  from .consts import LogDestination, DEFAULT_LOG_DESTINATION
9
9
 
10
10
  # Create logger
11
- logger = logging.getLogger('osmosis_ai')
11
+ logger = logging.getLogger("osmosis_ai")
12
12
  logger.setLevel(logging.INFO)
13
13
 
14
14
  # Default configuration - no logging
@@ -18,6 +18,7 @@ logger.propagate = False
18
18
  log_destination = DEFAULT_LOG_DESTINATION
19
19
  logger.log_destination = log_destination
20
20
 
21
+
21
22
  def set_log_destination(destination: LogDestination) -> None:
22
23
  """
23
24
  Set the log destination for the logger
@@ -26,6 +27,7 @@ def set_log_destination(destination: LogDestination) -> None:
26
27
  log_destination = destination
27
28
  logger.log_destination = destination
28
29
 
30
+
29
31
  def configure_logger() -> None:
30
32
  """
31
33
  Configure the logger based on the log_destination setting in consts.py
@@ -33,7 +35,7 @@ def configure_logger() -> None:
33
35
  # Remove any existing handlers
34
36
  for handler in logger.handlers[:]:
35
37
  logger.removeHandler(handler)
36
-
38
+
37
39
  # Configure based on log_destination
38
40
  if log_destination == "none":
39
41
  # No logging
@@ -54,18 +56,22 @@ def configure_logger() -> None:
54
56
  handler = logging.StreamHandler(sys.stderr)
55
57
  logger.addHandler(handler)
56
58
  logger.warning(f"Invalid log_destination: {log_destination}, using stderr")
57
-
59
+
58
60
  # Set formatter
59
- formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
61
+ formatter = logging.Formatter(
62
+ "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
63
+ )
60
64
  for handler in logger.handlers:
61
65
  handler.setFormatter(formatter)
62
66
 
67
+
63
68
  # Initialize the logger on module import
64
69
  configure_logger()
65
70
 
71
+
66
72
  # Function to force reconfiguration if log_destination is changed
67
73
  def reconfigure_logger() -> None:
68
74
  """
69
75
  Reconfigure the logger, should be called if log_destination changes
70
76
  """
71
- configure_logger()
77
+ configure_logger()
osmosis_ai/utils.py CHANGED
@@ -1,13 +1,15 @@
1
1
  """
2
- Utility functions for Osmosis Wrap adapters
2
+ Utility functions for osmosisadapters
3
3
  """
4
4
 
5
5
  import json
6
6
  from datetime import datetime, timezone
7
7
  from typing import Any, Dict
8
8
  import xxhash
9
+
9
10
  # Import constants
10
11
  from .consts import osmosis_api_url
12
+
11
13
  # Import logger
12
14
  from .logger import logger
13
15
 
@@ -16,10 +18,11 @@ enabled = True
16
18
  osmosis_api_key = None # Will be set by init()
17
19
  _initialized = False
18
20
 
21
+
19
22
  def init(api_key: str) -> None:
20
23
  """
21
- Initialize Osmosis Wrap with the OSMOSIS API key.
22
-
24
+ Initialize osmosiswith the OSMOSIS API key.
25
+
23
26
  Args:
24
27
  api_key: The OSMOSIS API key for logging LLM usage
25
28
  """
@@ -27,18 +30,23 @@ def init(api_key: str) -> None:
27
30
  osmosis_api_key = api_key
28
31
  _initialized = True
29
32
 
33
+
30
34
  def disable_osmosis() -> None:
31
35
  global enabled
32
36
  enabled = False
33
37
 
38
+
34
39
  def enable_osmosis() -> None:
35
40
  global enabled
36
41
  enabled = True
37
42
 
38
- def send_to_osmosis(query: Dict[str, Any], response: Dict[str, Any], status: int = 200) -> None:
43
+
44
+ def send_to_osmosis(
45
+ query: Dict[str, Any], response: Dict[str, Any], status: int = 200
46
+ ) -> None:
39
47
  """
40
48
  Send query and response data to the OSMOSIS API using AWS Firehose.
41
-
49
+
42
50
  Args:
43
51
  query: The query/request data
44
52
  response: The response data
@@ -48,41 +56,42 @@ def send_to_osmosis(query: Dict[str, Any], response: Dict[str, Any], status: int
48
56
  return
49
57
 
50
58
  if not _initialized:
51
- logger.warning("Osmosis Wrap not initialized. Call osmosis_ai.init(api_key) first.")
59
+ logger.warning("osmosisnot initialized. Call osmosis_ai.init(api_key) first.")
52
60
  return
53
61
 
54
62
  try:
55
63
  # Import requests only when needed
56
64
  import requests
57
-
65
+
58
66
  # Create headers
59
- headers = {
60
- "Content-Type": "application/json",
61
- "x-api-key": osmosis_api_key
62
- }
63
-
67
+ headers = {"Content-Type": "application/json", "x-api-key": osmosis_api_key}
68
+
64
69
  # Prepare main data payload
65
70
  data = {
66
- "owner": xxhash.xxh32(osmosis_api_key.encode('utf-8')).hexdigest(),
71
+ "owner": xxhash.xxh32(osmosis_api_key.encode("utf-8")).hexdigest(),
67
72
  "date": int(datetime.now(timezone.utc).timestamp()),
68
73
  "query": query,
69
74
  "response": response,
70
- "status": status
75
+ "status": status,
71
76
  }
72
77
 
73
78
  logger.info(f"Sending data to OSMOSIS API: {data}")
74
-
79
+
75
80
  # Send main data payload
76
81
  response_data = requests.post(
77
- f"{osmosis_api_url}/data",
82
+ f"{osmosis_api_url}/ingest",
78
83
  headers=headers,
79
- data=json.dumps(data).replace('\n', '') + '\n'
84
+ data=json.dumps(data).replace("\n", "") + "\n",
80
85
  )
81
-
86
+
82
87
  if response_data.status_code != 200:
83
- logger.warning(f"OSMOSIS API returned status {response_data.status_code} for data")
84
-
88
+ logger.warning(
89
+ f"OSMOSIS API returned status {response_data.status_code} for data with error: {response_data.text}"
90
+ )
91
+
85
92
  except ImportError:
86
- logger.warning("Requests library not installed. Please install it with 'pip install requests'.")
93
+ logger.warning(
94
+ "Requests library not installed. Please install it with 'pip install requests'."
95
+ )
87
96
  except Exception as e:
88
- logger.warning(f"Failed to send data to OSMOSIS API: {str(e)}")
97
+ logger.warning(f"Failed to send data to OSMOSIS API: {str(e)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osmosis-ai
3
- Version: 0.1.5
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-ai
28
- Project-URL: Issues, https://github.com/Gulp-AI/osmosis-ai/issues
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
- [![Run Tests](https://github.com/Gulp-AI/osmosis-ai/actions/workflows/test.yml/badge.svg)](https://github.com/Gulp-AI/osmosis-ai/actions/workflows/test.yml)
60
+ [![Run Tests](https://github.com/Gulp-AI/osmosis-sdk-python/actions/workflows/test.yml/badge.svg)](https://github.com/Gulp-AI/osmosis-sdk-python/actions/workflows/test.yml)
61
61
 
62
- # Osmosis Wrap
62
+ # Osmosis
63
63
 
64
- A Python library that monkey patches LLM client libraries to send all prompts and responses to the OSMOSIS API for logging and monitoring.
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-ai.git
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
- Osmosis Wrap requires a OSMOSIS API key to log LLM usage. Create a `.env` file in your project directory:
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 Osmosis Wrap with your OSMOSIS API key:
131
+ First, import and initialize osmosiswith your OSMOSIS API key:
132
132
 
133
133
  ```python
134
134
  import os
@@ -0,0 +1,15 @@
1
+ osmosis_ai/__init__.py,sha256=esOnyFqlu7-AKuxTV5fkLVb34-kvCReMEDFkFpxBH7M,4374
2
+ osmosis_ai/consts.py,sha256=1HavvPFM9nJCDqy1RK7VH_g9MbAgXNyBqN8Rt3FAeDE,408
3
+ osmosis_ai/logger.py,sha256=J2Yw_QMGqXySzJlj_QQqHLs52S1oKYXoELnU66YCAuI,2170
4
+ osmosis_ai/utils.py,sha256=pJDJTO1ov0Nyyj6UMbPGZIAPyoF-wY9QM3hYoxtIuo4,2490
5
+ osmosis_ai/adapters/__init__.py,sha256=MlS3aGG8AQqQUQlV196sPdChTvfenK6ZdSaP0Tsr8eQ,262
6
+ osmosis_ai/adapters/anthropic.py,sha256=Q9pb_AxgaSTyjNYkGGZL5mslyVnfTbGI04WbxLDhvLA,22959
7
+ osmosis_ai/adapters/langchain.py,sha256=oVIIRmpdadgozoysJBxoJsTVwJcjrtoA63SjRchXr9E,27673
8
+ osmosis_ai/adapters/langchain_anthropic.py,sha256=qWtcNAQ3tQpJfTttV9y5mMCkPujuRodoFkaoYx9pOW8,14557
9
+ osmosis_ai/adapters/langchain_openai.py,sha256=8sq4vGSqm96-UjeeiW0ZGWMOUXiv85A1BLGwaeboBF8,24815
10
+ osmosis_ai/adapters/openai.py,sha256=B-dNQvA8XcmX4kB5ZZGf4EoS_VAVZPo3aTfem_xe-8I,39437
11
+ osmosis_ai-0.1.7.dist-info/licenses/LICENSE,sha256=WLvxAm2-fPuT8qECE6ejD8ezG9btIanJl7zysXvtQgM,1064
12
+ osmosis_ai-0.1.7.dist-info/METADATA,sha256=wVZ0LQAJIfGKinOoQrgCUKwCOf667InqQxOYIWBBv_Q,9255
13
+ osmosis_ai-0.1.7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
14
+ osmosis_ai-0.1.7.dist-info/top_level.txt,sha256=UPNRTKIBSrxsJVNxwXnLCqSoBS4bAiL_3jMtjvf5zEY,11
15
+ osmosis_ai-0.1.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,15 +0,0 @@
1
- osmosis_ai/__init__.py,sha256=nQJwkT7efmsSQ0ydygcH1OUW8y2rKxHCnwKD-Br51Co,4266
2
- osmosis_ai/consts.py,sha256=X47sKF5fDss23UIJJwwlIsP-Py78afwiqOcxDJPKiYQ,441
3
- osmosis_ai/logger.py,sha256=bUok07WG2vaY0lDdEnn_JM_rI_UaRu3PcidVKaTZpPA,2165
4
- osmosis_ai/utils.py,sha256=A0A2kcPc2os7QRLMHFyXjdhOzszRsAoHhwqWhtpETFY,2488
5
- osmosis_ai/adapters/__init__.py,sha256=Lq9r0h-jwKoZy2iabwUxpbwlf6ybobRRpbGi6NfeX7U,267
6
- osmosis_ai/adapters/anthropic.py,sha256=ans7rYdtlgXtjcbGNyuLIST18gQKfU1l4kghD9E3ugM,21801
7
- osmosis_ai/adapters/langchain.py,sha256=0AF6S7he-XBfjaYq2J8e-Zn_X2wT0P2YsoEi8pmyqKU,26402
8
- osmosis_ai/adapters/langchain_anthropic.py,sha256=IQ3uhn-3mgvK3ln4kqR_3OyPaI_10X6WFRgoiebuN_4,13355
9
- osmosis_ai/adapters/langchain_openai.py,sha256=8VctxATCHi6M2jy3JtLOWez9jww1bMXg4t8A1c78oTk,22913
10
- osmosis_ai/adapters/openai.py,sha256=E036slghKoe80futj8wsLY2exDjbwgtTxpnR3UCgfRY,38625
11
- osmosis_ai-0.1.5.dist-info/licenses/LICENSE,sha256=WLvxAm2-fPuT8qECE6ejD8ezG9btIanJl7zysXvtQgM,1064
12
- osmosis_ai-0.1.5.dist-info/METADATA,sha256=rd9ObQ2l-RgCU_hnQhiFdRN_Ec2l36BF19aF706Roh4,9232
13
- osmosis_ai-0.1.5.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
14
- osmosis_ai-0.1.5.dist-info/top_level.txt,sha256=UPNRTKIBSrxsJVNxwXnLCqSoBS4bAiL_3jMtjvf5zEY,11
15
- osmosis_ai-0.1.5.dist-info/RECORD,,