Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 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
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
27 changes: 21 additions & 6 deletions aixplain/cli_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,43 @@
CLI Runner
"""
import click
from aixplain.factories.cli.model_factory_cli import list_host_machines, list_functions, create_asset_repo, asset_repo_login, onboard_model, deploy_huggingface_model, get_huggingface_model_status, list_gpus
from aixplain.factories.cli.model_factory_cli import (
list_host_machines,
list_functions,
create_asset_repo,
asset_repo_login,
onboard_model,
deploy_huggingface_model,
get_huggingface_model_status,
list_gpus,
)

@click.group('cli')

@click.group("cli")
def cli():
pass

@click.group('list')

@click.group("list")
def list():
pass

@click.group('get')

@click.group("get")
def get():
pass

@click.group('create')

@click.group("create")
def create():
pass

@click.group('onboard')

@click.group("onboard")
def onboard():
pass


cli.add_command(list)
cli.add_command(get)
cli.add_command(create)
Expand Down
1 change: 1 addition & 0 deletions aixplain/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
from .supplier import Supplier
from .sort_by import SortBy
from .sort_order import SortOrder
from .model_status import ModelStatus
34 changes: 18 additions & 16 deletions aixplain/enums/asset_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@
from enum import Enum
from typing import Text


class AssetStatus(Text, Enum):
HIDDEN = 'hidden'
SCHEDULED = 'scheduled'
ONBOARDING = 'onboarding'
ONBOARDED = 'onboarded'
PENDING = 'pending'
FAILED = 'failed'
TRAINING = 'training'
REJECTED = 'rejected'
ENABLING = 'enabling'
DELETING = 'deleting'
DISABLED = 'disabled'
DELETED = 'deleted'
IN_PROGRESS = 'in_progress'
COMPLETED = 'completed'
CANCELING = 'canceling'
CANCELED = 'canceled'
DRAFT = "draft"
HIDDEN = "hidden"
SCHEDULED = "scheduled"
ONBOARDING = "onboarding"
ONBOARDED = "onboarded"
PENDING = "pending"
FAILED = "failed"
TRAINING = "training"
REJECTED = "rejected"
ENABLING = "enabling"
DELETING = "deleting"
DISABLED = "disabled"
DELETED = "deleted"
IN_PROGRESS = "in_progress"
COMPLETED = "completed"
CANCELING = "canceling"
CANCELED = "canceled"
2 changes: 1 addition & 1 deletion aixplain/enums/data_subtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ class DataSubtype(Enum):
RACE = "race"
SPLIT = "split"
TOPIC = "topic"

def __str__(self):
return self._value_
2 changes: 1 addition & 1 deletion aixplain/enums/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def load_functions():
if input_data_object["required"] is True
},
"output": {output_data_object["dataType"] for output_data_object in function["output"]},
"spec": function
"spec": function,
}
for function in resp["items"]
}
Expand Down
11 changes: 11 additions & 0 deletions aixplain/enums/model_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from enum import Enum
from typing import Text


class ModelStatus(Text, Enum):
FAILED = "FAILED"
IN_PROGRESS = "IN_PROGRESS"
SUCCESS = "SUCCESS"

def __str__(self):
return self._value_
2 changes: 1 addition & 1 deletion aixplain/enums/storage_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ class StorageType(Enum):
FILE = "file"

def __str__(self):
return self._value_
return self._value_
150 changes: 65 additions & 85 deletions aixplain/factories/agent_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from aixplain.utils import config
from typing import Dict, List, Optional, Text, Union

from aixplain.factories.agent_factory.utils import build_agent, validate_llm, validate_name
from aixplain.utils.file_utils import _request_with_retry
from urllib.parse import urljoin

Expand Down Expand Up @@ -65,74 +64,49 @@ def create(
Returns:
Agent: created Agent
"""
validate_name(name)
# validate LLM ID
validate_llm(llm_id)
from aixplain.factories.agent_factory.utils import build_agent

agent = None
url = urljoin(config.BACKEND_URL, "sdk/agents")
headers = {"x-api-key": api_key}

if isinstance(supplier, dict):
supplier = supplier["code"]
elif isinstance(supplier, Supplier):
supplier = supplier.value["code"]

payload = {
"name": name,
"assets": [tool.to_dict() for tool in tools],
"description": description,
"supplier": supplier,
"version": version,
"llmId": llm_id,
"status": "draft",
}
agent = build_agent(payload=payload, api_key=api_key)
agent.validate()
response = "Unspecified error"
try:
agent = None
url = urljoin(config.BACKEND_URL, "sdk/agents")
headers = {"x-api-key": api_key}

if isinstance(supplier, dict):
supplier = supplier["code"]
elif isinstance(supplier, Supplier):
supplier = supplier.value["code"]

tool_payload = []
for tool in tools:
if isinstance(tool, ModelTool):
tool.validate()
tool_payload.append(
{
"function": tool.function.value if tool.function is not None else None,
"type": "model",
"description": tool.description,
"supplier": tool.supplier.value["code"] if tool.supplier else None,
"version": tool.version if tool.version else None,
"assetId": tool.model,
}
)
elif isinstance(tool, PipelineTool):
tool.validate()
tool_payload.append(
{
"assetId": tool.pipeline,
"description": tool.description,
"type": "pipeline",
}
)
else:
raise Exception("Agent Creation Error: Tool type not supported.")

payload = {
"name": name,
"assets": tool_payload,
"description": description,
"supplier": supplier,
"version": version,
"llmId": llm_id,
}

logging.info(f"Start service for POST Create Agent - {url} - {headers} - {json.dumps(payload)}")
logging.debug(f"Start service for POST Create Agent - {url} - {headers} - {json.dumps(payload)}")
r = _request_with_retry("post", url, headers=headers, json=payload)
if 200 <= r.status_code < 300:
response = r.json()
agent = build_agent(payload=response, api_key=api_key)
else:
error = r.json()
error_msg = "Agent Onboarding Error: Please contact the administrators."
if "message" in error:
msg = error["message"]
if error["message"] == "err.name_already_exists":
msg = "Agent name already exists."
elif error["message"] == "err.asset_is_not_available":
msg = "Some tools are not available."
error_msg = f"Agent Onboarding Error (HTTP {r.status_code}): {msg}"
logging.exception(error_msg)
raise Exception(error_msg)
except Exception as e:
raise Exception(e)
response = r.json()
except Exception:
raise Exception("Agent Onboarding Error: Please contact the administrators.")

if 200 <= r.status_code < 300:
agent = build_agent(payload=response, api_key=api_key)
else:
error_msg = f"Agent Onboarding Error: {response}"
if "message" in response:
msg = response["message"]
if response["message"] == "err.name_already_exists":
msg = "Agent name already exists."
elif response["message"] == "err.asset_is_not_available":
msg = "Some tools are not available."
error_msg = f"Agent Onboarding Error (HTTP {r.status_code}): {msg}"
logging.exception(error_msg)
raise Exception(error_msg)
return agent

@classmethod
Expand All @@ -141,6 +115,7 @@ def create_model_tool(
model: Optional[Union[Model, Text]] = None,
function: Optional[Union[Function, Text]] = None,
supplier: Optional[Union[Supplier, Text]] = None,
description: Text = "",
) -> ModelTool:
"""Create a new model tool."""
if function is not None and isinstance(function, str):
Expand All @@ -154,7 +129,7 @@ def create_model_tool(
break
if isinstance(supplier, str):
supplier = None
return ModelTool(function=function, supplier=supplier, model=model)
return ModelTool(function=function, supplier=supplier, model=model, description=description)

@classmethod
def create_pipeline_tool(cls, description: Text, pipeline: Union[Pipeline, Text]) -> PipelineTool:
Expand All @@ -164,37 +139,42 @@ def create_pipeline_tool(cls, description: Text, pipeline: Union[Pipeline, Text]
@classmethod
def list(cls) -> Dict:
"""List all agents available in the platform."""
from aixplain.factories.agent_factory.utils import build_agent

url = urljoin(config.BACKEND_URL, "sdk/agents")
headers = {"x-api-key": config.TEAM_API_KEY, "Content-Type": "application/json"}

resp = {}
payload = {}
logging.info(f"Start service for GET List Agents - {url} - {headers} - {json.dumps(payload)}")
try:
r = _request_with_retry("get", url, headers=headers)
resp = r.json()
except Exception:
raise Exception("Agent Listing Error: Please contact the administrators.")

if 200 <= r.status_code < 300:
agents, page_total, total = [], 0, 0
results = resp
page_total = len(results)
total = len(results)
logging.info(f"Response for GET List Agents - Page Total: {page_total} / Total: {total}")
for agent in results:
agents.append(build_agent(agent))
return {"results": agents, "page_total": page_total, "page_number": 0, "total": total}
else:
error_msg = "Agent Listing Error: Please contact the administrators."
if "message" in resp:
msg = resp["message"]
error_msg = f"Agent Listing Error (HTTP {r.status_code}): {msg}"
logging.exception(error_msg)
raise Exception(error_msg)
except Exception as e:
raise Exception(e)
if 200 <= r.status_code < 300:
agents, page_total, total = [], 0, 0
results = resp
page_total = len(results)
total = len(results)
logging.info(f"Response for GET List Agents - Page Total: {page_total} / Total: {total}")
for agent in results:
agents.append(build_agent(agent))
return {"results": agents, "page_total": page_total, "page_number": 0, "total": total}
else:
error_msg = "Agent Listing Error: Please contact the administrators."
if isinstance(resp, dict) and "message" in resp:
msg = resp["message"]
error_msg = f"Agent Listing Error (HTTP {r.status_code}): {msg}"
logging.exception(error_msg)
raise Exception(error_msg)

@classmethod
def get(cls, agent_id: Text, api_key: Optional[Text] = None) -> Agent:
"""Get agent by id."""
from aixplain.factories.agent_factory.utils import build_agent

url = urljoin(config.BACKEND_URL, f"sdk/agents/{agent_id}")
if config.AIXPLAIN_API_KEY != "":
headers = {"x-aixplain-key": f"{config.AIXPLAIN_API_KEY}", "Content-Type": "application/json"}
Expand Down
Loading