lemonade-python-sdk 1.0.3__tar.gz → 1.0.5__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.
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/PKG-INFO +23 -4
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/README.md +20 -1
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/PKG-INFO +23 -4
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/client.py +24 -4
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/setup.py +3 -3
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/LICENSE +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/SOURCES.txt +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/dependency_links.txt +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/requires.txt +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/top_level.txt +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/__init__.py +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/audio_stream.py +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/model_discovery.py +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/port_scanner.py +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/request_builder.py +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_sdk/utils.py +0 -0
- {lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/setup.cfg +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lemonade-python-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: A clean interface for interacting with the Lemonade LLM server
|
|
5
5
|
Home-page: https://github.com/Tetramatrix/lemonade-python-sdk
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
6
|
+
Author: Tetramatrix
|
|
7
|
+
Author-email: contact@tetramatrix.dev
|
|
8
8
|
Project-URL: Bug Reports, https://github.com/Tetramatrix/lemonade-python-sdk/issues
|
|
9
9
|
Project-URL: Source, https://github.com/Tetramatrix/lemonade-python-sdk
|
|
10
10
|
Keywords: llm,ai,lemonade,sdk,api
|
|
@@ -52,7 +52,7 @@ This SDK provides a clean, pythonic interface for interacting with local LLMs ru
|
|
|
52
52
|
|
|
53
53
|
* **Auto-Discovery:** Automatically scans multiple ports and hosts to find active Lemonade instances.
|
|
54
54
|
* **Low-Overhead Architecture:** Designed as a thin, efficient wrapper to leverage Lemonade's C++ performance with minimal Python latency.
|
|
55
|
-
* **Health Checks &
|
|
55
|
+
* **Health Checks & Server Stats:** Lightweight `/api/v1/health` endpoint plus `get_stats()` for token usage, requests served, and performance metrics.
|
|
56
56
|
* **Type-Safe Client:** Full Python type hinting for better developer experience (IDE autocompletion).
|
|
57
57
|
* **Model Management:** Simple API to load, unload, and list models dynamically.
|
|
58
58
|
* **Embeddings API:** Generate text embeddings for semantic search, RAG, and clustering (FLM & llamacpp backends).
|
|
@@ -92,6 +92,25 @@ else:
|
|
|
92
92
|
print("No Lemonade instance found.")
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
### 1.1 Health Check & Stats
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
# Check if server is alive (uses /api/v1/health endpoint)
|
|
99
|
+
if client.health_check():
|
|
100
|
+
print("Lemonade is running!")
|
|
101
|
+
|
|
102
|
+
# Get server statistics (performance metrics from last request)
|
|
103
|
+
stats = client.get_stats()
|
|
104
|
+
if stats:
|
|
105
|
+
print(f"Time to first token: {stats.get('time_to_first_token', 0):.2f}s")
|
|
106
|
+
print(f"Tokens/sec: {stats.get('tokens_per_second', 0):.1f}")
|
|
107
|
+
print(f"Input tokens: {stats.get('input_tokens', 0)}")
|
|
108
|
+
print(f"Output tokens: {stats.get('output_tokens', 0)}")
|
|
109
|
+
print(f"Prompt tokens: {stats.get('prompt_tokens', 0)}")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Available stats fields:** `time_to_first_token`, `tokens_per_second`, `input_tokens`, `output_tokens`, `decode_token_times`, `prompt_tokens`.
|
|
113
|
+
|
|
95
114
|
### 2. Chat Completion
|
|
96
115
|
|
|
97
116
|
```python
|
|
@@ -11,7 +11,7 @@ This SDK provides a clean, pythonic interface for interacting with local LLMs ru
|
|
|
11
11
|
|
|
12
12
|
* **Auto-Discovery:** Automatically scans multiple ports and hosts to find active Lemonade instances.
|
|
13
13
|
* **Low-Overhead Architecture:** Designed as a thin, efficient wrapper to leverage Lemonade's C++ performance with minimal Python latency.
|
|
14
|
-
* **Health Checks &
|
|
14
|
+
* **Health Checks & Server Stats:** Lightweight `/api/v1/health` endpoint plus `get_stats()` for token usage, requests served, and performance metrics.
|
|
15
15
|
* **Type-Safe Client:** Full Python type hinting for better developer experience (IDE autocompletion).
|
|
16
16
|
* **Model Management:** Simple API to load, unload, and list models dynamically.
|
|
17
17
|
* **Embeddings API:** Generate text embeddings for semantic search, RAG, and clustering (FLM & llamacpp backends).
|
|
@@ -51,6 +51,25 @@ else:
|
|
|
51
51
|
print("No Lemonade instance found.")
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
### 1.1 Health Check & Stats
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# Check if server is alive (uses /api/v1/health endpoint)
|
|
58
|
+
if client.health_check():
|
|
59
|
+
print("Lemonade is running!")
|
|
60
|
+
|
|
61
|
+
# Get server statistics (performance metrics from last request)
|
|
62
|
+
stats = client.get_stats()
|
|
63
|
+
if stats:
|
|
64
|
+
print(f"Time to first token: {stats.get('time_to_first_token', 0):.2f}s")
|
|
65
|
+
print(f"Tokens/sec: {stats.get('tokens_per_second', 0):.1f}")
|
|
66
|
+
print(f"Input tokens: {stats.get('input_tokens', 0)}")
|
|
67
|
+
print(f"Output tokens: {stats.get('output_tokens', 0)}")
|
|
68
|
+
print(f"Prompt tokens: {stats.get('prompt_tokens', 0)}")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Available stats fields:** `time_to_first_token`, `tokens_per_second`, `input_tokens`, `output_tokens`, `decode_token_times`, `prompt_tokens`.
|
|
72
|
+
|
|
54
73
|
### 2. Chat Completion
|
|
55
74
|
|
|
56
75
|
```python
|
{lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/PKG-INFO
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lemonade-python-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: A clean interface for interacting with the Lemonade LLM server
|
|
5
5
|
Home-page: https://github.com/Tetramatrix/lemonade-python-sdk
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
6
|
+
Author: Tetramatrix
|
|
7
|
+
Author-email: contact@tetramatrix.dev
|
|
8
8
|
Project-URL: Bug Reports, https://github.com/Tetramatrix/lemonade-python-sdk/issues
|
|
9
9
|
Project-URL: Source, https://github.com/Tetramatrix/lemonade-python-sdk
|
|
10
10
|
Keywords: llm,ai,lemonade,sdk,api
|
|
@@ -52,7 +52,7 @@ This SDK provides a clean, pythonic interface for interacting with local LLMs ru
|
|
|
52
52
|
|
|
53
53
|
* **Auto-Discovery:** Automatically scans multiple ports and hosts to find active Lemonade instances.
|
|
54
54
|
* **Low-Overhead Architecture:** Designed as a thin, efficient wrapper to leverage Lemonade's C++ performance with minimal Python latency.
|
|
55
|
-
* **Health Checks &
|
|
55
|
+
* **Health Checks & Server Stats:** Lightweight `/api/v1/health` endpoint plus `get_stats()` for token usage, requests served, and performance metrics.
|
|
56
56
|
* **Type-Safe Client:** Full Python type hinting for better developer experience (IDE autocompletion).
|
|
57
57
|
* **Model Management:** Simple API to load, unload, and list models dynamically.
|
|
58
58
|
* **Embeddings API:** Generate text embeddings for semantic search, RAG, and clustering (FLM & llamacpp backends).
|
|
@@ -92,6 +92,25 @@ else:
|
|
|
92
92
|
print("No Lemonade instance found.")
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
### 1.1 Health Check & Stats
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
# Check if server is alive (uses /api/v1/health endpoint)
|
|
99
|
+
if client.health_check():
|
|
100
|
+
print("Lemonade is running!")
|
|
101
|
+
|
|
102
|
+
# Get server statistics (performance metrics from last request)
|
|
103
|
+
stats = client.get_stats()
|
|
104
|
+
if stats:
|
|
105
|
+
print(f"Time to first token: {stats.get('time_to_first_token', 0):.2f}s")
|
|
106
|
+
print(f"Tokens/sec: {stats.get('tokens_per_second', 0):.1f}")
|
|
107
|
+
print(f"Input tokens: {stats.get('input_tokens', 0)}")
|
|
108
|
+
print(f"Output tokens: {stats.get('output_tokens', 0)}")
|
|
109
|
+
print(f"Prompt tokens: {stats.get('prompt_tokens', 0)}")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Available stats fields:** `time_to_first_token`, `tokens_per_second`, `input_tokens`, `output_tokens`, `decode_token_times`, `prompt_tokens`.
|
|
113
|
+
|
|
95
114
|
### 2. Chat Completion
|
|
96
115
|
|
|
97
116
|
```python
|
|
@@ -79,11 +79,31 @@ class LemonadeClient:
|
|
|
79
79
|
bool: True if the server is reachable, otherwise False
|
|
80
80
|
"""
|
|
81
81
|
try:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
url = f"{self.base_url}/api/v1/health"
|
|
83
|
+
response = self.session.get(url, timeout=10)
|
|
84
|
+
return response.status_code == 200
|
|
85
|
+
except Exception:
|
|
85
86
|
return False
|
|
86
|
-
|
|
87
|
+
|
|
88
|
+
def get_stats(self) -> Dict[str, Any]:
|
|
89
|
+
"""
|
|
90
|
+
Retrieves server statistics including token usage, requests served, and performance metrics.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Dict[str, Any]: Server stats with token counts, tokens_per_second, etc.
|
|
94
|
+
"""
|
|
95
|
+
url = f"{self.base_url}/api/v1/stats"
|
|
96
|
+
try:
|
|
97
|
+
response = self.session.get(url, timeout=10)
|
|
98
|
+
response.raise_for_status()
|
|
99
|
+
return response.json()
|
|
100
|
+
except requests.exceptions.RequestException as e:
|
|
101
|
+
print(f"Error retrieving stats: {e}")
|
|
102
|
+
return {}
|
|
103
|
+
except json.JSONDecodeError as e:
|
|
104
|
+
print(f"Error parsing stats response: {e}")
|
|
105
|
+
return {}
|
|
106
|
+
|
|
87
107
|
def get_current_model(self) -> Optional[str]:
|
|
88
108
|
"""
|
|
89
109
|
Retrieves the currently active model from the Lemonade server.
|
|
@@ -13,9 +13,9 @@ with open("LICENSE", "r", encoding="utf-8") as fh:
|
|
|
13
13
|
|
|
14
14
|
setup(
|
|
15
15
|
name="lemonade-python-sdk",
|
|
16
|
-
version="1.0.
|
|
17
|
-
author="
|
|
18
|
-
author_email="
|
|
16
|
+
version="1.0.5",
|
|
17
|
+
author="Tetramatrix",
|
|
18
|
+
author_email="contact@tetramatrix.dev",
|
|
19
19
|
description="A clean interface for interacting with the Lemonade LLM server",
|
|
20
20
|
long_description=long_description,
|
|
21
21
|
long_description_content_type="text/markdown",
|
|
File without changes
|
{lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{lemonade_python_sdk-1.0.3 → lemonade_python_sdk-1.0.5}/lemonade_python_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|