Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
a7ac7ad
ENG-1852: Hotfix, added fail-fast option (#488)
kadirpekel Apr 11, 2025
b0887bd
Fix: BUG-503 failed to update utility tool after get (#491)
ahmetgunduz Apr 16, 2025
89daf2f
Bug-503-fix Update (#493)
ahmetgunduz Apr 16, 2025
6bf7d00
ENG-1920: added sentry cred (#476)
xainaz Apr 16, 2025
9e2b03c
Read input variables correctly (#496)
thiago-aixplain Apr 17, 2025
409a893
Fix: file not deleted in test_sql_tool_with_csv test (#492)
ahmetgunduz Apr 17, 2025
3acfacd
ENG-2007: Fix agent and team agent parametrized functional test - Syn…
lucas-aixplain Apr 17, 2025
da7ec38
ENG-1789: Add multiple index backbones support (#443)
basitanees Apr 23, 2025
d360780
ENG-2049: rename air functions (#500)
thiago-aixplain Apr 24, 2025
24e88da
ENG 1924: aixplain sdk new test cases for agents using utility and pi…
OsujiCC Apr 24, 2025
044d8d8
add pydantic requirement (#502)
basitanees Apr 25, 2025
4efdbc8
ENG-1978: Adding instructions to teams (#485)
thiago-aixplain Apr 25, 2025
ab2fcc5
BUG-504: Merged paramMappings for the same link vectors (#499)
kadirpekel Apr 25, 2025
268cc1a
ENG-1836: Set name of tools on the SDK (#501)
thiago-aixplain Apr 28, 2025
9796d19
Eng 2051 Improvements on CI flow (#509)
kadirpekel Apr 30, 2025
f0837fc
Add a finetuned version of BGE model (#512)
Muhammad-Elmallah May 5, 2025
511bf5f
ENG-2055-Aixplain-SDK-Centralized-Error-Handling (#510)
ahmetgunduz May 6, 2025
0c4edf4
ENG-1862:Added status to Tools and deployment check for Agent and Tea…
ahmetgunduz May 6, 2025
0989c51
Merge branch 'test' into development
hadi-aix May 8, 2025
84baed8
Fix: BUG-543 SQL Tool upload db issue (#519)
ahmetgunduz May 9, 2025
de6a1c4
ENG-2028: model streaming (#506)
thiago-aixplain May 9, 2025
b909a54
BUG-542-Utility-Model-Update-Test-Failing-in-SDK (#515)
ahmetgunduz May 9, 2025
8aa3d31
ENG-2115 fixing agent tests (#522)
thiago-aixplain May 9, 2025
4f20c65
Merge branch 'test' into development
thiago-aixplain May 9, 2025
87d5791
ENG-1551 ai xplain sdk caching onboarded models pipelines and agents …
xainaz May 12, 2025
6f600d9
Bug 531: standardize asset names (#521)
OsujiCC May 14, 2025
85d0406
fixed asset issue (#526)
xainaz May 15, 2025
4d650c9
Make functional test more stable (#525)
thiago-aixplain May 15, 2025
91d6864
ENG-2100: Enable JSON schema as output format (#513)
thiago-aixplain May 19, 2025
cecd3a6
Added serialize function for save (#529)
xainaz May 20, 2025
6aa648f
Add Embedding Params to Model (#534)
basitanees May 20, 2025
ad4ddbf
Prod 1785 enable adding any embedding in ai r not just embedding mode…
Muhammad-Elmallah May 21, 2025
bb74b68
Changed cache default to false (#536)
xainaz May 22, 2025
e3f072d
Merge branch 'test' into development
thiago-aixplain May 22, 2025
b2a00e3
added filelock (#538)
xainaz May 23, 2025
239b56a
Add filelock to requirements (#540)
thiago-aixplain May 23, 2025
1f6b614
cache duration (#541)
xainaz May 23, 2025
14485e2
ErrorCode returns code in string (#542)
yunsukim86 May 26, 2025
59be7cc
ENG-2003 : Add LLM's to Agents as Object (#524)
ahmetgunduz May 27, 2025
cdaaa81
ENG-2105: persist sql data (#528)
thiago-aixplain May 27, 2025
77ff8d8
Custom inspector interface (#484)
yunsukim86 Jun 2, 2025
f6422db
Eng 2040 ai r 2 add splitting features to the sdk (#546)
Muhammad-Elmallah Jun 2, 2025
59e40d6
pipeline to_dict change + fixed circular imports pipeline functional …
xainaz Jun 2, 2025
c8aa11c
ENG-1962: composio (#547)
thiago-aixplain Jun 4, 2025
b7a929d
Add input target for inspectors (#548)
yunsukim86 Jun 6, 2025
6067f16
ENG-1900 Refined agent deletion error messages (#543)
kadirpekel Jun 10, 2025
c570a70
ENG-2271: Add code interpreter model ID (#550)
lucas-aixplain Jun 16, 2025
80ddb8a
Update enums.py (#552)
hadi-aix Jun 18, 2025
39be1d0
Update enums.py (#554)
hadi-aix Jun 18, 2025
c45b709
Merge branch 'test' into development
hadi-aix Jun 18, 2025
095f9b8
removed pipeline cache test (#556)
xainaz Jun 19, 2025
01a7f9e
Functional test fix of agent in use error (#560)
ahmetgunduz Jun 20, 2025
585444a
BUG-574 Fixed functionType type handling (#561)
kadirpekel Jun 20, 2025
1e84627
PROD-1833: Optional Instructions in Agents (#559)
ahmetgunduz Jun 24, 2025
ea51442
fixing the tests (#569)
Muhammad-Elmallah Jun 25, 2025
ba406e2
Introducing prompt benchmarking (#497)
shreyasXplain Jun 26, 2025
3d6dc91
ENG-2371 functional test for pipeline run_async (#570)
kadirpekel Jun 27, 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
1 change: 1 addition & 0 deletions aixplain/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
from .asset_status import AssetStatus
from .index_stores import IndexStores
from .function_type import FunctionType
from .code_interpeter import CodeInterpreterModel
10 changes: 10 additions & 0 deletions aixplain/enums/code_interpeter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from enum import Enum


class CodeInterpreterModel(str, Enum):
"""Code Interpreter Model IDs"""

PYTHON_AZURE = "67476fa16eb563d00060ad62"

def __str__(self):
return self._value_
1 change: 1 addition & 0 deletions aixplain/enums/function_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ class FunctionType(Enum):
SEARCH = "search"
INTEGRATION = "connector"
CONNECTION = "connection"
MCPSERVER = 'mcpserver'
9 changes: 1 addition & 8 deletions aixplain/factories/agent_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ def create(
# Use default GPT-4o if no LLM specified
llm = get_llm_instance("669a63646eb56306647e1091", api_key=api_key)

if instructions is None:
warnings.warn(
"Use `instructions` to define the **system prompt**. "
"Use `description` to provide a **short summary** of the agent for metadata and dashboard display. "
"Note: In upcoming releases, `instructions` will become a required parameter.",
UserWarning,
)
warnings.warn(
"Use `llm` to define the large language model (aixplain.modules.model.llm_model.LLM) to be used as agent. "
"Use `llm_id` to provide the model ID of the large language model to be used as agent. "
Expand Down Expand Up @@ -406,4 +399,4 @@ def get(cls, agent_id: Text, api_key: Optional[Text] = None) -> Agent:
if "message" in resp:
msg = resp["message"]
error_msg = f"Agent Get Error (HTTP {r.status_code}): {msg}"
raise Exception(error_msg)
raise Exception(error_msg)
2 changes: 1 addition & 1 deletion aixplain/factories/agent_factory/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def build_agent(payload: Dict, tools: List[Tool] = None, api_key: Text = config.
name=payload.get("name", ""),
tools=payload_tools,
description=payload.get("description", ""),
instructions=payload.get("role", ""),
instructions=payload.get("role"),
supplier=payload.get("teamId", None),
version=payload.get("version", None),
cost=payload.get("cost", None),
Expand Down
38 changes: 33 additions & 5 deletions aixplain/factories/benchmark_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

import logging
from typing import Dict, List, Text
from typing import Dict, List, Text, Any, Tuple
import json
from aixplain.enums.supplier import Supplier
from aixplain.modules import Dataset, Metric, Model
Expand Down Expand Up @@ -150,9 +150,9 @@ def _validate_create_benchmark_payload(cls, payload):
if len(payload["datasets"]) != 1:
raise Exception("Please use exactly one dataset")
if len(payload["metrics"]) == 0:
raise Exception("Please use exactly one metric")
if len(payload["model"]) == 0:
raise Exception("Please use exactly one model")
raise Exception("Please use at least one metric")
if len(payload["model"]) == 0 and payload.get("models", None) is None:
raise Exception("Please use at least one model")
clean_metrics_info = {}
for metric_info in payload["metrics"]:
metric_id = metric_info["id"]
Expand All @@ -167,6 +167,31 @@ def _validate_create_benchmark_payload(cls, payload):
{"id": metric_id, "configurations": metric_config} for metric_id, metric_config in clean_metrics_info.items()
]
return payload

@classmethod
def _reformat_model_list(cls, model_list: List[Model]) -> Tuple[List[Any], List[Any]]:
"""Reformat the model list to be used in the create benchmark API

Args:
model_list (List[Model]): List of models to be used in the benchmark

Returns:
Tuple[List[Any], List[Any]]: Reformatted model lists

"""
model_list_without_parms, model_list_with_parms = [], []
for model in model_list:
if "displayName" in model.additional_info:
model_list_with_parms.append({"id": model.id, "displayName": model.additional_info["displayName"], "configurations": json.dumps(model.additional_info["configuration"])})
else:
model_list_without_parms.append(model.id)
if len(model_list_with_parms) > 0:
if len(model_list_without_parms) > 0:
raise Exception("Please provide addditional info for all models or for none of the models")
else:
model_list_with_parms = None
return model_list_without_parms, model_list_with_parms


@classmethod
def create(cls, name: str, dataset_list: List[Dataset], model_list: List[Model], metric_list: List[Metric]) -> Benchmark:
Expand All @@ -186,15 +211,18 @@ def create(cls, name: str, dataset_list: List[Dataset], model_list: List[Model],
try:
url = urljoin(cls.backend_url, "sdk/benchmarks")
headers = {"Authorization": f"Token {config.TEAM_API_KEY}", "Content-Type": "application/json"}
model_list_without_parms, model_list_with_parms = cls._reformat_model_list(model_list)
payload = {
"name": name,
"datasets": [dataset.id for dataset in dataset_list],
"model": [model.id for model in model_list],
"metrics": [{"id": metric.id, "configurations": metric.normalization_options} for metric in metric_list],
"model": model_list_without_parms,
"shapScores": [],
"humanEvaluationReport": False,
"automodeTraining": False,
}
if model_list_with_parms is not None:
payload["models"] = model_list_with_parms
clean_payload = cls._validate_create_benchmark_payload(payload)
payload = json.dumps(clean_payload)
r = _request_with_retry("post", url, headers=headers, data=payload)
Expand Down
5 changes: 5 additions & 0 deletions aixplain/factories/index_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def validate_embedding_model(model_id) -> bool:
return model.function == Function.TEXT_EMBEDDING


def validate_embedding_model(model_id) -> bool:
model = ModelFactory.get(model_id)
return model.function == Function.TEXT_EMBEDDING


class IndexFactory(ModelFactory, Generic[T]):
@classmethod
def create(
Expand Down
2 changes: 0 additions & 2 deletions aixplain/factories/model_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
from aixplain.factories.model_factory.mixins import ModelGetterMixin, ModelListMixin
from typing import Callable, Dict, List, Optional, Text, Union



class ModelFactory(ModelGetterMixin, ModelListMixin):
"""A static class for creating and exploring Model Objects.

Expand Down
1 change: 0 additions & 1 deletion aixplain/factories/model_factory/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def create_model_from_response(response: Dict) -> Model:
supports_streaming=response.get("supportsStreaming", False),
status=status,
function_type=function_type,

**additional_kwargs,
)

Expand Down
34 changes: 10 additions & 24 deletions aixplain/modules/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
id: Text,
name: Text,
description: Text,
instructions: Text,
instructions: Optional[Text] = None,
tools: List[Union[Tool, Model]] = [],
llm_id: Text = "6646261c6eb563165658bbb1",
llm: Optional[LLM] = None,
Expand Down Expand Up @@ -370,7 +370,7 @@ def to_dict(self) -> Dict:
"name": self.name,
"assets": [build_tool_payload(tool) for tool in self.tools],
"description": self.description,
"role": self.instructions,
"role": self.instructions or self.description,
"supplier": (self.supplier.value["code"] if isinstance(self.supplier, Supplier) else self.supplier),
"version": self.version,
"llmId": self.llm_id if self.llm is None else self.llm.id,
Expand All @@ -395,30 +395,22 @@ def delete(self) -> None:
"x-api-key": config.TEAM_API_KEY,
"Content-Type": "application/json",
}
logging.debug(
f"Start service for DELETE Agent - {url} - {headers}"
)
logging.debug(f"Start service for DELETE Agent - {url} - {headers}")
r = _request_with_retry("delete", url, headers=headers)
logging.debug(
f"Result of request for DELETE Agent - {r.status_code}"
)
logging.debug(f"Result of request for DELETE Agent - {r.status_code}")
if r.status_code != 200:
raise Exception()
except Exception:
try:
response_json = r.json()
error_message = response_json.get('message', '').strip('{{}}')
error_message = response_json.get("message", "").strip("{{}}")

if r.status_code == 403 and error_message == "err.agent_is_in_use":
# Get team agents that use this agent
from aixplain.factories.team_agent_factory import (
TeamAgentFactory
)
from aixplain.factories.team_agent_factory import TeamAgentFactory

team_agents = TeamAgentFactory.list()["results"]
using_team_agents = [
ta for ta in team_agents
if any(agent.id == self.id for agent in ta.agents)
]
using_team_agents = [ta for ta in team_agents if any(agent.id == self.id for agent in ta.agents)]

if using_team_agents:
# Scenario 1: User has access to team agents
Expand All @@ -441,15 +433,9 @@ def delete(self) -> None:
"referencing it."
)
else:
message = (
f"Agent Deletion Error (HTTP {r.status_code}): "
f"{error_message}."
)
message = f"Agent Deletion Error (HTTP {r.status_code}): " f"{error_message}."
except ValueError:
message = (
f"Agent Deletion Error (HTTP {r.status_code}): "
"There was an error in deleting the agent."
)
message = f"Agent Deletion Error (HTTP {r.status_code}): " "There was an error in deleting the agent."
logging.error(message)
raise Exception(message)

Expand Down
3 changes: 3 additions & 0 deletions aixplain/modules/agent/tool/custom_python_code_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from aixplain.modules.agent.tool import Tool
import logging
from aixplain.enums import AssetStatus
from aixplain.enums.code_interpeter import CodeInterpreterModel


class CustomPythonCodeTool(Tool):
Expand All @@ -37,11 +38,13 @@ def __init__(
super().__init__(name=name or "", description=description, **additional_info)
self.code = code
self.status = AssetStatus.ONBOARDED # TODO: change to DRAFT when we have a way to onboard the tool
self.id = CodeInterpreterModel.PYTHON_AZURE

self.validate()

def to_dict(self):
return {
"id": self.id,
"name": self.name,
"description": self.description,
"type": "utility",
Expand Down
6 changes: 4 additions & 2 deletions aixplain/modules/agent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import re


def process_variables(query: Union[Text, Dict], data: Union[Dict, Text], parameters: Dict, agent_description: Text) -> Text:
def process_variables(
query: Union[Text, Dict], data: Union[Dict, Text], parameters: Dict, agent_description: Union[Text, None]
) -> Text:
from aixplain.factories.file_factory import FileFactory

if isinstance(query, dict):
Expand All @@ -13,7 +15,7 @@ def process_variables(query: Union[Text, Dict], data: Union[Dict, Text], paramet
else:
input_data = {"input": FileFactory.to_link(query)}

variables = re.findall(r"(?<!{){([^}]+)}(?!})", agent_description)
variables = re.findall(r"(?<!{){([^}]+)}(?!})", agent_description or "")
for variable in variables:
if isinstance(data, dict):
assert (
Expand Down
5 changes: 5 additions & 0 deletions aixplain/modules/benchmark_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from aixplain.utils import config
from urllib.parse import urljoin
import pandas as pd
import json
from pathlib import Path
from aixplain.utils.request_utils import _request_with_retry
from aixplain.utils.file_utils import save_file
Expand Down Expand Up @@ -109,6 +110,10 @@ def get_scores(self, return_simplified=True, return_as_dataframe=True):
scores = {}
for iteration_info in iterations:
model_id = iteration_info["pipeline"]
pipeline_json = json.loads(iteration_info["pipelineJson"])
if "benchmark" in pipeline_json:
model_id = pipeline_json["benchmark"]["displayName"]

model_info = {
"creditsUsed": round(iteration_info.get("credits", 0), 5),
"timeSpent": round(iteration_info.get("runtime", 0), 2),
Expand Down
11 changes: 11 additions & 0 deletions aixplain/modules/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,16 @@ def delete(self) -> None:
message = "Model Deletion Error: Make sure the model exists and you are the owner."
logging.error(message)
raise Exception(f"{message}")

def add_additional_info_for_benchmark(self, display_name: str, configuration: Dict) -> None:
"""Add additional info for benchmark

Args:
display_name (str): display name of the model
configuration (Dict): configuration of the model
"""
self.additional_info["displayName"] = display_name
self.additional_info["configuration"] = configuration

@classmethod
def from_dict(cls, data: Dict) -> "Model":
Expand All @@ -451,3 +461,4 @@ def from_dict(cls, data: Dict) -> "Model":
model_params=data.get("model_params"),
**data.get("additional_info", {}),
)

4 changes: 0 additions & 4 deletions aixplain/modules/model/index_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from enum import Enum
from typing import List
from aixplain.enums.splitting_options import SplittingOptions

import os

from urllib.parse import urljoin
Expand Down Expand Up @@ -56,8 +55,6 @@ def __init__(
self.split_length = split_length
self.split_overlap = split_overlap



class IndexModel(Model):
def __init__(
self,
Expand Down Expand Up @@ -125,7 +122,6 @@ def to_dict(self) -> Dict:
data["collection_type"] = self.version.split("-", 1)[0]
return data


def search(self, query: str, top_k: int = 10, filters: List[IndexFilter] = []) -> ModelResponse:
"""Search for documents in the index

Expand Down
3 changes: 1 addition & 2 deletions aixplain/modules/pipeline/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ def save(self, *args, **kwargs):

def to_dict(self) -> dict:
return self.serialize()



11 changes: 1 addition & 10 deletions aixplain/modules/pipeline/designer/enums.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum

from aixplain.enums import FunctionType

class RouteType(str, Enum):
CHECK_TYPE = "checkType"
Expand Down Expand Up @@ -29,15 +29,6 @@ class NodeType(str, Enum):
class AssetType(str, Enum):
MODEL = "MODEL"


class FunctionType(str, Enum):
AI = "ai"
SEGMENTOR = "segmentor"
RECONSTRUCTOR = "reconstructor"
UTILITY = "utility"
METRIC = "metric"


class ParamType:
INPUT = "INPUT"
OUTPUT = "OUTPUT"
7 changes: 6 additions & 1 deletion aixplain/modules/pipeline/designer/nodes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List, Union, Type, TYPE_CHECKING, Optional
from enum import Enum

from aixplain.modules import Model
from aixplain.enums import DataType, Function
Expand Down Expand Up @@ -142,7 +143,11 @@ def serialize(self) -> dict:
obj["supplier"] = self.supplier
obj["version"] = self.version
obj["assetType"] = self.assetType
obj["functionType"] = self.functionType
# Handle functionType as enum or string
if isinstance(self.functionType, Enum):
obj["functionType"] = self.functionType.value
else:
obj["functionType"] = self.functionType
obj["type"] = self.type
return obj

Expand Down
Loading