nebu 0.1.27__py3-none-any.whl → 0.1.30__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.
@@ -342,7 +342,9 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
342
342
  if content_type_name and content_type_name in local_namespace:
343
343
  # Try to create the content type model first
344
344
  try:
345
- content_model = local_namespace[content_type_name](**content)
345
+ content_model = local_namespace[content_type_name].model_validate(
346
+ content
347
+ )
346
348
  print(f"Content model: {content_model}")
347
349
  input_obj = local_namespace["Message"](
348
350
  kind=kind,
@@ -371,7 +373,7 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
371
373
  )
372
374
  else:
373
375
  # Just use the raw content
374
- print(f"Using raw content")
376
+ print("Using raw content")
375
377
  input_obj = local_namespace["Message"](
376
378
  kind=kind,
377
379
  id=msg_id,
@@ -798,7 +798,6 @@ def processor(
798
798
 
799
799
  processor_instance = Processor(
800
800
  name=processor_name,
801
- stream=processor_name,
802
801
  namespace=namespace,
803
802
  labels=labels,
804
803
  container=container_request,
@@ -812,6 +811,7 @@ def processor(
812
811
  print(
813
812
  f"[DEBUG Decorator] Processor instance '{processor_name}' created successfully."
814
813
  )
814
+ processor_instance.original_func = func
815
815
  return processor_instance
816
816
 
817
817
  return decorator
@@ -12,6 +12,7 @@ from nebu.processors.models import (
12
12
  V1Processors,
13
13
  V1ProcessorScaleRequest,
14
14
  V1Scale,
15
+ V1StreamData,
15
16
  V1UpdateProcessor,
16
17
  )
17
18
 
@@ -24,7 +25,6 @@ class Processor:
24
25
  def __init__(
25
26
  self,
26
27
  name: str,
27
- stream: str,
28
28
  namespace: Optional[str] = None,
29
29
  labels: Optional[Dict[str, str]] = None,
30
30
  container: Optional[V1ContainerRequest] = None,
@@ -48,7 +48,6 @@ class Processor:
48
48
  self.name = name
49
49
  self.namespace = namespace
50
50
  self.labels = labels
51
- self.stream = stream
52
51
  self.container = container
53
52
  self.schema_ = schema_
54
53
  self.common_schema = common_schema
@@ -123,7 +122,6 @@ class Processor:
123
122
  )
124
123
 
125
124
  update_processor = V1UpdateProcessor(
126
- stream=stream,
127
125
  container=container,
128
126
  schema_=schema_,
129
127
  common_schema=common_schema,
@@ -143,18 +141,23 @@ class Processor:
143
141
  patch_response.raise_for_status()
144
142
  print(f"Updated Processor {self.processor.metadata.name}")
145
143
 
146
- def send(self, data: Dict[str, Any]) -> Dict[str, Any]:
144
+ def send(self, data: Dict[str, Any], wait: bool = False) -> Dict[str, Any]:
147
145
  """
148
146
  Send data to the processor.
149
147
  """
150
148
  if not self.processor or not self.processor.metadata.name:
151
149
  raise ValueError("Processor not found")
152
150
 
153
- url = f"{self.processors_url}/{self.processor.metadata.namespace}/{self.processor.metadata.name}/send"
151
+ url = f"{self.processors_url}/{self.processor.metadata.namespace}/{self.processor.metadata.name}/messages"
154
152
 
155
- response = requests.get(
153
+ stream_data = V1StreamData(
154
+ content=data,
155
+ wait=wait,
156
+ )
157
+
158
+ response = requests.post(
156
159
  url,
157
- params=data,
160
+ json=stream_data.model_dump(exclude_none=True),
158
161
  headers={"Authorization": f"Bearer {self.api_key}"},
159
162
  )
160
163
  response.raise_for_status()
@@ -208,7 +211,6 @@ class Processor:
208
211
  out.namespace = namespace
209
212
 
210
213
  # Set specific fields from the processor
211
- out.stream = processor_v1.stream
212
214
  out.container = processor_v1.container
213
215
  out.schema_ = processor_v1.schema_
214
216
  out.common_schema = processor_v1.common_schema
@@ -0,0 +1,47 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Any, Dict, Optional, Type, TypeVar
3
+
4
+ from pydantic import BaseModel
5
+
6
+ from nebu.config import GlobalConfig
7
+ from nebu.processors.models import V1ContainerRequest, V1Scale
8
+
9
+ from .models import Message
10
+ from .processor import Processor
11
+
12
+ I = TypeVar("I", bound=BaseModel)
13
+ O = TypeVar("O", bound=BaseModel)
14
+
15
+
16
+ class RemoteProcessor(ABC, Processor):
17
+ def __init__(
18
+ self,
19
+ name: str,
20
+ namespace: Optional[str] = None,
21
+ labels: Optional[Dict[str, str]] = None,
22
+ container: Optional[V1ContainerRequest] = None,
23
+ schema_: Optional[Any] = None,
24
+ common_schema: Optional[str] = None,
25
+ min_replicas: Optional[int] = None,
26
+ max_replicas: Optional[int] = None,
27
+ scale_config: Optional[V1Scale] = None,
28
+ config: Optional[GlobalConfig] = None,
29
+ no_delete: bool = False,
30
+ ):
31
+ super().__init__(
32
+ name,
33
+ namespace,
34
+ labels,
35
+ container,
36
+ schema_,
37
+ common_schema,
38
+ min_replicas,
39
+ max_replicas,
40
+ scale_config,
41
+ config,
42
+ no_delete,
43
+ )
44
+
45
+ @abstractmethod
46
+ def process(self, message: Message[I]) -> Type[BaseModel]:
47
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.27
3
+ Version: 0.1.30
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -10,6 +10,7 @@ Requires-Dist: dill>=0.3.8
10
10
  Requires-Dist: openai>=1.68.2
11
11
  Requires-Dist: pillow>=11.1.0
12
12
  Requires-Dist: pydantic>=2.10.6
13
+ Requires-Dist: pydantic-ai-slim[openai]>=0.0.55
13
14
  Requires-Dist: pysocks>=1.7.1
14
15
  Requires-Dist: pyyaml>=6.0.2
15
16
  Requires-Dist: redis[socks]>=5.0
@@ -0,0 +1,26 @@
1
+ nebu/__init__.py,sha256=5sepbzdAdoA_8TIxws60S4ugFY1apQd_savzn20a4cY,465
2
+ nebu/adapter.py,sha256=yWQCpAn2lJxXPSyQacmFpfVzAL3RrKtKgrSMws0BoT8,211
3
+ nebu/auth.py,sha256=N_v6SPFD9HU_UoRDTaouH03g2Hmo9C-xxqInE1FweXE,1471
4
+ nebu/cache.py,sha256=1aY1plIXWOPmUY6GGq_s_QDXzIi5UMuG34XYBA8PpW8,3803
5
+ nebu/config.py,sha256=aZzQltkobtOLHFCGcIkpKoE3ITn3Z11Dp0E72w84TA0,5769
6
+ nebu/data.py,sha256=kIH9-JJ1-iO7P2t28bku6Gn0Y5tgQszGeTW_rpmO03A,38725
7
+ nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
8
+ nebu/chatx/convert.py,sha256=4rjccr9bI0xmCAumKlxyFpVzW0up9Yj-gJYvDjH6C54,8798
9
+ nebu/chatx/openai.py,sha256=LLSPvVGnauUViAXY7OifwoWlkUGZWfgxEjxR4mjSqZg,44961
10
+ nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,13502
11
+ nebu/containers/decorator.py,sha256=uFtzlAXRHYZECJ-NPusY7oN9GXvdHrHDd_JNrIGr8aQ,3244
12
+ nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
13
+ nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
14
+ nebu/processors/consumer.py,sha256=becQxjQoerlaDdr2_wxzIux3wl8SVmo2LA93RZn0Jk8,19694
15
+ nebu/processors/decorate.py,sha256=9mf25RawOX6_6WyQcRLBIHQC3oCDtofQZijJ13aQM9E,34576
16
+ nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
17
+ nebu/processors/models.py,sha256=y40HoW-MEzDWB2dm_tsYlUy3Nf3s6eiLC0iGO9BoNog,3956
18
+ nebu/processors/processor.py,sha256=EQ3-dBf432fSAQE2A_9ATX-cG5LkJ4fjVaOtlxCoXvc,9719
19
+ nebu/processors/remote.py,sha256=TeAIPGEMqnDIb7H1iett26IEZrBlcbPB_-DSm6jcH1E,1285
20
+ nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
21
+ nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ nebu-0.1.30.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
+ nebu-0.1.30.dist-info/METADATA,sha256=Y_o6hvOdihVgFJMRQPIpALA2V6JfaXybtrlSaQyMNtI,1786
24
+ nebu-0.1.30.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
+ nebu-0.1.30.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
26
+ nebu-0.1.30.dist-info/RECORD,,
@@ -1,22 +0,0 @@
1
- nebu/__init__.py,sha256=fdDvhSm-KU8I6PtL00ePEv2D3lP0NZ-O-MhtG_Sc5SM,359
2
- nebu/auth.py,sha256=rApCd-7_c3GpIb7gjCB79rR7SOcmkG7MmaTE6zMbvr0,1125
3
- nebu/config.py,sha256=aZzQltkobtOLHFCGcIkpKoE3ITn3Z11Dp0E72w84TA0,5769
4
- nebu/convert.py,sha256=x85CE1X4rABgAAx9rSEo9TVBq-i1-nm8QU_dYTijQxc,5512
5
- nebu/data.py,sha256=CzxEvESDdSApvuEO7NJUmW4yJ1vXtQQCXTjYDoOlcqk,40846
6
- nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
7
- nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,13502
8
- nebu/containers/decorator.py,sha256=uFtzlAXRHYZECJ-NPusY7oN9GXvdHrHDd_JNrIGr8aQ,3244
9
- nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
10
- nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
11
- nebu/processors/consumer.py,sha256=gbPyJE-odgmd3UbE2Y1tZ2x8yqFaaBtNzUKZh5dpKBA,19636
12
- nebu/processors/decorate.py,sha256=B2qK1B2Jm1SzO5IN9pWk32sS0z5WLqXPdJtP-y-iSO4,34563
13
- nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
14
- nebu/processors/models.py,sha256=y40HoW-MEzDWB2dm_tsYlUy3Nf3s6eiLC0iGO9BoNog,3956
15
- nebu/processors/processor.py,sha256=oy2YdI-cy6qQWxrZhpZahJV46oWZlu_Im-jm811R_oo,9667
16
- nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
17
- nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- nebu-0.1.27.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
- nebu-0.1.27.dist-info/METADATA,sha256=V01d1IJl34syXgiaMGULDJ_IVydAdDzjVd_c8PXVIYU,1738
20
- nebu-0.1.27.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
21
- nebu-0.1.27.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
22
- nebu-0.1.27.dist-info/RECORD,,
File without changes