Skip to content

Commit

Permalink
Version 1.4.19
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumfusion committed Nov 14, 2024
1 parent 725d199 commit b073652
Show file tree
Hide file tree
Showing 281 changed files with 8,506 additions and 4,151 deletions.
2 changes: 1 addition & 1 deletion abacusai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,4 @@
from .workflow_node_template import WorkflowNodeTemplate


__version__ = "1.4.18"
__version__ = "1.4.19"
13 changes: 5 additions & 8 deletions abacusai/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ class Agent(AbstractApiClass):
agentExecutionConfig (dict): The config for arguments used to execute the agent.
latestAgentVersion (AgentVersion): The latest agent version.
codeSource (CodeSource): If a python model, information on the source code
draftWorkflowGraph (WorkflowGraph): The last saved draft of workflow graph for the agent.
workflowGraph (WorkflowGraph): The workflow graph for the agent.
"""

def __init__(self, client, name=None, agentId=None, createdAt=None, projectId=None, notebookId=None, predictFunctionName=None, sourceCode=None, agentConfig=None, memory=None, trainingRequired=None, agentExecutionConfig=None, codeSource={}, latestAgentVersion={}, draftWorkflowGraph={}, workflowGraph={}):
def __init__(self, client, name=None, agentId=None, createdAt=None, projectId=None, notebookId=None, predictFunctionName=None, sourceCode=None, agentConfig=None, memory=None, trainingRequired=None, agentExecutionConfig=None, codeSource={}, latestAgentVersion={}, workflowGraph={}):
super().__init__(client, agentId)
self.name = name
self.agent_id = agentId
Expand All @@ -43,14 +42,12 @@ def __init__(self, client, name=None, agentId=None, createdAt=None, projectId=No
self.code_source = client._build_class(CodeSource, codeSource)
self.latest_agent_version = client._build_class(
AgentVersion, latestAgentVersion)
self.draft_workflow_graph = client._build_class(
WorkflowGraph, draftWorkflowGraph)
self.workflow_graph = client._build_class(WorkflowGraph, workflowGraph)
self.deprecated_keys = {}

def __repr__(self):
repr_dict = {f'name': repr(self.name), f'agent_id': repr(self.agent_id), f'created_at': repr(self.created_at), f'project_id': repr(self.project_id), f'notebook_id': repr(self.notebook_id), f'predict_function_name': repr(self.predict_function_name), f'source_code': repr(self.source_code), f'agent_config': repr(self.agent_config), f'memory': repr(
self.memory), f'training_required': repr(self.training_required), f'agent_execution_config': repr(self.agent_execution_config), f'code_source': repr(self.code_source), f'latest_agent_version': repr(self.latest_agent_version), f'draft_workflow_graph': repr(self.draft_workflow_graph), f'workflow_graph': repr(self.workflow_graph)}
repr_dict = {f'name': repr(self.name), f'agent_id': repr(self.agent_id), f'created_at': repr(self.created_at), f'project_id': repr(self.project_id), f'notebook_id': repr(self.notebook_id), f'predict_function_name': repr(self.predict_function_name), f'source_code': repr(self.source_code), f'agent_config': repr(
self.agent_config), f'memory': repr(self.memory), f'training_required': repr(self.training_required), f'agent_execution_config': repr(self.agent_execution_config), f'code_source': repr(self.code_source), f'latest_agent_version': repr(self.latest_agent_version), f'workflow_graph': repr(self.workflow_graph)}
class_name = "Agent"
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
Expand All @@ -63,8 +60,8 @@ def to_dict(self):
Returns:
dict: The dict value representation of the class parameters
"""
resp = {'name': self.name, 'agent_id': self.agent_id, 'created_at': self.created_at, 'project_id': self.project_id, 'notebook_id': self.notebook_id, 'predict_function_name': self.predict_function_name, 'source_code': self.source_code, 'agent_config': self.agent_config, 'memory': self.memory, 'training_required': self.training_required,
'agent_execution_config': self.agent_execution_config, 'code_source': self._get_attribute_as_dict(self.code_source), 'latest_agent_version': self._get_attribute_as_dict(self.latest_agent_version), 'draft_workflow_graph': self._get_attribute_as_dict(self.draft_workflow_graph), 'workflow_graph': self._get_attribute_as_dict(self.workflow_graph)}
resp = {'name': self.name, 'agent_id': self.agent_id, 'created_at': self.created_at, 'project_id': self.project_id, 'notebook_id': self.notebook_id, 'predict_function_name': self.predict_function_name, 'source_code': self.source_code, 'agent_config': self.agent_config, 'memory': self.memory,
'training_required': self.training_required, 'agent_execution_config': self.agent_execution_config, 'code_source': self._get_attribute_as_dict(self.code_source), 'latest_agent_version': self._get_attribute_as_dict(self.latest_agent_version), 'workflow_graph': self._get_attribute_as_dict(self.workflow_graph)}
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}

def refresh(self):
Expand Down
5 changes: 3 additions & 2 deletions abacusai/api_class/ai_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _raw_init(cls, name: str, input_mappings: List[WorkflowNodeInputMapping] = N
return workflow_node

@classmethod
def from_template(cls, template_name: str, name: str, configs: dict = None, input_mappings: Union[Dict[str, WorkflowNodeInputMapping], List[WorkflowNodeInputMapping]] = None, input_schema: Union[List[str], WorkflowNodeInputSchema] = None, output_schema: Union[List[str], WorkflowNodeOutputSchema] = None):
def from_template(cls, template_name: str, name: str, configs: dict = None, input_mappings: Union[Dict[str, WorkflowNodeInputMapping], List[WorkflowNodeInputMapping]] = None, input_schema: Union[List[str], WorkflowNodeInputSchema] = None, output_schema: Union[List[str], WorkflowNodeOutputSchema] = None, sleep_time: int = None):

instance_input_mappings = []
if isinstance(input_mappings, List) and all(isinstance(input, WorkflowNodeInputMapping) for input in input_mappings):
Expand Down Expand Up @@ -396,7 +396,8 @@ def from_template(cls, template_name: str, name: str, configs: dict = None, inpu
template_metadata={
'template_name': template_name,
'configs': configs or {},
'initialized': False
'initialized': False,
'sleep_time': sleep_time,
}
)

Expand Down
13 changes: 12 additions & 1 deletion abacusai/api_class/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ class DocumentProcessingConfig(ApiClass):

def __post_init__(self):
self.ocr_mode = self._detect_ocr_mode()
if self.document_type is not None and DocumentType.is_ocr_forced(self.document_type):
self.highlight_relevant_text = True
if self.highlight_relevant_text is not None:
self.extract_bounding_boxes = self.highlight_relevant_text # Highlight_relevant text acts as a wrapper over extract_bounding_boxes

def _detect_ocr_mode(self):
if self.document_type is not None:
if self.document_type == DocumentType.TEXT:
if self.document_type == DocumentType.TEXT or self.document_type == DocumentType.SIMPLE_TEXT:
return OcrMode.DEFAULT
elif self.document_type == DocumentType.TABLES_AND_FORMS:
return OcrMode.LAYOUT
Expand All @@ -76,6 +78,15 @@ def _detect_ocr_mode(self):
return self.ocr_mode
return OcrMode.AUTO

@classmethod
def _get_filtered_dict(cls, config: dict):
"""Filters out default values from the config"""
from reainternal.utils import snake_case
return {
k: v for k, v in config.items()
if v is not None and v != getattr(cls, snake_case(k), None)
}


@dataclasses.dataclass
class DatasetDocumentProcessingConfig(DocumentProcessingConfig):
Expand Down
27 changes: 20 additions & 7 deletions abacusai/api_class/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ class ApplicationConnectorType(ApiEnum):
GOOGLEDRIVEUSER = 'GOOGLEDRIVEUSER'
GOOGLEWORKSPACEUSER = 'GOOGLEWORKSPACEUSER'
GMAILUSER = 'GMAILUSER'
GOOGLECALENDARUSER = 'GOOGLECALENDARUSER'
GOOGLESHEETSUSER = 'GOOGLESHEETSUSER'
GOOGLEDOCSUSER = 'GOOGLEDOCSUSER'
GOOGLECALENDAR = 'GOOGLECALENDAR'
GOOGLESHEETS = 'GOOGLESHEETS'
GOOGLEDOCS = 'GOOGLEDOCS'
ONEDRIVEUSER = 'ONEDRIVEUSER'
TEAMSSCRAPER = 'TEAMSSCRAPER'
GITHUBUSER = 'GITHUBUSER'
Expand Down Expand Up @@ -482,6 +482,7 @@ class LLMName(ApiEnum):
GEMINI_1_5_PRO = 'GEMINI_1_5_PRO'
ABACUS_SMAUG3 = 'ABACUS_SMAUG3'
ABACUS_DRACARYS = 'ABACUS_DRACARYS'
QWEN_2_5_32B = 'QWEN_2_5_32B'
GEMINI_1_5_FLASH = 'GEMINI_1_5_FLASH'


Expand Down Expand Up @@ -608,10 +609,15 @@ def aws_ocr_modes(cls):


class DocumentType(ApiEnum):
TEXT = 'TEXT'
TABLES_AND_FORMS = 'TABLES_AND_FORMS'
EMBEDDED_IMAGES = 'EMBEDDED_IMAGES'
SCANNED_TEXT = 'SCANNED_TEXT'
SIMPLE_TEXT = 'SIMPLE_TEXT' # digital text
TEXT = 'TEXT' # general text with OCR
TABLES_AND_FORMS = 'TABLES_AND_FORMS' # tables and forms with OCR
EMBEDDED_IMAGES = 'EMBEDDED_IMAGES' # embedded images with OCR TODO: remove?
SCANNED_TEXT = 'SCANNED_TEXT' # scanned text with OCR

@classmethod
def is_ocr_forced(cls, document_type: 'DocumentType'):
return document_type in [cls.TEXT, cls.TABLES_AND_FORMS, cls.EMBEDDED_IMAGES, cls.SCANNED_TEXT]


class StdDevThresholdType(ApiEnum):
Expand Down Expand Up @@ -641,6 +647,11 @@ class AgentInterface(ApiEnum):
AUTONOMOUS = 'AUTONOMOUS'


class WorkflowNodeTemplateType(ApiEnum):
TRIGGER = 'trigger'
DEFAULT = 'default'


class ProjectConfigType(ApiEnum):
CONSTRAINTS = 'CONSTRAINTS'
CHAT_FEEDBACK = 'CHAT_FEEDBACK'
Expand Down Expand Up @@ -693,3 +704,5 @@ class DeploymentConversationType(ApiEnum):
COMPLEX_AGENT = 'COMPLEX_AGENT'
WORKFLOW_AGENT = 'WORKFLOW_AGENT'
COPILOT = 'COPILOT'
AGENT_CONTROLLER = 'AGENT_CONTROLLER'
CODE_LLM = 'CODE_LLM'
10 changes: 6 additions & 4 deletions abacusai/api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,27 @@ class ApiKey(AbstractApiClass):
apiKey (str): The unique API key scoped to a specific organization. Value will be partially obscured.
apiKeySuffix (str): The last 4 characters of the API key.
tag (str): A user-friendly tag for the API key.
type (str): The type of the API key, either 'default' or 'code-llm'.
createdAt (str): The timestamp when the API key was created.
expiresAt (str): The timestamp when the API key will expire.
isExpired (bool): Whether the API key has expired.
"""

def __init__(self, client, apiKeyId=None, apiKey=None, apiKeySuffix=None, tag=None, createdAt=None, expiresAt=None, isExpired=None):
def __init__(self, client, apiKeyId=None, apiKey=None, apiKeySuffix=None, tag=None, type=None, createdAt=None, expiresAt=None, isExpired=None):
super().__init__(client, apiKeyId)
self.api_key_id = apiKeyId
self.api_key = apiKey
self.api_key_suffix = apiKeySuffix
self.tag = tag
self.type = type
self.created_at = createdAt
self.expires_at = expiresAt
self.is_expired = isExpired
self.deprecated_keys = {}

def __repr__(self):
repr_dict = {f'api_key_id': repr(self.api_key_id), f'api_key': repr(self.api_key), f'api_key_suffix': repr(self.api_key_suffix), f'tag': repr(
self.tag), f'created_at': repr(self.created_at), f'expires_at': repr(self.expires_at), f'is_expired': repr(self.is_expired)}
self.tag), f'type': repr(self.type), f'created_at': repr(self.created_at), f'expires_at': repr(self.expires_at), f'is_expired': repr(self.is_expired)}
class_name = "ApiKey"
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
Expand All @@ -42,8 +44,8 @@ def to_dict(self):
Returns:
dict: The dict value representation of the class parameters
"""
resp = {'api_key_id': self.api_key_id, 'api_key': self.api_key, 'api_key_suffix': self.api_key_suffix,
'tag': self.tag, 'created_at': self.created_at, 'expires_at': self.expires_at, 'is_expired': self.is_expired}
resp = {'api_key_id': self.api_key_id, 'api_key': self.api_key, 'api_key_suffix': self.api_key_suffix, 'tag': self.tag,
'type': self.type, 'created_at': self.created_at, 'expires_at': self.expires_at, 'is_expired': self.is_expired}
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}

def delete(self):
Expand Down
2 changes: 1 addition & 1 deletion abacusai/batch_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, client, batchPredictionId=None, createdAt=None, name=None, de
BatchPredictionArgs, globalPredictionArgs)
self.batch_prediction_args = client._build_class(getattr(
api_class, batchPredictionArgsType, BatchPredictionArgs) if batchPredictionArgsType else BatchPredictionArgs, batchPredictionArgs)
self.deprecated_keys = {'global_prediction_args', 'explanations'}
self.deprecated_keys = {'explanations', 'global_prediction_args'}

def __repr__(self):
repr_dict = {f'batch_prediction_id': repr(self.batch_prediction_id), f'created_at': repr(self.created_at), f'name': repr(self.name), f'deployment_id': repr(self.deployment_id), f'file_connector_output_location': repr(self.file_connector_output_location), f'database_connector_id': repr(self.database_connector_id), f'database_output_configuration': repr(self.database_output_configuration), f'file_output_format': repr(self.file_output_format), f'connector_type': repr(self.connector_type), f'legacy_input_location': repr(self.legacy_input_location), f'output_feature_group_id': repr(self.output_feature_group_id), f'feature_group_table_name': repr(self.feature_group_table_name), f'output_feature_group_table_name': repr(self.output_feature_group_table_name), f'summary_feature_group_table_name': repr(self.summary_feature_group_table_name), f'csv_input_prefix': repr(
Expand Down
2 changes: 1 addition & 1 deletion abacusai/batch_prediction_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, client, batchPredictionVersion=None, batchPredictionId=None,
BatchPredictionArgs, globalPredictionArgs)
self.batch_prediction_args = client._build_class(getattr(
api_class, batchPredictionArgsType, BatchPredictionArgs) if batchPredictionArgsType else BatchPredictionArgs, batchPredictionArgs)
self.deprecated_keys = {'global_prediction_args', 'explanations'}
self.deprecated_keys = {'explanations', 'global_prediction_args'}

def __repr__(self):
repr_dict = {f'batch_prediction_version': repr(self.batch_prediction_version), f'batch_prediction_id': repr(self.batch_prediction_id), f'status': repr(self.status), f'drift_monitor_status': repr(self.drift_monitor_status), f'deployment_id': repr(self.deployment_id), f'model_id': repr(self.model_id), f'model_version': repr(self.model_version), f'predictions_started_at': repr(self.predictions_started_at), f'predictions_completed_at': repr(self.predictions_completed_at), f'database_output_error': repr(self.database_output_error), f'total_predictions': repr(self.total_predictions), f'failed_predictions': repr(self.failed_predictions), f'database_connector_id': repr(self.database_connector_id), f'database_output_configuration': repr(self.database_output_configuration), f'file_connector_output_location': repr(self.file_connector_output_location), f'file_output_format': repr(self.file_output_format), f'connector_type': repr(self.connector_type), f'legacy_input_location': repr(self.legacy_input_location), f'error': repr(self.error), f'drift_monitor_error': repr(self.drift_monitor_error), f'monitor_warnings': repr(self.monitor_warnings), f'csv_input_prefix': repr(
Expand Down
Loading

0 comments on commit b073652

Please sign in to comment.