Skip to content

Commit bef2569

Browse files
committed
Version 1.4.34
1 parent 8d3ff03 commit bef2569

File tree

281 files changed

+2018
-666
lines changed

Some content is hidden

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

281 files changed

+2018
-666
lines changed

abacusai/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
from .eda_feature_collinearity import EdaFeatureCollinearity
8282
from .eda_forecasting_analysis import EdaForecastingAnalysis
8383
from .eda_version import EdaVersion
84+
from .edit_image_models import EditImageModels
8485
from .embedding_feature_drift_distribution import EmbeddingFeatureDriftDistribution
8586
from .execute_feature_group_operation import ExecuteFeatureGroupOperation
8687
from .external_application import ExternalApplication
@@ -238,4 +239,4 @@
238239
from .workflow_node_template import WorkflowNodeTemplate
239240

240241

241-
__version__ = "1.4.33"
242+
__version__ = "1.4.34"

abacusai/api_class/dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def _detect_ocr_mode(self):
7575
return OcrMode.DEFAULT
7676
elif self.document_type == DocumentType.TABLES_AND_FORMS:
7777
return OcrMode.LAYOUT
78+
elif self.document_type == DocumentType.COMPREHENSIVE_MARKDOWN:
79+
return OcrMode.COMPREHENSIVE_TABLE_MD
7880
elif self.document_type == DocumentType.EMBEDDED_IMAGES:
7981
return OcrMode.SCANNED
8082
elif self.document_type == DocumentType.SCANNED_TEXT:

abacusai/api_class/enums.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,11 +627,12 @@ def aws_ocr_modes(cls):
627627

628628

629629
class DocumentType(ApiEnum):
630-
SIMPLE_TEXT = 'SIMPLE_TEXT' # digital text
631-
TEXT = 'TEXT' # general text with OCR
632-
TABLES_AND_FORMS = 'TABLES_AND_FORMS' # tables and forms with OCR
633-
EMBEDDED_IMAGES = 'EMBEDDED_IMAGES' # embedded images with OCR TODO: remove?
634-
SCANNED_TEXT = 'SCANNED_TEXT' # scanned text with OCR
630+
SIMPLE_TEXT = 'SIMPLE_TEXT' # digital text
631+
TEXT = 'TEXT' # general text with OCR
632+
TABLES_AND_FORMS = 'TABLES_AND_FORMS' # tables and forms with OCR
633+
EMBEDDED_IMAGES = 'EMBEDDED_IMAGES' # embedded images with OCR TODO: remove?
634+
SCANNED_TEXT = 'SCANNED_TEXT' # scanned text with OCR
635+
COMPREHENSIVE_MARKDOWN = 'COMPREHENSIVE_MARKDOWN' # comprehensive text with Gemini OCR
635636

636637
@classmethod
637638
def is_ocr_forced(cls, document_type: 'DocumentType'):
@@ -729,3 +730,10 @@ class DeploymentConversationType(ApiEnum):
729730
COMPUTER_AGENT = 'COMPUTER_AGENT'
730731
SEARCH_LLM = 'SEARCH_LLM'
731732
APP_LLM = 'APP_LLM'
733+
TEST_AGENT = 'TEST_AGENT'
734+
735+
736+
class AgentClientType(ApiEnum):
737+
CHAT_UI = 'CHAT_UI'
738+
MESSAGING_APP = 'MESSAGING_APP'
739+
API = 'API'

abacusai/api_class/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ class ChatLLMTrainingConfig(TrainingConfig):
486486
response_format: (str): When set to 'JSON', the LLM will generate a JSON formatted string.
487487
json_response_instructions (str): Instructions to be followed while generating the json_response if `response_format` is set to "JSON". This can include the schema information if the schema is dynamic and its keys cannot be pre-determined.
488488
json_response_schema (str): Specifies the JSON schema that the model should adhere to if `response_format` is set to "JSON". This should be a json-formatted string where each field of the expected schema is mapped to a dictionary containing the fields 'type', 'required' and 'description'. For example - '{"sample_field": {"type": "integer", "required": true, "description": "Sample Field"}}'
489+
mask_pii (bool): Mask PII in the prompts and uploaded documents before sending it to the LLM.
489490
"""
490491
document_retrievers: List[str] = dataclasses.field(default=None)
491492
num_completion_tokens: int = dataclasses.field(default=None)
@@ -522,6 +523,7 @@ class ChatLLMTrainingConfig(TrainingConfig):
522523
response_format: str = dataclasses.field(default=None)
523524
json_response_instructions: str = dataclasses.field(default=None)
524525
json_response_schema: str = dataclasses.field(default=None)
526+
mask_pii: bool = dataclasses.field(default=None)
525527

526528
def __post_init__(self):
527529
self.problem_type = enums.ProblemType.CHAT_LLM

abacusai/client.py

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@
3333
from .annotation_entry import AnnotationEntry
3434
from .annotations_status import AnnotationsStatus
3535
from .api_class import (
36-
AgentInterface, AlertActionConfig, AlertConditionConfig, ApiClass, ApiEnum,
37-
ApplicationConnectorDatasetConfig, ApplicationConnectorType,
38-
AttachmentParsingConfig, BatchPredictionArgs, Blob, BlobInput, CPUSize,
39-
DatasetDocumentProcessingConfig, DataType, DeploymentConversationType,
40-
DocumentProcessingConfig, EvalArtifactType, FeatureGroupExportConfig,
41-
ForecastingMonitorConfig, IncrementalDatabaseConnectorConfig, LLMName,
42-
MemorySize, MergeConfig, OperatorConfig, ParsingConfig,
43-
PredictionArguments, ProblemType, ProjectFeatureGroupConfig,
44-
PythonFunctionType, ResponseSection, SamplingConfig, Segment,
45-
StreamingConnectorDatasetConfig, TrainingConfig, VectorStoreConfig,
46-
WorkflowGraph, WorkflowGraphNode, WorkflowNodeTemplateConfig,
47-
get_clean_function_source_code_for_agent
36+
AgentClientType, AgentInterface, AlertActionConfig, AlertConditionConfig,
37+
ApiClass, ApiEnum, ApplicationConnectorDatasetConfig,
38+
ApplicationConnectorType, AttachmentParsingConfig, BatchPredictionArgs,
39+
Blob, BlobInput, CPUSize, DatasetDocumentProcessingConfig, DataType,
40+
DeploymentConversationType, DocumentProcessingConfig, EvalArtifactType,
41+
FeatureGroupExportConfig, ForecastingMonitorConfig,
42+
IncrementalDatabaseConnectorConfig, LLMName, MemorySize, MergeConfig,
43+
OperatorConfig, ParsingConfig, PredictionArguments, ProblemType,
44+
ProjectFeatureGroupConfig, PythonFunctionType, ResponseSection,
45+
SamplingConfig, Segment, StreamingConnectorDatasetConfig, TrainingConfig,
46+
VectorStoreConfig, WorkflowGraph, WorkflowGraphNode,
47+
WorkflowNodeTemplateConfig, get_clean_function_source_code_for_agent
4848
)
4949
from .api_class.abstract import get_clean_function_source_code, get_clean_function_source_code_for_agent, snake_case
5050
from .api_class.ai_agents import WorkflowGraph, WorkflowNodeTemplateConfig
@@ -652,7 +652,7 @@ class BaseApiClient:
652652
client_options (ClientOptions): Optional API client configurations
653653
skip_version_check (bool): If true, will skip checking the server's current API version on initializing the client
654654
"""
655-
client_version = '1.4.33'
655+
client_version = '1.4.34'
656656

657657
def __init__(self, api_key: str = None, server: str = None, client_options: ClientOptions = None, skip_version_check: bool = False, include_tb: bool = False):
658658
self.api_key = api_key
@@ -3802,6 +3802,20 @@ def execute_feature_group_sql(self, sql, fix_query_on_error: bool = False, timeo
38023802
execute_query.wait_for_execution(timeout=timeout, delay=delay)
38033803
return execute_query.load_as_pandas()
38043804

3805+
def _get_agent_client_type(self):
3806+
"""
3807+
Returns the client type for the current request context.
3808+
3809+
Returns:
3810+
AgentClientType: The client type for the current request context.
3811+
"""
3812+
if self._is_async_app_caller():
3813+
return AgentClientType.MESSAGING_APP
3814+
elif self._is_proxy_app_caller():
3815+
return AgentClientType.CHAT_UI
3816+
else:
3817+
return AgentClientType.API
3818+
38053819
def get_agent_context_chat_history(self):
38063820
"""
38073821
Gets a history of chat messages from the current request context. Applicable within a AIAgent
@@ -3930,20 +3944,23 @@ def get_agent_context_user_info(self):
39303944
user_info = get_object_from_context(
39313945
self, _request_context, 'user_info', dict)
39323946
if user_info:
3947+
user_info['client_type'] = self._get_agent_client_type()
39333948
return user_info
39343949
else:
39353950
raise ValueError(
39363951
'User information not available. Please use UI interface for this agent to work.')
39373952

39383953
def get_runtime_config(self, key: str):
39393954
"""
3940-
Gets the deployment level runtime config value given the key
3955+
Retrieve the value of a specified configuration key from the deployment's runtime settings.
3956+
These settings can be configured in the deployment details page in the UI.
3957+
Currently supported for AI Agents, Custom Python Model and Prediction Operators.
39413958

39423959
Args:
3943-
key(str): Key for which the config value is to be fetched
3960+
key (str): The configuration key whose value is to be fetched.
39443961

39453962
Returns:
3946-
str: Config value for the input key
3963+
str: The value associated with the specified configuration key, or None if the key does not exist.
39473964
"""
39483965
runtime_config = get_object_from_context(
39493966
self, _request_context, 'deployment_runtime_config', dict) or {}
@@ -8019,7 +8036,7 @@ def get_feature_group_row_process_logs_by_key(self, deployment_id: str, primary_
80198036
FeatureGroupRowProcessLogs: An object representing the logs for the feature group row process"""
80208037
return self._call_api('getFeatureGroupRowProcessLogsByKey', 'POST', query_params={'deploymentId': deployment_id}, body={'primaryKeyValue': primary_key_value}, parse_type=FeatureGroupRowProcessLogs)
80218038

8022-
def create_python_function(self, name: str, source_code: str = None, function_name: str = None, function_variable_mappings: List = None, package_requirements: list = None, function_type: str = 'FEATURE_GROUP', description: str = None, examples: dict = None, user_level_connectors: Dict = None, org_level_connectors: list = None, output_variable_mappings: List = None) -> PythonFunction:
8039+
def create_python_function(self, name: str, source_code: str = None, function_name: str = None, function_variable_mappings: List = None, package_requirements: list = None, function_type: str = 'FEATURE_GROUP', description: str = None, examples: dict = None, user_level_connectors: Dict = None, org_level_connectors: List = None, output_variable_mappings: List = None) -> PythonFunction:
80238040
"""Creates a custom Python function that is reusable.
80248041

80258042
Args:
@@ -8032,7 +8049,7 @@ def create_python_function(self, name: str, source_code: str = None, function_na
80328049
description (str): Description of the Python function. This should include details about the function's purpose, expected inputs and outputs, and any important usage considerations or limitations.
80338050
examples (dict): Dictionary containing example use cases and anti-patterns. Should include 'positive_examples' showing recommended usage and 'negative_examples' showing cases to avoid.])
80348051
user_level_connectors (Dict): Dictionary containing user level connectors.
8035-
org_level_connectors (list): List containing organization level connectors.
8052+
org_level_connectors (List): List containing organization level connectors.
80368053
output_variable_mappings (List): List of output variable mappings that defines the elements of the function's return value.
80378054

80388055
Returns:

abacusai/constants_autocomplete_response.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@ class ConstantsAutocompleteResponse(AbstractApiClass):
1313
recordUserAction (bool): Whether to record user action.
1414
validateSuggestion (bool): Whether to validate the suggestion.
1515
validationLinesThreshold (int): The number of lines to validate the suggestion.
16+
maxTrackedRecentChanges (int): The maximum number of recent file changes to track.
1617
"""
1718

18-
def __init__(self, client, maxPendingRequests=None, acceptanceDelay=None, debounceDelay=None, recordUserAction=None, validateSuggestion=None, validationLinesThreshold=None):
19+
def __init__(self, client, maxPendingRequests=None, acceptanceDelay=None, debounceDelay=None, recordUserAction=None, validateSuggestion=None, validationLinesThreshold=None, maxTrackedRecentChanges=None):
1920
super().__init__(client, None)
2021
self.max_pending_requests = maxPendingRequests
2122
self.acceptance_delay = acceptanceDelay
2223
self.debounce_delay = debounceDelay
2324
self.record_user_action = recordUserAction
2425
self.validate_suggestion = validateSuggestion
2526
self.validation_lines_threshold = validationLinesThreshold
27+
self.max_tracked_recent_changes = maxTrackedRecentChanges
2628
self.deprecated_keys = {}
2729

2830
def __repr__(self):
2931
repr_dict = {f'max_pending_requests': repr(self.max_pending_requests), f'acceptance_delay': repr(self.acceptance_delay), f'debounce_delay': repr(self.debounce_delay), f'record_user_action': repr(
30-
self.record_user_action), f'validate_suggestion': repr(self.validate_suggestion), f'validation_lines_threshold': repr(self.validation_lines_threshold)}
32+
self.record_user_action), f'validate_suggestion': repr(self.validate_suggestion), f'validation_lines_threshold': repr(self.validation_lines_threshold), f'max_tracked_recent_changes': repr(self.max_tracked_recent_changes)}
3133
class_name = "ConstantsAutocompleteResponse"
3234
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
3335
) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
@@ -40,6 +42,6 @@ def to_dict(self):
4042
Returns:
4143
dict: The dict value representation of the class parameters
4244
"""
43-
resp = {'max_pending_requests': self.max_pending_requests, 'acceptance_delay': self.acceptance_delay, 'debounce_delay': self.debounce_delay,
44-
'record_user_action': self.record_user_action, 'validate_suggestion': self.validate_suggestion, 'validation_lines_threshold': self.validation_lines_threshold}
45+
resp = {'max_pending_requests': self.max_pending_requests, 'acceptance_delay': self.acceptance_delay, 'debounce_delay': self.debounce_delay, 'record_user_action': self.record_user_action,
46+
'validate_suggestion': self.validate_suggestion, 'validation_lines_threshold': self.validation_lines_threshold, 'max_tracked_recent_changes': self.max_tracked_recent_changes}
4547
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}

abacusai/edit_image_models.py

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

docs/_sources/autoapi/abacusai/api_class/enums/index.rst.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Classes
7575
abacusai.api_class.enums.ResponseSectionType
7676
abacusai.api_class.enums.CodeLanguage
7777
abacusai.api_class.enums.DeploymentConversationType
78+
abacusai.api_class.enums.AgentClientType
7879

7980

8081
Functions
@@ -2654,6 +2655,11 @@ Module Contents
26542655

26552656

26562657

2658+
.. py:attribute:: COMPREHENSIVE_MARKDOWN
2659+
:value: 'COMPREHENSIVE_MARKDOWN'
2660+
2661+
2662+
26572663
.. py:method:: is_ocr_forced(document_type)
26582664
:classmethod:
26592665

@@ -3034,3 +3040,33 @@ Module Contents
30343040

30353041

30363042

3043+
.. py:attribute:: TEST_AGENT
3044+
:value: 'TEST_AGENT'
3045+
3046+
3047+
3048+
.. py:class:: AgentClientType
3049+
3050+
Bases: :py:obj:`ApiEnum`
3051+
3052+
3053+
Generic enumeration.
3054+
3055+
Derive from this class to define new enumerations.
3056+
3057+
3058+
.. py:attribute:: CHAT_UI
3059+
:value: 'CHAT_UI'
3060+
3061+
3062+
3063+
.. py:attribute:: MESSAGING_APP
3064+
:value: 'MESSAGING_APP'
3065+
3066+
3067+
3068+
.. py:attribute:: API
3069+
:value: 'API'
3070+
3071+
3072+

docs/_sources/autoapi/abacusai/api_class/index.rst.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Classes
191191
abacusai.api_class.ResponseSectionType
192192
abacusai.api_class.CodeLanguage
193193
abacusai.api_class.DeploymentConversationType
194+
abacusai.api_class.AgentClientType
194195
abacusai.api_class.ApiClass
195196
abacusai.api_class._ApiClassFactory
196197
abacusai.api_class.DocumentProcessingConfig
@@ -2019,6 +2020,11 @@ Package Contents
20192020

20202021

20212022

2023+
.. py:attribute:: COMPREHENSIVE_MARKDOWN
2024+
:value: 'COMPREHENSIVE_MARKDOWN'
2025+
2026+
2027+
20222028
.. py:method:: is_ocr_forced(document_type)
20232029
:classmethod:
20242030

@@ -6146,6 +6152,11 @@ Package Contents
61466152

61476153

61486154

6155+
.. py:attribute:: COMPREHENSIVE_MARKDOWN
6156+
:value: 'COMPREHENSIVE_MARKDOWN'
6157+
6158+
6159+
61496160
.. py:method:: is_ocr_forced(document_type)
61506161
:classmethod:
61516162

@@ -6526,6 +6537,36 @@ Package Contents
65266537

65276538

65286539

6540+
.. py:attribute:: TEST_AGENT
6541+
:value: 'TEST_AGENT'
6542+
6543+
6544+
6545+
.. py:class:: AgentClientType
6546+
6547+
Bases: :py:obj:`ApiEnum`
6548+
6549+
6550+
Generic enumeration.
6551+
6552+
Derive from this class to define new enumerations.
6553+
6554+
6555+
.. py:attribute:: CHAT_UI
6556+
:value: 'CHAT_UI'
6557+
6558+
6559+
6560+
.. py:attribute:: MESSAGING_APP
6561+
:value: 'MESSAGING_APP'
6562+
6563+
6564+
6565+
.. py:attribute:: API
6566+
:value: 'API'
6567+
6568+
6569+
65296570
.. py:class:: ApiClass
65306571
65316572
Bases: :py:obj:`abc.ABC`
@@ -8863,6 +8904,8 @@ Package Contents
88638904
:type json_response_instructions: str
88648905
:param json_response_schema: Specifies the JSON schema that the model should adhere to if `response_format` is set to "JSON". This should be a json-formatted string where each field of the expected schema is mapped to a dictionary containing the fields 'type', 'required' and 'description'. For example - '{"sample_field": {"type": "integer", "required": true, "description": "Sample Field"}}'
88658906
:type json_response_schema: str
8907+
:param mask_pii: Mask PII in the prompts and uploaded documents before sending it to the LLM.
8908+
:type mask_pii: bool
88668909

88678910

88688911
.. py:attribute:: document_retrievers
@@ -9075,6 +9118,12 @@ Package Contents
90759118

90769119

90779120

9121+
.. py:attribute:: mask_pii
9122+
:type: bool
9123+
:value: None
9124+
9125+
9126+
90789127
.. py:method:: __post_init__()
90799128
90809129

0 commit comments

Comments
 (0)