abacusai.api_class.abstract

Attributes

FIRST_CAP_RE

ALL_CAP_RE

Classes

ApiClass

Helper class that provides a standard way to create an ABC using

_ApiClassFactory

Helper class that provides a standard way to create an ABC using

Functions

_validate_instance(value, expected_type)

_get_user_friendly_type_name(typename)

validate_class_method_annotations([classname, ...])

validate_constructor_arg_types([friendly_class_name])

camel_case(value)

upper_snake_case(value)

snake_case(value)

get_clean_function_source_code(func)

get_clean_function_source_code_for_agent(func)

get_source_code(func)

Module Contents

abacusai.api_class.abstract.FIRST_CAP_RE
abacusai.api_class.abstract.ALL_CAP_RE
abacusai.api_class.abstract._validate_instance(value, expected_type)
abacusai.api_class.abstract._get_user_friendly_type_name(typename)
abacusai.api_class.abstract.validate_class_method_annotations(classname=None, friendly_class_name=None)
abacusai.api_class.abstract.validate_constructor_arg_types(friendly_class_name=None)
abacusai.api_class.abstract.camel_case(value)
abacusai.api_class.abstract.upper_snake_case(value)
abacusai.api_class.abstract.snake_case(value)
abacusai.api_class.abstract.get_clean_function_source_code(func)
Parameters:

func (Callable)

abacusai.api_class.abstract.get_clean_function_source_code_for_agent(func)
Parameters:

func (Callable)

abacusai.api_class.abstract.get_source_code(func)
Parameters:

func (Callable)

class abacusai.api_class.abstract.ApiClass

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

_upper_snake_case_keys: bool
_support_kwargs: bool
__post_init__()
classmethod _get_builder()
__str__()
_repr_html_()
__getitem__(item)
Parameters:

item (str)

__setitem__(item, value)
Parameters:
  • item (str)

  • value (Any)

_unset_item(item)
Parameters:

item (str)

get(item, default=None)
Parameters:
  • item (str)

  • default (Any)

pop(item, default=NotImplemented)
Parameters:
  • item (str)

  • default (Any)

to_dict()

Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.

classmethod from_dict(input_dict)
Parameters:

input_dict (dict)

class abacusai.api_class.abstract._ApiClassFactory

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

config_abstract_class = None
config_class_key = None
config_class_map
classmethod from_dict(config)
Parameters:

config (dict)

Return type:

ApiClass