nebu 0.1.9__py3-none-any.whl → 0.1.11__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/processors/decorate.py +27 -0
- nebu/processors/models.py +8 -28
- {nebu-0.1.9.dist-info → nebu-0.1.11.dist-info}/METADATA +1 -1
- {nebu-0.1.9.dist-info → nebu-0.1.11.dist-info}/RECORD +7 -7
- {nebu-0.1.9.dist-info → nebu-0.1.11.dist-info}/WHEEL +0 -0
- {nebu-0.1.9.dist-info → nebu-0.1.11.dist-info}/licenses/LICENSE +0 -0
- {nebu-0.1.9.dist-info → nebu-0.1.11.dist-info}/top_level.txt +0 -0
nebu/processors/decorate.py
CHANGED
@@ -170,6 +170,33 @@ def processor(
|
|
170
170
|
function_source = inspect.getsource(func)
|
171
171
|
# Clean up the indentation
|
172
172
|
function_source = textwrap.dedent(function_source)
|
173
|
+
|
174
|
+
# Remove the @processor decorator (single or multi-line) if present
|
175
|
+
lines = function_source.split("\\n")
|
176
|
+
filtered_lines = []
|
177
|
+
skipping_decorator = False
|
178
|
+
decorator_name = "processor" # Assuming the decorator is always @processor
|
179
|
+
for line in lines:
|
180
|
+
stripped_line = line.strip()
|
181
|
+
if stripped_line.startswith(f"@{decorator_name}"):
|
182
|
+
skipping_decorator = True
|
183
|
+
continue # Skip the decorator starting line itself
|
184
|
+
if skipping_decorator:
|
185
|
+
if stripped_line.startswith("def "):
|
186
|
+
skipping_decorator = False
|
187
|
+
# Add the 'def' line, as it's the start of the function
|
188
|
+
filtered_lines.append(line)
|
189
|
+
else:
|
190
|
+
# Still inside the decorator block, skip this line
|
191
|
+
continue
|
192
|
+
else:
|
193
|
+
# Not skipping, and not the start of the decorator, so keep the line
|
194
|
+
filtered_lines.append(line)
|
195
|
+
|
196
|
+
processed_function_source = "\\n".join(filtered_lines)
|
197
|
+
# Update function_source with the processed version
|
198
|
+
function_source = processed_function_source
|
199
|
+
|
173
200
|
except (IOError, TypeError):
|
174
201
|
raise ValueError(
|
175
202
|
f"Could not retrieve source code for function {func.__name__}"
|
nebu/processors/models.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Any, Generic, List, Optional, TypeVar
|
2
2
|
|
3
|
-
from pydantic import BaseModel
|
3
|
+
from pydantic import BaseModel
|
4
4
|
|
5
5
|
# Assuming these are imported from other modules
|
6
6
|
from nebu.containers.models import V1ContainerRequest
|
@@ -36,12 +36,8 @@ class V1Scale(BaseModel):
|
|
36
36
|
zero: Optional[V1ScaleZero] = None
|
37
37
|
|
38
38
|
|
39
|
-
def default_processor_kind() -> str:
|
40
|
-
return "Processor"
|
41
|
-
|
42
|
-
|
43
39
|
class V1Processor(BaseModel):
|
44
|
-
kind: str =
|
40
|
+
kind: str = "Processor"
|
45
41
|
metadata: V1ResourceMeta
|
46
42
|
container: Optional[V1ContainerRequest] = None
|
47
43
|
stream: str
|
@@ -61,7 +57,7 @@ class V1Processor(BaseModel):
|
|
61
57
|
|
62
58
|
|
63
59
|
class V1ProcessorRequest(BaseModel):
|
64
|
-
kind: str =
|
60
|
+
kind: str = "Processor"
|
65
61
|
metadata: V1ResourceMetaRequest
|
66
62
|
container: Optional[V1ContainerRequest] = None
|
67
63
|
schema_: Optional[Any] = None
|
@@ -93,29 +89,13 @@ class V1UpdateProcessor(BaseModel):
|
|
93
89
|
no_delete: Optional[bool] = None
|
94
90
|
|
95
91
|
|
96
|
-
def kind_v1_stream_message() -> str:
|
97
|
-
return "StreamMessage"
|
98
|
-
|
99
|
-
|
100
|
-
def kind_v1_stream_response_message() -> str:
|
101
|
-
return "StreamResponseMessage"
|
102
|
-
|
103
|
-
|
104
|
-
def kind_v1_openai_stream_message() -> str:
|
105
|
-
return "OpenAIStreamMessage"
|
106
|
-
|
107
|
-
|
108
|
-
def kind_v1_openai_stream_response() -> str:
|
109
|
-
return "OpenAIStreamResponse"
|
110
|
-
|
111
|
-
|
112
92
|
class V1StreamData(BaseModel):
|
113
93
|
content: Any = None
|
114
94
|
wait: Optional[bool] = None
|
115
95
|
|
116
96
|
|
117
|
-
class V1StreamMessage(Generic[T]
|
118
|
-
kind: str =
|
97
|
+
class V1StreamMessage(BaseModel, Generic[T]):
|
98
|
+
kind: str = "StreamMessage"
|
119
99
|
id: str
|
120
100
|
content: Optional[T] = None
|
121
101
|
created_at: int
|
@@ -127,7 +107,7 @@ class V1StreamMessage(Generic[T], BaseModel):
|
|
127
107
|
|
128
108
|
|
129
109
|
class V1StreamResponseMessage(BaseModel):
|
130
|
-
kind: str =
|
110
|
+
kind: str = "StreamResponseMessage"
|
131
111
|
id: str
|
132
112
|
content: Any = None
|
133
113
|
status: Optional[str] = None
|
@@ -136,7 +116,7 @@ class V1StreamResponseMessage(BaseModel):
|
|
136
116
|
|
137
117
|
|
138
118
|
class V1OpenAIStreamMessage(BaseModel):
|
139
|
-
kind: str =
|
119
|
+
kind: str = "OpenAIStreamMessage"
|
140
120
|
id: str
|
141
121
|
content: Any # Using Any for ChatCompletionRequest
|
142
122
|
created_at: int
|
@@ -148,7 +128,7 @@ class V1OpenAIStreamMessage(BaseModel):
|
|
148
128
|
|
149
129
|
|
150
130
|
class V1OpenAIStreamResponse(BaseModel):
|
151
|
-
kind: str =
|
131
|
+
kind: str = "OpenAIStreamResponse"
|
152
132
|
id: str
|
153
133
|
content: Any # Using Any for ChatCompletionResponse
|
154
134
|
created_at: int
|
@@ -7,14 +7,14 @@ nebu/containers/decorator.py,sha256=qiM7hbHne9MhSp1gDgX5z5bimsXr_YPjTIZoe09dwr4,
|
|
7
7
|
nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
|
8
8
|
nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
|
9
9
|
nebu/processors/consumer.py,sha256=rFqd6gg2OYgXi3gf11GFpuaOOzuK1TYaPO-t_leSR8Y,15097
|
10
|
-
nebu/processors/decorate.py,sha256=
|
10
|
+
nebu/processors/decorate.py,sha256=ERCYk3D6L8GAg05NSZJG73kJx-hzNCskZFaN7-oBMZY,14437
|
11
11
|
nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
|
12
|
-
nebu/processors/models.py,sha256=
|
12
|
+
nebu/processors/models.py,sha256=GvnI8UJrQSjHo2snP07cPfisCH90cEGTY-PZV5_AtXI,3654
|
13
13
|
nebu/processors/processor.py,sha256=oy2YdI-cy6qQWxrZhpZahJV46oWZlu_Im-jm811R_oo,9667
|
14
14
|
nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
|
15
15
|
nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
nebu-0.1.
|
17
|
-
nebu-0.1.
|
18
|
-
nebu-0.1.
|
19
|
-
nebu-0.1.
|
20
|
-
nebu-0.1.
|
16
|
+
nebu-0.1.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
17
|
+
nebu-0.1.11.dist-info/METADATA,sha256=yCMJNMUGXp93yIOHWJ860NsdopJMqR2VsT-X3bM18EU,1588
|
18
|
+
nebu-0.1.11.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
19
|
+
nebu-0.1.11.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
|
20
|
+
nebu-0.1.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|