-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_components.py
More file actions
50 lines (43 loc) · 1.6 KB
/
test_components.py
File metadata and controls
50 lines (43 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from xai_components.base import InArg, OutArg, InCompArg, Component, xai_component, secret, chat, dynalist
@xai_component
class AllLiteralTypes(Component):
string_port: InArg[str]
int_port: InArg[int]
float_port: InArg[float]
boolean_port: InArg[bool]
list_port: InArg[list]
tuple_port: InArg[tuple]
dict_port: InArg[dict]
secret_port: InArg[secret]
chat_port: InArg[chat]
any_port: InArg[any]
def execute(self, ctx) -> None:
data_types = {
"String inPort": self.string_port.value,
"Integer inPort": self.int_port.value,
"Float inPort": self.float_port.value,
"Boolean inPort": self.boolean_port.value,
"List inPort": self.list_port.value,
"Tuple inPort": self.tuple_port.value,
"Dict inPort": self.dict_port.value,
"Secret inPort": self.secret_port.value,
"Chat inPort": self.chat_port.value,
"Any inPort": self.any_port.value
}
for data_type, value in data_types.items():
print(data_type + ":")
print(value)
@xai_component
class DynaportTester(Component):
"""
Collects dynamic inputs for testing dynalist connections.
##### inPorts:
- inputs (dynalist): List of input values to be collected.
##### outPorts:
- collected (list): Outputs all collected values as a list.
"""
inputs: InArg[dynalist]
collected: OutArg[list]
def execute(self, ctx) -> None:
self.collected.value = self.inputs.value
print(f"[DynaportCollector] Collected values: {self.collected.value}")