nebu 0.1.31__py3-none-any.whl → 0.1.32__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.
nebu/chatx/convert.py CHANGED
@@ -7,6 +7,11 @@ from typing import Any, Dict, List, Tuple
7
7
  import requests
8
8
  from PIL import Image, UnidentifiedImageError
9
9
 
10
+ # Define a standard User-Agent header
11
+ REQUESTS_HEADERS = {
12
+ "User-Agent": "Nebulous-py/0.1 (https://github.com/agentsea/nebulous-py; contact@agentsea.ai)"
13
+ }
14
+
10
15
 
11
16
  def convert_to_unsloth_inference(
12
17
  old_schema: List[Dict[str, Any]],
@@ -63,7 +68,7 @@ def convert_to_unsloth_inference(
63
68
  # Convert each URL into a PIL image
64
69
  for url in image_urls:
65
70
  # Download the image
66
- response = requests.get(url)
71
+ response = requests.get(url, headers=REQUESTS_HEADERS)
67
72
  response.raise_for_status()
68
73
  image_data = BytesIO(response.content)
69
74
  pil_img = Image.open(image_data).convert("RGB")
@@ -199,7 +204,11 @@ def oai_to_unsloth(
199
204
  try:
200
205
  if image_url_to_load.startswith(("http://", "https://")):
201
206
  # Handle URL
202
- response = requests.get(image_url_to_load, stream=True)
207
+ response = requests.get(
208
+ image_url_to_load,
209
+ stream=True,
210
+ headers=REQUESTS_HEADERS,
211
+ )
203
212
  response.raise_for_status() # Raise an exception for bad status codes
204
213
  pil_image = Image.open(response.raw)
205
214
  else: # Assume base64
@@ -252,7 +261,9 @@ def oai_to_unsloth(
252
261
  try:
253
262
  if image_url_top_level.startswith(("http://", "https://")):
254
263
  # Handle URL
255
- response = requests.get(image_url_top_level, stream=True)
264
+ response = requests.get(
265
+ image_url_top_level, stream=True, headers=REQUESTS_HEADERS
266
+ )
256
267
  response.raise_for_status() # Raise an exception for bad status codes
257
268
  pil_image = Image.open(response.raw)
258
269
  else:
@@ -479,6 +479,7 @@ while True:
479
479
  # Read from stream with blocking
480
480
  streams = {REDIS_STREAM: ">"} # '>' means read only new messages
481
481
  # The type checker still struggles here, but the runtime types are asserted.
482
+ print("reading from stream...")
482
483
  messages = r.xreadgroup( # type: ignore[arg-type]
483
484
  REDIS_CONSUMER_GROUP, consumer_name, streams, count=1, block=5000
484
485
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -5,13 +5,13 @@ nebu/cache.py,sha256=1aY1plIXWOPmUY6GGq_s_QDXzIi5UMuG34XYBA8PpW8,3803
5
5
  nebu/config.py,sha256=aZzQltkobtOLHFCGcIkpKoE3ITn3Z11Dp0E72w84TA0,5769
6
6
  nebu/data.py,sha256=kIH9-JJ1-iO7P2t28bku6Gn0Y5tgQszGeTW_rpmO03A,38725
7
7
  nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
8
- nebu/chatx/convert.py,sha256=S_0Q7OTZEeGQZTfqCmshp0UaXJbAR_w9dIBTcyqnlBo,12107
8
+ nebu/chatx/convert.py,sha256=jIOuGXPfLkYf_cRqh739gsKKg7cBB2zEYm3Jpmf6Xvo,12535
9
9
  nebu/chatx/openai.py,sha256=LLSPvVGnauUViAXY7OifwoWlkUGZWfgxEjxR4mjSqZg,44961
10
10
  nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,13502
11
11
  nebu/containers/decorator.py,sha256=uFtzlAXRHYZECJ-NPusY7oN9GXvdHrHDd_JNrIGr8aQ,3244
12
12
  nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
13
13
  nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
14
- nebu/processors/consumer.py,sha256=becQxjQoerlaDdr2_wxzIux3wl8SVmo2LA93RZn0Jk8,19694
14
+ nebu/processors/consumer.py,sha256=mSgHm6ANcsM1KtmH9Nu-D6X52d6we0Au8m29rcvb57s,19734
15
15
  nebu/processors/decorate.py,sha256=9mf25RawOX6_6WyQcRLBIHQC3oCDtofQZijJ13aQM9E,34576
16
16
  nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
17
17
  nebu/processors/models.py,sha256=y40HoW-MEzDWB2dm_tsYlUy3Nf3s6eiLC0iGO9BoNog,3956
@@ -19,8 +19,8 @@ nebu/processors/processor.py,sha256=EQ3-dBf432fSAQE2A_9ATX-cG5LkJ4fjVaOtlxCoXvc,
19
19
  nebu/processors/remote.py,sha256=TeAIPGEMqnDIb7H1iett26IEZrBlcbPB_-DSm6jcH1E,1285
20
20
  nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
21
21
  nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- nebu-0.1.31.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
- nebu-0.1.31.dist-info/METADATA,sha256=gXoUbLOIX6fDnn90IDvX3-fnFhBWRZrVxbJr0ZNbEf0,1786
24
- nebu-0.1.31.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
- nebu-0.1.31.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
26
- nebu-0.1.31.dist-info/RECORD,,
22
+ nebu-0.1.32.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
+ nebu-0.1.32.dist-info/METADATA,sha256=zjHxnA7sDhRyFcO7z3l6MnBjuox-ydeKL4TR09J_R1w,1786
24
+ nebu-0.1.32.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
+ nebu-0.1.32.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
26
+ nebu-0.1.32.dist-info/RECORD,,
File without changes