Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
23b2898
Update Finetuner search metadata functional tests (#172)
lucas-aixplain May 2, 2024
208a081
Downgrade dataclasses-json for compatibility (#170)
thiago-aixplain May 2, 2024
a837e1a
Fix model cost parameters (#179)
thiago-aixplain May 10, 2024
754f478
Treat label URLs (#176)
thiago-aixplain May 15, 2024
f1c9935
Add new metric test (#181)
thiago-aixplain Jun 4, 2024
a48ccfd
LLMModel class and parameters (#184)
thiago-aixplain Jun 5, 2024
c7f59ce
Gpus (#185)
mikelam-us-aixplain Jun 5, 2024
16eb2e1
Create and get Pipelines with api key as input parameter (#187)
thiago-aixplain Jun 7, 2024
2849d6f
Merge branch 'test' into development
thiago-aixplain Jun 11, 2024
04246b1
M 6769474660 save pipelines (#191)
thiago-aixplain Jun 17, 2024
73021a7
M 6769474660 save pipelines (#192)
thiago-aixplain Jun 18, 2024
474602b
Solving bug when LLM parameters are set on data (#196)
thiago-aixplain Jun 26, 2024
c471703
Merge branch 'test' into development
thiago-aixplain Jun 26, 2024
3695686
Fix pipeline functional test (#200)
lucas-aixplain Jul 3, 2024
9014061
M 6656407247 agentification (#197)
thiago-aixplain Jul 13, 2024
e9091c2
Fixing circular import in the SDK (#211)
thiago-aixplain Jul 30, 2024
f437815
create model/pipeline tools from AgentFactory (#214)
thiago-aixplain Aug 2, 2024
8457087
Merge branch 'test' into development
thiago-aixplain Aug 6, 2024
03009c6
Set model ID as a parameter (#216)
thiago-aixplain Aug 7, 2024
02f7482
Content inputs to be processed according to the query. (#215)
thiago-aixplain Aug 7, 2024
4947959
ENG-1: programmatic api introduced (#219)
kadirpekel Aug 9, 2024
ef16dd5
Updated image upload tests (#213)
mikelam-us-aixplain Aug 12, 2024
d0ad51d
Eng 217 local path (#220)
thiago-aixplain Aug 13, 2024
dca1a37
Eng 389 fix tests (#222)
thiago-aixplain Aug 13, 2024
d43f67f
Merge branch 'test' into development
thiago-aixplain Aug 13, 2024
b113368
Tool Validation when creating agents (#226)
xainaz Aug 19, 2024
0032947
Eng 398 sdk get users credits - Initial (#232)
xainaz Aug 20, 2024
a567535
Eng 398 sdk get users credits (#234)
thiago-aixplain Aug 20, 2024
e919fab
Removed wallet_factoy.py (#235)
xainaz Aug 21, 2024
9ffe3f7
Merge branch 'test' into development
thiago-aixplain Aug 22, 2024
115bf13
Adding supervisor/planning options into SDK (#233)
thiago-aixplain Aug 22, 2024
3357e56
Adjustments to get user credits (#237)
xainaz Aug 23, 2024
ee76afd
Put conditions inside try statements according to changes required. (…
xainaz Aug 23, 2024
1660f5f
Fixing none credit (#238)
xainaz Aug 27, 2024
ed20ba7
Merge branch 'test' into development
thiago-aixplain Aug 27, 2024
481dab2
Merge branch 'test' into development
thiago-aixplain Aug 27, 2024
9a89f52
Update click dependency (#241)
thiago-aixplain Aug 28, 2024
cb0d313
Added input and output attributes to model (#244)
xainaz Sep 2, 2024
716d898
Eng 467 ai xplain sdk update finetune functional tests to cover all n…
xainaz Sep 3, 2024
50d7c6a
Merge branch 'test' into development
thiago-aixplain Sep 4, 2024
f3d89ed
Added name to update (#245)
xainaz Sep 5, 2024
1700304
ENG-504: Make the agent architecture configurable (#243)
thiago-aixplain Sep 6, 2024
357e10d
Eng 544 ai xplain sdk update llm functional tests to cover all new ll…
xainaz Sep 9, 2024
731a150
Eng 399 - Introducing Metric Nodes in Designer (#247)
kadirpekel Sep 10, 2024
0e62774
Add TeamAgent factory and module. Fix typos in code comments (#227)
lucas-aixplain Sep 12, 2024
7f64955
Merge branch 'test' into development
ikxplain Sep 19, 2024
b93a706
Add fileMetadata information in script node (#251)
thiago-aixplain Sep 20, 2024
ea846e6
Merge branch 'test' into development
thiago-aixplain Sep 23, 2024
f7bd983
Name Validation of Agents and Team Agents (#253)
thiago-aixplain Sep 23, 2024
b886287
Fixes in pipeline design and reconstructor node (#255)
thiago-aixplain Sep 26, 2024
8bd6460
Add get method to agent and team agent tests (#259)
lucas-aixplain Sep 29, 2024
4bd9bc0
initial API key factory (#261)
xainaz Oct 7, 2024
63e0f82
BUG-177: Fixed pipeline validation (#262)
kadirpekel Oct 7, 2024
0208be1
Get usage limit (#264)
thiago-aixplain Oct 8, 2024
662420e
Update SDK version (#266)
thiago-aixplain Oct 9, 2024
08c925e
Merge branch 'test' into development
thiago-aixplain Oct 9, 2024
828bdee
Eng 739 get api key (#268)
thiago-aixplain Oct 9, 2024
5ece957
Merge branch 'test' into development
thiago-aixplain Oct 9, 2024
b13c21d
Fix Update API Key Bug (#272)
thiago-aixplain Oct 10, 2024
2a2a476
Merge branch 'test' into development
thiago-aixplain Oct 10, 2024
8182293
Eng 735 ai xplain sdk improve error log messages (#271)
xainaz Oct 16, 2024
ecba34f
Max tokens and iterations in agents/teams (#276)
thiago-aixplain Oct 17, 2024
2127cc5
Update model running endpoints from v1 to v2 (#275)
thiago-aixplain Oct 17, 2024
736a7b1
Eng 711 new model endpoints (#278)
thiago-aixplain Oct 17, 2024
fa33531
Group of Improvements in API Key CRUD (#277)
thiago-aixplain Oct 25, 2024
349ea60
Bug 149 - Path validation removed and decision node output param hand…
kadirpekel Oct 25, 2024
dd46dcf
Changed function to required field (#283)
xainaz Oct 29, 2024
b86d5e7
BUG-206: Fixed passthrough parameter reflection to next node (#284)
kadirpekel Oct 29, 2024
0dbfab1
Get model description (#286)
thiago-aixplain Oct 29, 2024
2eebc27
Merge branch 'test' into development
thiago-aixplain Oct 29, 2024
7ce3c73
Fixing default parameters setting (#288)
thiago-aixplain Oct 29, 2024
9fbc3e6
Merge branch 'test' into development
thiago-aixplain Oct 29, 2024
09908ed
Eng 893 ai xplain sdk improve error log message when deleting an agen…
xainaz Oct 30, 2024
c3c0228
Fixes of errors pointed by functional test (#291)
thiago-aixplain Oct 30, 2024
45e0ff0
Merge branch 'test' into development
thiago-aixplain Oct 30, 2024
ef5d61f
Fix agent and team agent functional tests (#294)
lucas-aixplain Oct 31, 2024
1e43ed3
designer pipeline building are now compatible with custom inputs (#296)
kadirpekel Oct 31, 2024
d77348a
Model Response Class (#279)
xainaz Nov 4, 2024
d1538af
Set Model Tool description (#292)
thiago-aixplain Nov 4, 2024
d731ff0
Eng 812 update agents (#285)
thiago-aixplain Nov 4, 2024
8340687
Service mode parameter in the SDK (#295)
thiago-aixplain Nov 4, 2024
4e79c02
Merge branch 'test' into development
ikxplain Nov 5, 2024
f1bd8f3
BUG-233 Prompt variables are now populated and validated automaticall…
kadirpekel Nov 7, 2024
e2d1be1
Fix check_storage_type to not detect folder as a file (#302)
lucas-aixplain Nov 8, 2024
9700903
Merge branch 'test' into development
thiago-aixplain Nov 11, 2024
3754cc4
ENG-979 New functional test for script nodes (#305)
kadirpekel Nov 11, 2024
6353254
Bug 228 sdk always return model response when running model (#304)
xainaz Nov 11, 2024
b5e2285
Make function filter in model search optional (#307)
thiago-aixplain Nov 11, 2024
d273330
Set default 'parameters' to None and adding tests (#300)
lucas-aixplain Nov 11, 2024
4eb3ac2
Fixing pipeline poll bug (#309)
thiago-aixplain Nov 13, 2024
2081205
Merge branch 'test' into development
thiago-aixplain Nov 19, 2024
332bd83
Eng-1070: agent/team's output format (#316)
thiago-aixplain Nov 20, 2024
574398f
Hotfix: Increase benchmark test timeout (#312)
shreyasXplain Nov 21, 2024
f8ca14e
Default parameter on ModelResponse.get (#319)
thiago-aixplain Nov 25, 2024
f4b251a
ENG-1094: Validate prompt variables (#317)
thiago-aixplain Nov 25, 2024
664d081
added tests (#320)
xainaz Nov 25, 2024
93e24f3
added aixplain key (#314)
xainaz Nov 25, 2024
bfb5f68
Merge branch 'test' into development
thiago-aixplain Nov 25, 2024
540b0a1
ENG-1110: Onboard Utilities (#321)
thiago-aixplain Nov 27, 2024
14765a8
ModelResponse.__setitem__ (#325)
thiago-aixplain Nov 27, 2024
3852e2d
Merge
thiago-aixplain Dec 4, 2024
7732dad
ENG-1129: aixplain sdk caching functions (#324)
xainaz Dec 4, 2024
3ccbf62
ENG-1110: onboard utility model (#329)
thiago-aixplain Dec 4, 2024
b7ece3f
BUG-262: Payload gets values from both parameters and data (#327)
xainaz Dec 5, 2024
14c26d4
Fixing validation of utility models (#331)
thiago-aixplain Dec 9, 2024
88a0afd
Merge branch 'test' into development
thiago-aixplain Dec 10, 2024
717b2b1
ENG-1110: Onboarding an Utility Model (#334)
thiago-aixplain Dec 10, 2024
478495c
Merge branch 'test' into development
thiago-aixplain Dec 11, 2024
4988de0
BUG-283: Fix finetune functional tests (#336)
lucas-aixplain Dec 11, 2024
cc92516
Improvements in functional tests and set default temperature on LLMs …
thiago-aixplain Dec 12, 2024
ef17efd
BUG-288: Input parameters of utility models (#339)
thiago-aixplain Dec 13, 2024
7e33a2a
Merge branch 'test' into development
thiago-aixplain Dec 16, 2024
125527b
ENG-1235 Utility functions has now special treatment as they need dyn…
kadirpekel Dec 19, 2024
a7b5a46
Add restriction when setting Utilities function in model tool (#346)
lucas-aixplain Dec 20, 2024
9e787b9
ENG-1245: transition from update to save (#345)
ahmetgunduz Dec 23, 2024
6f12c91
ENG-1153: Enabling custom python code tool (#326)
thiago-aixplain Dec 23, 2024
7628004
ENG-1230: set aixplain as default supplier (#348)
thiago-aixplain Dec 24, 2024
5ddb867
ENG-1069: Initial updates for airv2 model (#330)
xainaz Dec 26, 2024
4cb3b74
ENG-1282: Set default pipeline engine version to 3.0 with fallback to…
kadirpekel Dec 30, 2024
889c641
ENG-1288: Added diarization test into pipelines functional tests (#351)
kadirpekel Dec 30, 2024
57acca8
Merge branch 'test' into development
ikxplain Jan 2, 2025
5ee6b97
Set method on pipeline saving (#354)
thiago-aixplain Jan 2, 2025
48c774d
BUG-275: team deployment (#332)
thiago-aixplain Jan 2, 2025
220ddda
ENG-1289: Enabled reconstructor and segmentor designer nodes when pip…
kadirpekel Jan 2, 2025
1b05a0c
ENG-1282 revert (#355)
thiago-aixplain Jan 3, 2025
3024cc0
Merge branch 'test' into development
thiago-aixplain Jan 6, 2025
cb8c65a
Bug 309 utility model update save without code (#358)
ahmetgunduz Jan 9, 2025
336a0f3
ENG-1393: Index improvements (#360)
thiago-aixplain Jan 13, 2025
e16020b
BUG-329: Fix agent validation when using api key (#361)
lucas-aixplain Jan 13, 2025
cf3dad0
Get error in other field (#359)
thiago-aixplain Jan 14, 2025
62a904c
ENG-1393: index improvements (#363)
thiago-aixplain Jan 14, 2025
0cef496
BUG-338: Fixing custom code test (#366)
thiago-aixplain Jan 17, 2025
244c0be
Index Factory List/Test (#369)
thiago-aixplain Jan 18, 2025
2033d90
Merge branch 'test' into development
thiago-aixplain Jan 18, 2025
54fd94c
ENG-1422 validation (#362)
OsujiCC Jan 20, 2025
450d53f
ENG-1272: Added Agent Response, and edited unit tests (#347)
xainaz Jan 20, 2025
8acd40f
Prod-1534: Utility Asset Improvements (#364)
ahmetgunduz Jan 22, 2025
56627d7
Temporaly set utility asset status to onboarded by default (#377)
ahmetgunduz Jan 24, 2025
884b496
for temporarily set the status to onboarded and fixed tests according…
ahmetgunduz Jan 24, 2025
1102629
ENG-1494: Listing models by IDs (#378)
thiago-aixplain Jan 24, 2025
49f02dd
ENG-1471: adding agent role filed (#374)
thiago-aixplain Jan 28, 2025
8d3a524
Fixing intermediate steps problem (#380)
thiago-aixplain Jan 28, 2025
975d35c
Merge branch 'test' into mergetotest20250129
hadi-aix Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions aixplain/factories/agent_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import json
import logging
import warnings

from aixplain.enums.function import Function
from aixplain.enums.supplier import Supplier
Expand All @@ -46,6 +47,7 @@ def create(
cls,
name: Text,
description: Text,
role: Optional[Text] = None,
llm_id: Text = "669a63646eb56306647e1091",
tools: List[Tool] = [],
api_key: Text = config.TEAM_API_KEY,
Expand All @@ -54,9 +56,15 @@ def create(
) -> Agent:
"""Create a new agent in the platform.

Warning:
The 'role' parameter was recently added and serves the same purpose as 'description' did previously: set the role of the agent as a system prompt.
The 'description' parameter is still required and should be used to set a short summary of the agent's purpose.
For the next releases, the 'role' parameter will be required.

Args:
name (Text): name of the agent
description (Text): description of the agent role.
role (Text): role of the agent.
llm_id (Text, optional): aiXplain ID of the large language model to be used as agent. Defaults to "669a63646eb56306647e1091" (GPT-4o mini).
tools (List[Tool], optional): list of tool for the agent. Defaults to [].
api_key (Text, optional): team/user API key. Defaults to config.TEAM_API_KEY.
Expand All @@ -66,6 +74,12 @@ def create(
Returns:
Agent: created Agent
"""
warnings.warn(
"The 'role' parameter was recently added and serves the same purpose as 'description' did previously: set the role of the agent as a system prompt. "
"The 'description' parameter is still required and should be used to set a short summary of the agent's purpose. "
"For the next releases, the 'role' parameter will be required.",
UserWarning,
)
from aixplain.factories.agent_factory.utils import build_agent

agent = None
Expand All @@ -81,6 +95,7 @@ def create(
"name": name,
"assets": [tool.to_dict() for tool in tools],
"description": description,
"role": role or description,
"supplier": supplier,
"version": version,
"llmId": llm_id,
Expand Down
6 changes: 5 additions & 1 deletion aixplain/factories/agent_factory/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import aixplain.utils.config as config
from aixplain.enums import Function, Supplier
from aixplain.enums.asset_status import AssetStatus
from aixplain.modules.agent import Agent, ModelTool, PipelineTool, PythonInterpreterTool
from aixplain.modules.agent import Agent
from aixplain.modules.agent.tool.model_tool import ModelTool
from aixplain.modules.agent.tool.pipeline_tool import PipelineTool
from aixplain.modules.agent.tool.python_interpreter_tool import PythonInterpreterTool
from aixplain.modules.agent.tool.custom_python_code_tool import CustomPythonCodeTool
from typing import Dict, Text
from urllib.parse import urljoin
Expand Down Expand Up @@ -50,6 +53,7 @@ def build_agent(payload: Dict, api_key: Text = config.TEAM_API_KEY) -> Agent:
name=payload.get("name", ""),
tools=tools,
description=payload.get("description", ""),
role=payload.get("role", ""),
supplier=payload.get("teamId", None),
version=payload.get("version", None),
cost=payload.get("cost", None),
Expand Down
2 changes: 1 addition & 1 deletion aixplain/factories/asset_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from abc import abstractmethod
from typing import List, Text
from typing import Text
from aixplain.modules.asset import Asset
from aixplain.utils import config

Expand Down
1 change: 0 additions & 1 deletion aixplain/factories/benchmark_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class BenchmarkFactory:
backend_url (str): The URL for the backend.
"""


backend_url = config.BACKEND_URL

@classmethod
Expand Down
1 change: 0 additions & 1 deletion aixplain/factories/dataset_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class DatasetFactory(AssetFactory):
backend_url (str): The URL for the backend.
"""


backend_url = config.BACKEND_URL

@classmethod
Expand Down
55 changes: 38 additions & 17 deletions aixplain/factories/model_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ModelFactory:
@classmethod
def create_utility_model(
cls,
name: Text,
code: Union[Text, Callable],
name: Optional[Text] = None,
code: Union[Text, Callable] = None,
inputs: List[UtilityModelInput] = [],
description: Optional[Text] = None,
output_examples: Text = "",
Expand Down Expand Up @@ -153,6 +153,8 @@ def list(
sort_order: SortOrder = SortOrder.ASCENDING,
page_number: int = 0,
page_size: int = 20,
model_ids: Optional[List[Text]] = None,
api_key: Optional[Text] = None,
) -> List[Model]:
"""Gets the first k given models based on the provided task and language filters

Expand All @@ -165,25 +167,44 @@ def list(
sort_by (Optional[SortBy], optional): sort the retrived models by a specific attribute,
page_number (int, optional): page number. Defaults to 0.
page_size (int, optional): page size. Defaults to 20.
model_ids (Optional[List[Text]], optional): model ids to filter. Defaults to None.
api_key (Optional[Text], optional): Team API key. Defaults to None.

Returns:
List[Model]: List of models based on given filters
"""
from aixplain.factories.model_factory.utils import get_assets_from_page

models, total = get_assets_from_page(
query,
page_number,
page_size,
function,
suppliers,
source_languages,
target_languages,
is_finetunable,
ownership,
sort_by,
sort_order,
)
if model_ids is not None:
from aixplain.factories.model_factory.utils import get_model_from_ids

assert len(model_ids) > 0, "Please provide at least one model id"
assert (
function is None
and suppliers is None
and source_languages is None
and target_languages is None
and is_finetunable is None
and ownership is None
and sort_by is None
), "Cannot filter by function, suppliers, source languages, target languages, is finetunable, ownership, sort by when using model ids"
assert len(model_ids) <= page_size, "Page size must be greater than the number of model ids"
models, total = get_model_from_ids(model_ids, api_key), len(model_ids)
else:
from aixplain.factories.model_factory.utils import get_assets_from_page

models, total = get_assets_from_page(
query,
page_number,
page_size,
function,
suppliers,
source_languages,
target_languages,
is_finetunable,
ownership,
sort_by,
sort_order,
api_key,
)
return {
"results": models,
"page_total": min(page_size, len(models)),
Expand Down
43 changes: 42 additions & 1 deletion aixplain/factories/model_factory/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def get_assets_from_page(
ownership: Optional[Tuple[OwnershipType, List[OwnershipType]]] = None,
sort_by: Optional[SortBy] = None,
sort_order: SortOrder = SortOrder.ASCENDING,
api_key: Optional[str] = None,
) -> List[Model]:
try:
url = urljoin(config.BACKEND_URL, "sdk/models/paginate")
Expand Down Expand Up @@ -146,9 +147,49 @@ def get_assets_from_page(
all_models = resp["items"]
from aixplain.factories.model_factory.utils import create_model_from_response

model_list = [create_model_from_response(model_info_json) for model_info_json in all_models]
model_list = []
for model_info_json in all_models:
model_info_json["api_key"] = config.TEAM_API_KEY
if api_key is not None:
model_info_json["api_key"] = api_key
model_list.append(create_model_from_response(model_info_json))
return model_list, resp["total"]
else:
error_message = f"Listing Models Error: Failed to retrieve models. Status Code: {r.status_code}. Error: {resp}"
logging.error(error_message)
raise Exception(error_message)


def get_model_from_ids(model_ids: List[str], api_key: Optional[str] = None) -> List[Model]:
from aixplain.factories.model_factory.utils import create_model_from_response

resp = None
try:
url = urljoin(config.BACKEND_URL, f"sdk/models?ids={','.join(model_ids)}")

headers = {"Authorization": f"Token {config.TEAM_API_KEY}", "Content-Type": "application/json"}
logging.info(f"Start service for GET Model - {url} - {headers}")
r = _request_with_retry("get", url, headers=headers)
resp = r.json()

except Exception:
if resp is not None and "statusCode" in resp:
status_code = resp["statusCode"]
message = resp["message"]
message = f"Model Creation: Status {status_code} - {message}"
else:
message = "Model Creation: Unspecified Error"
logging.error(message)
raise Exception(f"{message}")
if 200 <= r.status_code < 300:
models = []
for item in resp["items"]:
item["api_key"] = config.TEAM_API_KEY
if api_key is not None:
item["api_key"] = api_key
models.append(create_model_from_response(item))
return models
else:
error_message = f"Model GET Error: Failed to retrieve models {model_ids}. Status Code: {r.status_code}. Error: {resp}"
logging.error(error_message)
raise Exception(error_message)
12 changes: 6 additions & 6 deletions aixplain/factories/pipeline_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def get_assets_from_page(cls, page_number: int) -> List[Pipeline]:
url = urljoin(cls.backend_url, f"sdk/pipelines/?pageNumber={page_number}")

headers = {
"Authorization": f"Token {config.TEAM_API_KEY}",
"Content-Type": "application/json",
}
"Authorization": f"Token {config.TEAM_API_KEY}",
"Content-Type": "application/json",
}
r = _request_with_retry("get", url, headers=headers)
resp = r.json()
logging.info(f"Listing Pipelines: Status of getting Pipelines on Page {page_number}: {resp}")
Expand Down Expand Up @@ -172,9 +172,9 @@ def list(
url = urljoin(cls.backend_url, "sdk/pipelines/paginate")

headers = {
"Authorization": f"Token {config.TEAM_API_KEY}",
"Content-Type": "application/json",
}
"Authorization": f"Token {config.TEAM_API_KEY}",
"Content-Type": "application/json",
}

assert 0 < page_size <= 100, "Pipeline List Error: Page size must be greater than 0 and not exceed 100."
payload = {
Expand Down
42 changes: 8 additions & 34 deletions aixplain/factories/pipeline_factory/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ def build_from_response(response: Dict, load_architecture: bool = False) -> Pipe
else:
node = BareAsset(asset_id=node_json["assetId"])
elif node_json["type"].lower() == "decision":
node = Decision(
routes=[Route(**route) for route in node_json["routes"]]
)
node = Decision(routes=[Route(**route) for route in node_json["routes"]])
elif node_json["type"].lower() == "router":
node = Router(
routes=[Route(**route) for route in node_json["routes"]]
)
node = Router(routes=[Route(**route) for route in node_json["routes"]])
elif node_json["type"].lower() == "script":
node = Script(
fileId=node_json["fileId"],
Expand All @@ -74,43 +70,21 @@ def build_from_response(response: Dict, load_architecture: bool = False) -> Pipe
if "inputValues" in node_json:
[
node.inputs.create_param(
data_type=(
DataType(input_param["dataType"])
if "dataType" in input_param
else None
),
data_type=(DataType(input_param["dataType"]) if "dataType" in input_param else None),
code=input_param["code"],
value=(
input_param["value"] if "value" in input_param else None
),
is_required=(
input_param["isRequired"]
if "isRequired" in input_param
else False
),
value=(input_param["value"] if "value" in input_param else None),
is_required=(input_param["isRequired"] if "isRequired" in input_param else False),
)
for input_param in node_json["inputValues"]
if input_param["code"] not in node.inputs
]
if "outputValues" in node_json:
[
node.outputs.create_param(
data_type=(
DataType(output_param["dataType"])
if "dataType" in output_param
else None
),
data_type=(DataType(output_param["dataType"]) if "dataType" in output_param else None),
code=output_param["code"],
value=(
output_param["value"]
if "value" in output_param
else None
),
is_required=(
output_param["isRequired"]
if "isRequired" in output_param
else False
),
value=(output_param["value"] if "value" in output_param else None),
is_required=(output_param["isRequired"] if "isRequired" in output_param else False),
)
for output_param in node_json["outputValues"]
if output_param["code"] not in node.outputs
Expand Down
Loading