Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/alvin-r/databonsai
/ functions
Functions
54 in github.com/alvin-r/databonsai
⨍
Functions
54
◇
Types & classes
11
↳
Endpoints
10
↓ 7 callers
Method
generate
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 callers
Method
categorize
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 callers
Method
validate_predicted_categories
( self, predicted_categories: List[str] )
databonsai/categorize/base_categorizer.py:217
↓ 3 callers
Method
categorize
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 callers
Function
apply_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 callers
Function
check_func
(func)
databonsai/utils/apply.py:233
↓ 1 callers
Method
_chat
(self, messages, options)
databonsai/llm_providers/ollama_provider.py:36
↓ 1 callers
Function
apply_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 callers
Method
categorize_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 callers
Method
categorize_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 callers
Method
transform
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
Function
apply_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
Method
category_mapping
(self)
databonsai/categorize/base_categorizer.py:91
Method
generate
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
Method
generate
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
Method
generate
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
Method
inverse_category_mapping
(self)
databonsai/categorize/base_categorizer.py:96
Method
retry_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
Method
retry_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
Function
sample_categories
()
tests/test_categorization.py:9
Function
sample_dataframe
()
tests/test_categorization.py:30
Function
sample_list
()
tests/test_categorization.py:45
Function
sample_provider
(request)
tests/test_categorization.py:25
Method
system_message
(self)
databonsai/categorize/multi_categorizer.py:38
Method
system_message
(self)
databonsai/categorize/base_categorizer.py:101
Method
system_message
(self)
databonsai/transform/base_transformer.py:69
Method
system_message
(self)
databonsai/transform/extract_transformer.py:95
Method
system_message_batch
(self)
databonsai/categorize/multi_categorizer.py:63
Method
system_message_batch
(self)
databonsai/categorize/base_categorizer.py:122
Method
system_message_batch
(self)
databonsai/transform/base_transformer.py:86
Function
test_apply_to_column
Test the apply_to_column function.
tests/test_categorization.py:99
Function
test_apply_to_column_batch
Test the apply_to_column_batch function.
tests/test_categorization.py:128
Function
test_apply_to_column_batch_start_idx
Test the apply_to_column_batch function with a start index.
tests/test_categorization.py:159
Function
test_base_categorizer
Test the BaseCategorizer class.
tests/test_categorization.py:55
Function
test_base_categorizer_batch
Test the BaseCategorizer class with a batch of examples.
tests/test_categorization.py:76
Function
test_multi_categorizer
Test the MultiCategorizer class.
tests/test_categorization.py:196
Function
test_multi_categorizer_batch
Test the MultiCategorizer class with a batch of examples.
tests/test_categorization.py:228
Method
transform
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
Method
transform_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
Method
validate_categories
Validates the categories dictionary. Args: v (Dict[str, str]): The categories dictionary to be validated. Raise
databonsai/categorize/base_categorizer.py:26
Method
validate_examples
Validates the examples list. Args: v (List[Dict[str, str]]): The examples list to be validated. Raises:
databonsai/categorize/base_categorizer.py:48
Method
validate_examples
Validates the examples list. Args: v (List[Dict[str, str]]): The examples list to be validated. Raises:
databonsai/transform/base_transformer.py:43
Method
validate_examples
Validates the examples list. Args: v (List[Dict[str, str]]): The examples list to be validated. Raises:
databonsai/transform/extract_transformer.py:40
Method
validate_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
Method
validate_examples_responses
Validates that the "response" values in the examples are within the categories keys.
databonsai/categorize/base_categorizer.py:73
Method
validate_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
Method
validate_prompt
Validates the prompt. Args: v (str): The prompt to be validated. Raises: ValueError: If the prompt
databonsai/transform/base_transformer.py:25
Method
validate_schema
Validates the output schema. Args: v (Dict[str, str]): The output schema to be validated. Raises: V
databonsai/transform/extract_transformer.py:22
Method
wrapper
(self, *args, **kwargs)
databonsai/llm_providers/anthropic_provider.py:68
Method
wrapper
(self, *args, **kwargs)
databonsai/llm_providers/openai_provider.py:73