MCPcopy Create free account

hub / github.com/alvin-r/databonsai / functions

Functions54 in github.com/alvin-r/databonsai

↓ 7 callersMethodgenerate
Generates a text completion using the provider's API, with a given system and user prompt. This method should be decorated with retry
databonsai/llm_providers/llm_provider.py:24
↓ 6 callersMethodcategorize
Categorizes the input data using the specified LLM provider. Args: input_data (str): The text data to be categorized.
databonsai/categorize/base_categorizer.py:148
↓ 4 callersMethodvalidate_predicted_categories
( self, predicted_categories: List[str] )
databonsai/categorize/base_categorizer.py:217
↓ 3 callersMethodcategorize
Categorizes the input data into multiple categories using the specified LLM provider. Args: input_data (str): The text d
databonsai/categorize/multi_categorizer.py:92
↓ 2 callersFunctionapply_to_column_batch
Apply a function to each batch of values in a column of a DataFrame or a normal Python list, starting from a specified index. Parameters:
databonsai/utils/apply.py:62
↓ 2 callersFunctioncheck_func
(func)
databonsai/utils/apply.py:233
↓ 1 callersMethod_chat
(self, messages, options)
databonsai/llm_providers/ollama_provider.py:36
↓ 1 callersFunctionapply_to_column
Apply a function to each value in a column of a DataFrame or a normal Python list, starting from a specified index. Parameters: inpu
databonsai/utils/apply.py:6
↓ 1 callersMethodcategorize_batch
Categorizes the input data into multiple categories using the specified LLM provider. Args: input_data (str): The text d
databonsai/categorize/multi_categorizer.py:118
↓ 1 callersMethodcategorize_batch
Categorizes a batch of input data using the specified LLM provider. For less advanced LLMs, call this method on batches of 3-5 inputs (depend
databonsai/categorize/base_categorizer.py:180
↓ 1 callersMethodtransform
Transforms the input data using the specified LLM provider. Args: input_data (str): The text data to be transformed.
databonsai/transform/base_transformer.py:105
Method__init__
Initializes the LLMProvider with an API key and retry parameters. Parameters: model (str): The default model to use for tex
databonsai/llm_providers/llm_provider.py:8
Method__init__
Initializes the OllamaProvider with an optional Ollama client or host, and retry parameters. Parameters: model (str): The de
databonsai/llm_providers/ollama_provider.py:13
Method__init__
Initializes the ClaudeProvider with an API key and retry parameters. Parameters: api_key (str): Anthropic API key. m
databonsai/llm_providers/anthropic_provider.py:18
Method__init__
Initializes the OpenAIProvider with an API key and retry parameters. Parameters: api_key (str): OpenAI API key. mult
databonsai/llm_providers/openai_provider.py:18
Functionapply_to_column_autobatch
Apply a function to the input column using adaptive batch processing. This function applies a batch processing function to the input column,
databonsai/utils/apply.py:127
Methodcategory_mapping
(self)
databonsai/categorize/base_categorizer.py:91
Methodgenerate
Generates a text completion using Ollama's API, with a given system and user prompt. This method is decorated with retry logic to han
databonsai/llm_providers/ollama_provider.py:44
Methodgenerate
Generates a text completion using Anthropic's Claude API, with a given system and user prompt. This method is decorated with retry lo
databonsai/llm_providers/anthropic_provider.py:80
Methodgenerate
Generates a text completion using OpenAI's API, with a given system and user prompt. This method is decorated with retry logic to han
databonsai/llm_providers/openai_provider.py:85
Methodinverse_category_mapping
(self)
databonsai/categorize/base_categorizer.py:96
Methodretry_with_exponential_backoff
Decorator to apply retry logic with exponential backoff to an instance method. It captures the 'self' context to access instance attr
databonsai/llm_providers/anthropic_provider.py:61
Methodretry_with_exponential_backoff
Decorator to apply retry logic with exponential backoff to an instance method. It captures the 'self' context to access instance attr
databonsai/llm_providers/openai_provider.py:66
Functionsample_categories
()
tests/test_categorization.py:9
Functionsample_dataframe
()
tests/test_categorization.py:30
Functionsample_list
()
tests/test_categorization.py:45
Functionsample_provider
(request)
tests/test_categorization.py:25
Methodsystem_message
(self)
databonsai/categorize/multi_categorizer.py:38
Methodsystem_message
(self)
databonsai/categorize/base_categorizer.py:101
Methodsystem_message
(self)
databonsai/transform/base_transformer.py:69
Methodsystem_message
(self)
databonsai/transform/extract_transformer.py:95
Methodsystem_message_batch
(self)
databonsai/categorize/multi_categorizer.py:63
Methodsystem_message_batch
(self)
databonsai/categorize/base_categorizer.py:122
Methodsystem_message_batch
(self)
databonsai/transform/base_transformer.py:86
Functiontest_apply_to_column
Test the apply_to_column function.
tests/test_categorization.py:99
Functiontest_apply_to_column_batch
Test the apply_to_column_batch function.
tests/test_categorization.py:128
Functiontest_apply_to_column_batch_start_idx
Test the apply_to_column_batch function with a start index.
tests/test_categorization.py:159
Functiontest_base_categorizer
Test the BaseCategorizer class.
tests/test_categorization.py:55
Functiontest_base_categorizer_batch
Test the BaseCategorizer class with a batch of examples.
tests/test_categorization.py:76
Functiontest_multi_categorizer
Test the MultiCategorizer class.
tests/test_categorization.py:196
Functiontest_multi_categorizer_batch
Test the MultiCategorizer class with a batch of examples.
tests/test_categorization.py:228
Methodtransform
Transforms the input data into a list of dictionaries using the specified LLM provider. Args: input_data (str): The text
databonsai/transform/extract_transformer.py:114
Methodtransform_batch
Transforms a batch of input data using the specified LLM provider. Args: input_data (List[str]): A list of text data to
databonsai/transform/base_transformer.py:123
Methodvalidate_categories
Validates the categories dictionary. Args: v (Dict[str, str]): The categories dictionary to be validated. Raise
databonsai/categorize/base_categorizer.py:26
Methodvalidate_examples
Validates the examples list. Args: v (List[Dict[str, str]]): The examples list to be validated. Raises:
databonsai/categorize/base_categorizer.py:48
Methodvalidate_examples
Validates the examples list. Args: v (List[Dict[str, str]]): The examples list to be validated. Raises:
databonsai/transform/base_transformer.py:43
Methodvalidate_examples
Validates the examples list. Args: v (List[Dict[str, str]]): The examples list to be validated. Raises:
databonsai/transform/extract_transformer.py:40
Methodvalidate_examples_responses
Validates that the "response" values in the examples are within the categories keys. If there are multiple categories, they should be separat
databonsai/categorize/multi_categorizer.py:18
Methodvalidate_examples_responses
Validates that the "response" values in the examples are within the categories keys.
databonsai/categorize/base_categorizer.py:73
Methodvalidate_examples_responses
Validates that the "response" values in the examples are valid JSON-formatted lists of dictionaries that match the output schema.
databonsai/transform/extract_transformer.py:65
Methodvalidate_prompt
Validates the prompt. Args: v (str): The prompt to be validated. Raises: ValueError: If the prompt
databonsai/transform/base_transformer.py:25
Methodvalidate_schema
Validates the output schema. Args: v (Dict[str, str]): The output schema to be validated. Raises: V
databonsai/transform/extract_transformer.py:22
Methodwrapper
(self, *args, **kwargs)
databonsai/llm_providers/anthropic_provider.py:68
Methodwrapper
(self, *args, **kwargs)
databonsai/llm_providers/openai_provider.py:73