edgee 1.0.0__py3-none-any.whl → 1.0.1__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.
edgee/__init__.py CHANGED
@@ -45,6 +45,13 @@ class InputObject:
45
45
  messages: list[dict]
46
46
  tools: list[dict] | None = None
47
47
  tool_choice: str | dict | None = None
48
+ tags: list[str] | None = None
49
+ enable_compression: bool | None = (
50
+ None # Enable token compression (gateway-internal, not sent to providers)
51
+ )
52
+ compression_rate: float | None = (
53
+ None # Compression rate 0.0-1.0 (gateway-internal, not sent to providers)
54
+ )
48
55
 
49
56
 
50
57
  @dataclass
@@ -61,10 +68,18 @@ class Usage:
61
68
  total_tokens: int
62
69
 
63
70
 
71
+ @dataclass
72
+ class Compression:
73
+ input_tokens: int
74
+ saved_tokens: int
75
+ rate: float
76
+
77
+
64
78
  @dataclass
65
79
  class SendResponse:
66
80
  choices: list[Choice]
67
81
  usage: Usage | None = None
82
+ compression: Compression | None = None
68
83
 
69
84
  @property
70
85
  def text(self) -> str | None:
@@ -188,14 +203,23 @@ class Edgee:
188
203
  messages = [{"role": "user", "content": input}]
189
204
  tools = None
190
205
  tool_choice = None
206
+ tags = None
207
+ enable_compression = None
208
+ compression_rate = None
191
209
  elif isinstance(input, InputObject):
192
210
  messages = input.messages
193
211
  tools = input.tools
194
212
  tool_choice = input.tool_choice
213
+ tags = input.tags
214
+ enable_compression = input.enable_compression
215
+ compression_rate = input.compression_rate
195
216
  else:
196
217
  messages = input.get("messages", [])
197
218
  tools = input.get("tools")
198
219
  tool_choice = input.get("tool_choice")
220
+ tags = input.get("tags")
221
+ enable_compression = input.get("enable_compression")
222
+ compression_rate = input.get("compression_rate")
199
223
 
200
224
  body: dict = {"model": model, "messages": messages}
201
225
  if stream:
@@ -204,6 +228,12 @@ class Edgee:
204
228
  body["tools"] = tools
205
229
  if tool_choice:
206
230
  body["tool_choice"] = tool_choice
231
+ if tags:
232
+ body["tags"] = tags
233
+ if enable_compression is not None:
234
+ body["enable_compression"] = enable_compression
235
+ if compression_rate is not None:
236
+ body["compression_rate"] = compression_rate
207
237
 
208
238
  request = Request(
209
239
  f"{self.base_url}{API_ENDPOINT}",
@@ -246,7 +276,15 @@ class Edgee:
246
276
  total_tokens=data["usage"]["total_tokens"],
247
277
  )
248
278
 
249
- return SendResponse(choices=choices, usage=usage)
279
+ compression = None
280
+ if "compression" in data:
281
+ compression = Compression(
282
+ input_tokens=data["compression"]["input_tokens"],
283
+ saved_tokens=data["compression"]["saved_tokens"],
284
+ rate=data["compression"]["rate"],
285
+ )
286
+
287
+ return SendResponse(choices=choices, usage=usage, compression=compression)
250
288
 
251
289
  def _handle_streaming_response(self, request: Request):
252
290
  """Handle streaming response, yielding StreamChunk objects."""
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edgee
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Lightweight Python SDK for Edgee AI Gateway
5
- Project-URL: Homepage, https://github.com/edgee-cloud/python-sdk
6
- Project-URL: Repository, https://github.com/edgee-cloud/python-sdk
7
- Author-email: Edgee <support@edgee.cloud>
5
+ Project-URL: Homepage, https://github.com/edgee-ai/python-sdk
6
+ Project-URL: Repository, https://github.com/edgee-ai/python-sdk
7
+ Author-email: Edgee <support@edgee.ai>
8
8
  License-Expression: Apache-2.0
9
9
  License-File: LICENSE
10
10
  Keywords: ai,anthropic,gateway,llm,openai
@@ -24,7 +24,7 @@ Description-Content-Type: text/markdown
24
24
 
25
25
  # Edgee Python SDK
26
26
 
27
- Lightweight, type-safe Python SDK for the [Edgee AI Gateway](https://www.edgee.cloud).
27
+ Lightweight, type-safe Python SDK for the [Edgee AI Gateway](https://www.edgee.ai).
28
28
 
29
29
  [![PyPI version](https://img.shields.io/pypi/v/edgee.svg)]( )
30
30
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
@@ -66,6 +66,15 @@ response = edgee.send(
66
66
  print(response.text) # Text content
67
67
  print(response.finish_reason) # Finish reason
68
68
  print(response.tool_calls) # Tool calls (if any)
69
+
70
+ # Access usage and compression info
71
+ if response.usage:
72
+ print(f"Tokens used: {response.usage.total_tokens}")
73
+
74
+ if response.compression:
75
+ print(f"Input tokens: {response.compression.input_tokens}")
76
+ print(f"Saved tokens: {response.compression.saved_tokens}")
77
+ print(f"Compression rate: {response.compression.rate}")
69
78
  ```
70
79
 
71
80
  ## Stream Method
@@ -88,19 +97,20 @@ for chunk in edgee.stream("gpt-4o", "Tell me a story"):
88
97
  - ✅ **Streaming** - Real-time response streaming with generators
89
98
  - ✅ **Tool calling** - Full support for function calling
90
99
  - ✅ **Flexible input** - Accept strings, dicts, or InputObject
100
+ - ✅ **Compression info** - Access token compression metrics in responses
91
101
  - ✅ **Zero dependencies** - Uses only Python standard library
92
102
 
93
103
  ## Documentation
94
104
 
95
105
  For complete documentation, examples, and API reference, visit:
96
106
 
97
- **👉 [Official Python SDK Documentation](https://www.edgee.cloud/docs/sdk/python)**
107
+ **👉 [Official Python SDK Documentation](https://www.edgee.ai/docs/sdk/python)**
98
108
 
99
109
  The documentation includes:
100
- - [Configuration guide](https://www.edgee.cloud/docs/sdk/python/configuration) - Multiple ways to configure the SDK
101
- - [Send method](https://www.edgee.cloud/docs/sdk/python/send) - Complete guide to non-streaming requests
102
- - [Stream method](https://www.edgee.cloud/docs/sdk/python/stream) - Streaming responses guide
103
- - [Tools](https://www.edgee.cloud/docs/sdk/python/tools) - Function calling guide
110
+ - [Configuration guide](https://www.edgee.ai/docs/sdk/python/configuration) - Multiple ways to configure the SDK
111
+ - [Send method](https://www.edgee.ai/docs/sdk/python/send) - Complete guide to non-streaming requests
112
+ - [Stream method](https://www.edgee.ai/docs/sdk/python/stream) - Streaming responses guide
113
+ - [Tools](https://www.edgee.ai/docs/sdk/python/tools) - Function calling guide
104
114
 
105
115
  ## License
106
116
 
@@ -0,0 +1,6 @@
1
+ edgee/__init__.py,sha256=kokFp3wCXmib5e_HvE2KkE8gmRYyrqubyJGGGNWUz54,10700
2
+ edgee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ edgee-1.0.1.dist-info/METADATA,sha256=b9A9YRZrdQlHbmQNeHR_c-0afAwYrmhCrnoXsRIkXZA,3622
4
+ edgee-1.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
+ edgee-1.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
+ edgee-1.0.1.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- edgee/__init__.py,sha256=RZLLPbFiWAObCugQy8TZ7FXOO2uMjSEyhxuw61btXbs,9300
2
- edgee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- edgee-1.0.0.dist-info/METADATA,sha256=ezHz8hxvm_o4i87jCKobLr6HBH7FN8LjS6_h_7Te2l8,3247
4
- edgee-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
- edgee-1.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
- edgee-1.0.0.dist-info/RECORD,,
File without changes