Skip to content

Commit 725d199

Browse files
committed
Version 1.4.18
1 parent 7330a71 commit 725d199

File tree

276 files changed

+5479
-7379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+5479
-7379
lines changed

abacusai/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
from .nested_feature import NestedFeature
151151
from .nested_feature_schema import NestedFeatureSchema
152152
from .news_search_result import NewsSearchResult
153+
from .nlp_chat_response import NlpChatResponse
153154
from .notebook_completion import NotebookCompletion
154155
from .notebook_template import NotebookTemplate
155156
from .null_violation import NullViolation
@@ -166,6 +167,7 @@
166167
from .pipeline_step_version_reference import PipelineStepVersionReference
167168
from .pipeline_version import PipelineVersion
168169
from .pipeline_version_logs import PipelineVersionLogs
170+
from .playground_text import PlaygroundText
169171
from .point_in_time_feature import PointInTimeFeature
170172
from .point_in_time_feature_info import PointInTimeFeatureInfo
171173
from .point_in_time_group import PointInTimeGroup
@@ -219,4 +221,4 @@
219221
from .workflow_node_template import WorkflowNodeTemplate
220222

221223

222-
__version__ = "1.4.17"
224+
__version__ = "1.4.18"

abacusai/agent.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ class Agent(AbstractApiClass):
2323
agentExecutionConfig (dict): The config for arguments used to execute the agent.
2424
latestAgentVersion (AgentVersion): The latest agent version.
2525
codeSource (CodeSource): If a python model, information on the source code
26+
draftWorkflowGraph (WorkflowGraph): The last saved draft of workflow graph for the agent.
2627
workflowGraph (WorkflowGraph): The workflow graph for the agent.
2728
"""
2829

29-
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={}):
30+
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={}):
3031
super().__init__(client, agentId)
3132
self.name = name
3233
self.agent_id = agentId
@@ -42,12 +43,14 @@ def __init__(self, client, name=None, agentId=None, createdAt=None, projectId=No
4243
self.code_source = client._build_class(CodeSource, codeSource)
4344
self.latest_agent_version = client._build_class(
4445
AgentVersion, latestAgentVersion)
46+
self.draft_workflow_graph = client._build_class(
47+
WorkflowGraph, draftWorkflowGraph)
4548
self.workflow_graph = client._build_class(WorkflowGraph, workflowGraph)
4649
self.deprecated_keys = {}
4750

4851
def __repr__(self):
49-
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(
50-
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)}
52+
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(
53+
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)}
5154
class_name = "Agent"
5255
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
5356
) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
@@ -60,8 +63,8 @@ def to_dict(self):
6063
Returns:
6164
dict: The dict value representation of the class parameters
6265
"""
63-
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,
64-
'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)}
66+
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,
67+
'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)}
6568
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}
6669

6770
def refresh(self):

abacusai/api_class/abstract.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
def _validate_instance(value, expected_type):
2626
if expected_type == callable:
2727
return callable(value)
28+
if expected_type is Any:
29+
return True
2830
elif isinstance(expected_type, _GenericAlias):
2931
if expected_type.__origin__ == list:
3032
if not isinstance(value, list):

abacusai/api_class/ai_agents.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ast
22
import dataclasses
3-
from typing import Dict, List, Union
3+
from typing import Any, Dict, List, Union
44

55
from . import enums
66
from .abstract import ApiClass, get_clean_function_source_code_for_agent, validate_constructor_arg_types
@@ -67,14 +67,16 @@ class WorkflowNodeInputMapping(ApiClass):
6767
variable_source: str = dataclasses.field(default=None)
6868
source_prop: str = dataclasses.field(default=None)
6969
is_required: bool = dataclasses.field(default=True)
70+
default_value: Any = dataclasses.field(default=None)
7071

7172
def to_dict(self):
7273
return {
7374
'name': self.name,
7475
'variable_type': self.variable_type.value,
7576
'variable_source': self.variable_source,
7677
'source_prop': self.source_prop or self.name,
77-
'is_required': self.is_required
78+
'is_required': self.is_required,
79+
'default_value': self.default_value
7880
}
7981

8082
@classmethod
@@ -87,7 +89,8 @@ def from_dict(cls, mapping: dict):
8789
variable_type=enums.WorkflowNodeInputType(mapping['variable_type']),
8890
variable_source=mapping.get('variable_source'),
8991
source_prop=mapping.get('source_prop') or mapping['name'] if mapping.get('variable_source') else None,
90-
is_required=mapping.get('is_required', True)
92+
is_required=mapping.get('is_required', True),
93+
default_value=mapping.get('default_value')
9194
)
9295

9396

@@ -283,14 +286,14 @@ def __init__(self, name: str, input_mappings: Union[Dict[str, WorkflowNodeInputM
283286
raise ValueError('workflow_graph_node', f'Invalid input mapping. Argument "{input_name}" not found in function "{self.function_name}".')
284287
for arg, default in arg_defaults.items():
285288
if arg not in input_mapping_args:
286-
self.input_mappings.append(WorkflowNodeInputMapping(name=arg, variable_type=enums.WorkflowNodeInputType.USER_INPUT, is_required=default is None))
289+
self.input_mappings.append(WorkflowNodeInputMapping(name=arg, variable_type=enums.WorkflowNodeInputType.USER_INPUT, is_required=default is None, default_value=default.value if default else None))
287290
elif isinstance(input_mappings, Dict) and all(isinstance(key, str) and isinstance(value, WorkflowNodeInputMapping) for key, value in input_mappings.items()):
288291
is_shortform_input_mappings = True
289-
self.input_mappings = [WorkflowNodeInputMapping(name=arg, variable_type=enums.WorkflowNodeInputType.USER_INPUT, is_required=default is None) for arg, default in arg_defaults.items() if arg not in input_mappings]
292+
self.input_mappings = [WorkflowNodeInputMapping(name=arg, variable_type=enums.WorkflowNodeInputType.USER_INPUT, is_required=default is None, default_value=default.value if default else None) for arg, default in arg_defaults.items() if arg not in input_mappings]
290293
for key, value in input_mappings.items():
291294
if key not in arg_defaults:
292295
raise ValueError('workflow_graph_node', f'Invalid input mapping. Argument "{key}" not found in function "{self.function_name}".')
293-
self.input_mappings.append(WorkflowNodeInputMapping(name=key, variable_type=value.variable_type, variable_source=value.variable_source, source_prop=value.source_prop, is_required=arg_defaults.get(key) is None))
296+
self.input_mappings.append(WorkflowNodeInputMapping(name=key, variable_type=value.variable_type, variable_source=value.variable_source, source_prop=value.source_prop, is_required=arg_defaults.get(key) is None, default_value=value.default_value))
294297
else:
295298
raise ValueError('workflow_graph_node', 'Invalid input mappings. Must be a list of WorkflowNodeInputMapping or a dictionary of input mappings in the form {arg_name: node_name.outputs.prop_name}.')
296299

@@ -359,7 +362,7 @@ def from_template(cls, template_name: str, name: str, configs: dict = None, inpu
359362
if isinstance(input_mappings, List) and all(isinstance(input, WorkflowNodeInputMapping) for input in input_mappings):
360363
instance_input_mappings = input_mappings
361364
elif isinstance(input_mappings, Dict) and all(isinstance(key, str) and isinstance(value, WorkflowNodeInputMapping) for key, value in input_mappings.items()):
362-
instance_input_mappings = [WorkflowNodeInputMapping(name=arg, variable_type=mapping.variable_type, variable_source=mapping.variable_source, source_prop=mapping.source_prop) for arg, mapping in input_mappings]
365+
instance_input_mappings = [WorkflowNodeInputMapping(name=arg, variable_type=mapping.variable_type, variable_source=mapping.variable_source, source_prop=mapping.source_prop, is_required=mapping.is_required, default_value=mapping.default_value) for arg, mapping in input_mappings]
363366
elif input_mappings is None:
364367
instance_input_mappings = []
365368
else:

abacusai/api_class/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _detect_ocr_mode(self):
7171
elif self.document_type == DocumentType.EMBEDDED_IMAGES:
7272
return OcrMode.SCANNED
7373
elif self.document_type == DocumentType.SCANNED_TEXT:
74-
return OcrMode.DEFAULT
74+
return OcrMode.SCANNED
7575
if self.ocr_mode is not None:
7676
return self.ocr_mode
7777
return OcrMode.AUTO

abacusai/api_class/enums.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,10 @@ class LLMName(ApiEnum):
478478
CLAUDE_V3_SONNET = 'CLAUDE_V3_SONNET'
479479
CLAUDE_V3_HAIKU = 'CLAUDE_V3_HAIKU'
480480
CLAUDE_V3_5_SONNET = 'CLAUDE_V3_5_SONNET'
481+
CLAUDE_V3_5_HAIKU = 'CLAUDE_V3_5_HAIKU'
481482
GEMINI_1_5_PRO = 'GEMINI_1_5_PRO'
482483
ABACUS_SMAUG3 = 'ABACUS_SMAUG3'
484+
ABACUS_DRACARYS = 'ABACUS_DRACARYS'
483485
GEMINI_1_5_FLASH = 'GEMINI_1_5_FLASH'
484486

485487

@@ -594,14 +596,15 @@ class OcrMode(ApiEnum):
594596
COMPREHENSIVE = 'COMPREHENSIVE'
595597
COMPREHENSIVE_V2 = 'COMPREHENSIVE_V2'
596598
COMPREHENSIVE_TABLE_MD = 'COMPREHENSIVE_TABLE_MD'
599+
COMPREHENSIVE_FORM_MD = 'COMPREHENSIVE_FORM_MD'
597600
COMPREHENSIVE_FORM_AND_TABLE_MD = 'COMPREHENSIVE_FORM_AND_TABLE_MD'
598601
TESSERACT_FAST = 'TESSERACT_FAST'
599602
LLM = 'LLM'
600603
AUGMENTED_LLM = 'AUGMENTED_LLM'
601604

602605
@classmethod
603606
def aws_ocr_modes(cls):
604-
return [cls.COMPREHENSIVE_V2, cls.COMPREHENSIVE_TABLE_MD, cls.COMPREHENSIVE_FORM_AND_TABLE_MD]
607+
return [cls.COMPREHENSIVE_V2, cls.COMPREHENSIVE_TABLE_MD, cls.COMPREHENSIVE_FORM_MD, cls.COMPREHENSIVE_FORM_AND_TABLE_MD]
605608

606609

607610
class DocumentType(ApiEnum):

abacusai/client.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ def __init__(self, *args, **kwargs):
285285
self.section_data_list.append({key: value})
286286

287287
def to_dict(self):
288+
"""
289+
Get a dict representation of the response object
290+
"""
288291
result = {}
289292
if self.data_list:
290293
result['data_list'] = self.data_list
@@ -589,6 +592,9 @@ class _ApiExceptionFactory:
589592
"""
590593
@classmethod
591594
def from_response(cls, message: str, http_status: int, exception: str = None, request_id: str = None):
595+
"""
596+
Creates an appropriate exception instance based on HTTP response data.
597+
"""
592598
if http_status == 504:
593599
message = 'Gateway timeout, please try again later'
594600
return GatewayTimeoutError(message, http_status, exception, request_id)
@@ -618,7 +624,7 @@ class BaseApiClient:
618624
client_options (ClientOptions): Optional API client configurations
619625
skip_version_check (bool): If true, will skip checking the server's current API version on initializing the client
620626
"""
621-
client_version = '1.4.17'
627+
client_version = '1.4.18'
622628

623629
def __init__(self, api_key: str = None, server: str = None, client_options: ClientOptions = None, skip_version_check: bool = False, include_tb: bool = False):
624630
self.api_key = api_key
@@ -3612,6 +3618,9 @@ def run_workflow_graph(self, workflow_graph: WorkflowGraph, sample_user_inputs:
36123618
return workflow_info['run_info']
36133619

36143620
def execute_workflow_node(self, node: WorkflowGraphNode, inputs: dict):
3621+
"""
3622+
Executes a workflow node.
3623+
"""
36153624
source_code = None
36163625
function_name = None
36173626
if node.template_metadata:

abacusai/nlp_chat_response.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from .return_class import AbstractApiClass
2+
3+
4+
class NlpChatResponse(AbstractApiClass):
5+
"""
6+
A chat response from an LLM
7+
8+
Args:
9+
client (ApiClient): An authenticated API Client instance
10+
deploymentConversationId (str): The unique identifier of the deployment conversation.
11+
messages (list): The conversation messages in the chat.
12+
"""
13+
14+
def __init__(self, client, deploymentConversationId=None, messages=None):
15+
super().__init__(client, None)
16+
self.deployment_conversation_id = deploymentConversationId
17+
self.messages = messages
18+
self.deprecated_keys = {}
19+
20+
def __repr__(self):
21+
repr_dict = {f'deployment_conversation_id': repr(
22+
self.deployment_conversation_id), f'messages': repr(self.messages)}
23+
class_name = "NlpChatResponse"
24+
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
25+
) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
26+
return f"{class_name}({repr_str})"
27+
28+
def to_dict(self):
29+
"""
30+
Get a dict representation of the parameters in this class
31+
32+
Returns:
33+
dict: The dict value representation of the class parameters
34+
"""
35+
resp = {'deployment_conversation_id': self.deployment_conversation_id,
36+
'messages': self.messages}
37+
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}

abacusai/playground_text.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from .return_class import AbstractApiClass
2+
3+
4+
class PlaygroundText(AbstractApiClass):
5+
"""
6+
The text content inside of a playground segment.
7+
8+
Args:
9+
client (ApiClient): An authenticated API Client instance
10+
playgroundText (str): The text of the playground segment.
11+
renderingCode (str): The rendering code of the playground segment.
12+
"""
13+
14+
def __init__(self, client, playgroundText=None, renderingCode=None):
15+
super().__init__(client, None)
16+
self.playground_text = playgroundText
17+
self.rendering_code = renderingCode
18+
self.deprecated_keys = {}
19+
20+
def __repr__(self):
21+
repr_dict = {f'playground_text': repr(
22+
self.playground_text), f'rendering_code': repr(self.rendering_code)}
23+
class_name = "PlaygroundText"
24+
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
25+
) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
26+
return f"{class_name}({repr_str})"
27+
28+
def to_dict(self):
29+
"""
30+
Get a dict representation of the parameters in this class
31+
32+
Returns:
33+
dict: The dict value representation of the class parameters
34+
"""
35+
resp = {'playground_text': self.playground_text,
36+
'rendering_code': self.rendering_code}
37+
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}

docs/.buildinfo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
2-
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 787e52a6c82af449544cb6a1253baab3
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 12535596649b36dd1c7e0cddf2d1e3b2
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

0 commit comments

Comments
 (0)