Skip to content

Commit

Permalink
Version 1.4.21
Browse files Browse the repository at this point in the history
  • Loading branch information
abishekt51 committed Nov 28, 2024
1 parent a22e0d9 commit 88a57fd
Show file tree
Hide file tree
Showing 275 changed files with 1,335 additions and 662 deletions.
3 changes: 2 additions & 1 deletion abacusai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .api_endpoint import ApiEndpoint
from .api_key import ApiKey
from .app_user_group import AppUserGroup
from .app_user_group_sign_in_token import AppUserGroupSignInToken
from .application_connector import ApplicationConnector
from .batch_prediction import BatchPrediction
from .batch_prediction_version import BatchPredictionVersion
Expand Down Expand Up @@ -224,4 +225,4 @@
from .workflow_node_template import WorkflowNodeTemplate


__version__ = "1.4.20"
__version__ = "1.4.21"
2 changes: 1 addition & 1 deletion abacusai/api_class/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ class ApplicationConnectorType(ApiEnum):
GOOGLECALENDAR = 'GOOGLECALENDAR'
GOOGLESHEETS = 'GOOGLESHEETS'
GOOGLEDOCS = 'GOOGLEDOCS'
ONEDRIVEUSER = 'ONEDRIVEUSER'
TEAMSSCRAPER = 'TEAMSSCRAPER'
GITHUBUSER = 'GITHUBUSER'
OKTASAML = 'OKTASAML'
Expand Down Expand Up @@ -484,6 +483,7 @@ class LLMName(ApiEnum):
ABACUS_DRACARYS = 'ABACUS_DRACARYS'
QWEN_2_5_32B = 'QWEN_2_5_32B'
GEMINI_1_5_FLASH = 'GEMINI_1_5_FLASH'
XAI_GROK = 'XAI_GROK'


class MonitorAlertType(ApiEnum):
Expand Down
2 changes: 1 addition & 1 deletion abacusai/api_class/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ConstraintConfig(ApiClass):
Args:
constant (float): The constant value for the constraint.
operator (str): The operator for the constraint. Could be 'EQ', 'LE', 'GE'
enforcement (str): The enforcement for the constraint. Could be 'HARD' or 'SOFT'. Default is 'HARD'
enforcement (str): The enforcement for the constraint. Could be 'HARD' or 'SOFT' or 'SKIP'. Default is 'HARD'
code (str): The code for the constraint.
penalty (float): The penalty for violating the constraint.
"""
Expand Down
4 changes: 2 additions & 2 deletions abacusai/api_client_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ def get_pandas_pages_df(cls, df, feature_group_version: str, doc_id_column: str,
chunk_size = 10 * 1024 * 1024

pages_df_with_config = None
df_with_config = df[df[document_column].apply(
lambda x: isinstance(x, dict) and cls.DOCUMENT_PROCESSING_CONFIG in x)]
df_with_config = df[df[document_column].apply(lambda x: isinstance(
x, dict) and x.get(cls.DOCUMENT_PROCESSING_CONFIG) is not None)]
df = df[~df[doc_id_column].isin(df_with_config[doc_id_column])]

if len(df_with_config) > 0:
Expand Down
33 changes: 33 additions & 0 deletions abacusai/app_user_group_sign_in_token.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from .return_class import AbstractApiClass


class AppUserGroupSignInToken(AbstractApiClass):
"""
User Group Sign In Token
Args:
client (ApiClient): An authenticated API Client instance
token (str): The token to sign in the user
"""

def __init__(self, client, token=None):
super().__init__(client, None)
self.token = token
self.deprecated_keys = {}

def __repr__(self):
repr_dict = {f'token': repr(self.token)}
class_name = "AppUserGroupSignInToken"
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])
return f"{class_name}({repr_str})"

def to_dict(self):
"""
Get a dict representation of the parameters in this class
Returns:
dict: The dict value representation of the class parameters
"""
resp = {'token': self.token}
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}
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
26 changes: 21 additions & 5 deletions abacusai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from .api_endpoint import ApiEndpoint
from .api_key import ApiKey
from .app_user_group import AppUserGroup
from .app_user_group_sign_in_token import AppUserGroupSignInToken
from .application_connector import ApplicationConnector
from .batch_prediction import BatchPrediction
from .batch_prediction_version import BatchPredictionVersion
Expand Down Expand Up @@ -640,7 +641,7 @@ class BaseApiClient:
client_options (ClientOptions): Optional API client configurations
skip_version_check (bool): If true, will skip checking the server's current API version on initializing the client
"""
client_version = '1.4.20'
client_version = '1.4.21'

def __init__(self, api_key: str = None, server: str = None, client_options: ClientOptions = None, skip_version_check: bool = False, include_tb: bool = False):
self.api_key = api_key
Expand Down Expand Up @@ -832,7 +833,7 @@ def _call_api(

def _proxy_request(self, name: str, method: str = 'POST', query_params: dict = None, body: dict = None, data: dict = None, files=None, parse_type=None, is_sync: bool = False, streamable_response: bool = False):
headers = {'APIKEY': self.api_key}
deployment_id = os.getenv('ABACUS_DEPLOYMENT_ID')
deployment_id = os.getenv('ABACUS_EXEC_SERVICE_DEPLOYMENT_ID')
if deployment_id:
query_params = {**(query_params or {}),
'environmentDeploymentId': deployment_id}
Expand Down Expand Up @@ -2585,6 +2586,18 @@ def list_organization_secrets(self) -> List[OrganizationSecret]:
list[OrganizationSecret]: list of secrets belonging to the organization."""
return self._call_api('listOrganizationSecrets', 'GET', query_params={}, parse_type=OrganizationSecret)

def get_app_user_group_sign_in_token(self, user_group_id: str, email: str, name: str) -> AppUserGroupSignInToken:
"""Get a token for a user group user to sign in.

Args:
user_group_id (str): The ID of the user group.
email (str): The email of the user.
name (str): The name of the user.

Returns:
AppUserGroupSignInToken: The token to sign in the user"""
return self._call_api('getAppUserGroupSignInToken', 'GET', query_params={'userGroupId': user_group_id, 'email': email, 'name': name}, parse_type=AppUserGroupSignInToken)

def query_feature_group_code_generator(self, query: str, language: str, project_id: str = None) -> LlmResponse:
"""Send a query to the feature group code generator tool to generate code for the query.

Expand Down Expand Up @@ -4420,7 +4433,8 @@ def set_scoped_cache_value(self, key: str, value: str, expiration_time: int = 21
Raises:
InvalidParameterError: If key, value or expiration_time is invalid.
"""
scope = self.cache_scope or os.getenv('ABACUS_DEPLOYMENT_ID')
scope = self.cache_scope or os.getenv(
'ABACUS_EXEC_SERVICE_DEPLOYMENT_ID')
if scope:
return self._proxy_request('_setScopedCacheValue', 'POST', body={'key': key, 'value': value, 'scope': scope, 'expirationTime': expiration_time}, is_sync=True)
else:
Expand All @@ -4440,7 +4454,8 @@ def get_scoped_cache_value(self, key: str):
Raises:
Generic404Error: if the key doesn't exist.
"""
scope = self.cache_scope or os.getenv('ABACUS_DEPLOYMENT_ID')
scope = self.cache_scope or os.getenv(
'ABACUS_EXEC_SERVICE_DEPLOYMENT_ID')
if scope:
return self._proxy_request('_getScopedCacheValue', 'GET', query_params={'key': key, 'scope': scope}, is_sync=True)
else:
Expand All @@ -4460,7 +4475,8 @@ def delete_scoped_cache_key(self, key: str):
Returns:
None
"""
scope = self.cache_scope or os.getenv('ABACUS_DEPLOYMENT_ID')
scope = self.cache_scope or os.getenv(
'ABACUS_EXEC_SERVICE_DEPLOYMENT_ID')
if scope:
return self._proxy_request('_deleteScopedCacheKey', 'POST', query_params={'key': key, 'scope': scope}, is_sync=True)
else:
Expand Down
10 changes: 3 additions & 7 deletions abacusai/code_edit_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ class CodeEditResponse(AbstractApiClass):
Args:
client (ApiClient): An authenticated API Client instance
codeChanges (list): The code changes to be applied.
deploymentConversationId (str): The unique identifier of the deployment conversation.
"""

def __init__(self, client, codeChanges=None, deploymentConversationId=None):
def __init__(self, client, codeChanges=None):
super().__init__(client, None)
self.code_changes = codeChanges
self.deployment_conversation_id = deploymentConversationId
self.deprecated_keys = {}

def __repr__(self):
repr_dict = {f'code_changes': repr(
self.code_changes), f'deployment_conversation_id': repr(self.deployment_conversation_id)}
repr_dict = {f'code_changes': repr(self.code_changes)}
class_name = "CodeEditResponse"
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 @@ -32,6 +29,5 @@ def to_dict(self):
Returns:
dict: The dict value representation of the class parameters
"""
resp = {'code_changes': self.code_changes,
'deployment_conversation_id': self.deployment_conversation_id}
resp = {'code_changes': self.code_changes}
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}
6 changes: 3 additions & 3 deletions abacusai/feature_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,13 +1199,13 @@ def load_as_pandas(self):
latest_version = self.materialize().latest_feature_group_version
return latest_version.load_as_pandas()

def load_as_pandas_documents(self, doc_id_column: str, document_column: str):
def load_as_pandas_documents(self, doc_id_column: str = 'doc_id', document_column: str = 'page_infos'):
"""
Loads a feature group with documents data into a pandas dataframe.
Args:
doc_id_feature (str): The name of the feature / column containing the document ID.
document_feature (str): The name of the feature / column which either contains the document data itself or page infos with path to remotely stored documents. This column will be replaced with the extracted document data.
doc_id_column (str): The name of the feature / column containing the document ID.
document_column (str): The name of the feature / column which either contains the document data itself or page infos with path to remotely stored documents. This column will be replaced with the extracted document data.
Returns:
DataFrame: A pandas dataframe containing the extracted document data.
Expand Down
6 changes: 3 additions & 3 deletions abacusai/feature_group_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ def load_as_pandas(self, max_workers=10):
'_getFeatureGroupVersionParts', 'GET', query_params={'featureGroupVersion': self.id}, retry_500=True)
return load_as_pandas_from_avro_files(file_parts, self._download_avro_file, max_workers=max_workers)

def load_as_pandas_documents(self, doc_id_column: str, document_column: str, max_workers=10):
def load_as_pandas_documents(self, doc_id_column: str = 'doc_id', document_column: str = 'page_infos', max_workers=10):
"""
Loads a feature group with documents data into a pandas dataframe.
Args:
doc_id_feature (str): The name of the feature / column containing the document ID.
document_feature (str): The name of the feature / column which either contains the document data itself or page infos with path to remotely stored documents. This column will be replaced with the extracted document data.
doc_id_column (str): The name of the feature / column containing the document ID.
document_column (str): The name of the feature / column which either contains the document data itself or page infos with path to remotely stored documents. This column will be replaced with the extracted document data.
max_workers (int): The number of threads.
Returns:
Expand Down
33 changes: 8 additions & 25 deletions abacusai/video_gen_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,19 @@ class VideoGenSettings(AbstractApiClass):
Args:
client (ApiClient): An authenticated API Client instance
prompt (dict): The prompt for the video.
negativePrompt (dict): The negative prompt for the video.
cfgScale (dict): The flexibility scale for video generation.
mode (dict): The video generation mode (standard or professional).
aspectRatio (dict): The aspect ratio of the video in seconds.
duration (dict): The duration of the video.
loop (dict): Whether the video should loop.
startFrame (dict): The start frame of the video.
endFrame (dict): The end frame of the video.
rewritePrompt (dict): Whether to rewrite the prompt.
model (dict): The model settings.
settings (dict): The settings for each model.
"""

def __init__(self, client, prompt=None, negativePrompt=None, cfgScale=None, mode=None, aspectRatio=None, duration=None, loop=None, startFrame=None, endFrame=None, rewritePrompt=None):
def __init__(self, client, model=None, settings=None):
super().__init__(client, None)
self.prompt = prompt
self.negative_prompt = negativePrompt
self.cfg_scale = cfgScale
self.mode = mode
self.aspect_ratio = aspectRatio
self.duration = duration
self.loop = loop
self.start_frame = startFrame
self.end_frame = endFrame
self.rewrite_prompt = rewritePrompt
self.model = model
self.settings = settings
self.deprecated_keys = {}

def __repr__(self):
repr_dict = {f'prompt': repr(self.prompt), f'negative_prompt': repr(self.negative_prompt), f'cfg_scale': repr(self.cfg_scale), f'mode': repr(self.mode), f'aspect_ratio': repr(
self.aspect_ratio), f'duration': repr(self.duration), f'loop': repr(self.loop), f'start_frame': repr(self.start_frame), f'end_frame': repr(self.end_frame), f'rewrite_prompt': repr(self.rewrite_prompt)}
repr_dict = {f'model': repr(self.model),
f'settings': repr(self.settings)}
class_name = "VideoGenSettings"
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 @@ -48,6 +32,5 @@ def to_dict(self):
Returns:
dict: The dict value representation of the class parameters
"""
resp = {'prompt': self.prompt, 'negative_prompt': self.negative_prompt, 'cfg_scale': self.cfg_scale, 'mode': self.mode, 'aspect_ratio': self.aspect_ratio,
'duration': self.duration, 'loop': self.loop, 'start_frame': self.start_frame, 'end_frame': self.end_frame, 'rewrite_prompt': self.rewrite_prompt}
resp = {'model': self.model, 'settings': self.settings}
return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}
10 changes: 5 additions & 5 deletions docs/_sources/autoapi/abacusai/api_class/enums/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1769,11 +1769,6 @@ Module Contents



.. py:attribute:: ONEDRIVEUSER
:value: 'ONEDRIVEUSER'



.. py:attribute:: TEAMSSCRAPER
:value: 'TEAMSSCRAPER'

Expand Down Expand Up @@ -2119,6 +2114,11 @@ Module Contents



.. py:attribute:: XAI_GROK
:value: 'XAI_GROK'



.. py:class:: MonitorAlertType
Bases: :py:obj:`ApiEnum`
Expand Down
12 changes: 6 additions & 6 deletions docs/_sources/autoapi/abacusai/api_class/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4743,11 +4743,6 @@ Package Contents



.. py:attribute:: ONEDRIVEUSER
:value: 'ONEDRIVEUSER'



.. py:attribute:: TEAMSSCRAPER
:value: 'TEAMSSCRAPER'

Expand Down Expand Up @@ -5093,6 +5088,11 @@ Package Contents



.. py:attribute:: XAI_GROK
:value: 'XAI_GROK'



.. py:class:: MonitorAlertType
Bases: :py:obj:`ApiEnum`
Expand Down Expand Up @@ -9365,7 +9365,7 @@ Package Contents
:type constant: float
:param operator: The operator for the constraint. Could be 'EQ', 'LE', 'GE'
:type operator: str
:param enforcement: The enforcement for the constraint. Could be 'HARD' or 'SOFT'. Default is 'HARD'
:param enforcement: The enforcement for the constraint. Could be 'HARD' or 'SOFT' or 'SKIP'. Default is 'HARD'
:type enforcement: str
:param code: The code for the constraint.
:type code: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Module Contents
:type constant: float
:param operator: The operator for the constraint. Could be 'EQ', 'LE', 'GE'
:type operator: str
:param enforcement: The enforcement for the constraint. Could be 'HARD' or 'SOFT'. Default is 'HARD'
:param enforcement: The enforcement for the constraint. Could be 'HARD' or 'SOFT' or 'SKIP'. Default is 'HARD'
:type enforcement: str
:param code: The code for the constraint.
:type code: str
Expand Down
Loading

0 comments on commit 88a57fd

Please sign in to comment.