print_text_animated
- text (str): The text to print.
- delay (float, optional): The delay between each character printed. (default: :obj:
0.02
) - end (str, optional): The end character to print after each character of text. (default: :obj:
""
)
get_prompt_template_key_words
- template (str): A string containing curly braces.
get_first_int
- string (str): The input string.
download_tasks
task
type from a predefined URL, saves it to folder_path
, and then
extracts the contents of the zip file into the same folder. After
extraction, the zip file is deleted.
Parameters:
- task (TaskType): An enum representing the type of task to download.
- folder_path (str): The path of the folder where the zip file will be downloaded and extracted.
get_task_list
- task_response (str): The string response of the Agent.
check_server_running
- server_url (str): The URL to the server running LLM inference service.
dependencies_required
- required_modules (str): The required modules to be checked for availability.
- ImportError: If any of the required modules are not available.
is_module_available
- module_name (str): The name of the module to check for availability.
api_keys_required
- param_env_list (List[Tuple[Optional[str], str]]): A list of tuples where each tuple contains a function argument name (as the first element, or None) and the corresponding environment variable name (as the second element) that holds the API key.
- ValueError: If any of the required API keys are missing, either
get_system_information
to_pascal
- snake (str): The snake_case string to be converted.
get_pydantic_major_version
get_pydantic_object_schema
- pydantic_params (Type[BaseModel]): The Pydantic model class to retrieve the schema for.
func_string_to_callable
- code (str): The function code as a string.
json_to_function_code
- json_obj (dict): The JSON schema object containing properties and required fields, and json format is follow openai tools schema
text_extract_from_web
- url (str): The website you want to search.
create_chunks
- text (str): The text to be split.
- n (int): The max length of a single chunk.
is_docker_running
agentops_decorator
- func (callable): The function to be decorated.
AgentOpsMeta
new
track_agent
handle_http_error
- response (requests.Response): The HTTP response from the API call.
retry_on_error
- max_retries (int): Maximum number of retry attempts
- initial_delay (float): Initial delay between retries in seconds
BatchProcessor
init
- max_workers: Maximum number of workers. If None, will be determined dynamically based on system resources. (default: :obj:
None
) - initial_batch_size: Initial size of each batch. If
None
, defaults to10
. (default: :obj:None
) - monitoring_interval: Interval in seconds between resource checks. (default: :obj:
5.0
) - cpu_threshold: CPU usage percentage threshold for scaling down. (default: :obj:
80.0
) - memory_threshold: Memory usage percentage threshold for scaling down. (default: :obj:
85.0
)
_calculate_optimal_workers
_update_resource_metrics
_should_check_resources
adjust_batch_size
- success (bool): Whether the last batch completed successfully
- processing_time (Optional[float]): Time taken to process the last batch. (default: :obj:
None
)
get_performance_metrics
- total_processed: Total number of batches processed
- error_rate: Percentage of failed batches
- avg_processing_time: Average time per batch
- current_batch_size: Current batch size
- current_workers: Current number of workers
- current_cpu: Current CPU usage percentage
- current_memory: Current memory usage percentage
download_github_subdirectory
- repo (str): The name of the GitHub repository in the format “owner/repo”.
- subdir (str): The path to the subdirectory within the repository to download.
- data_dir (Path): The local directory where the files will be saved.
- branch (str, optional): The branch of the repository to use. Defaults to “main”.
generate_prompt_for_structured_output
- response_format (Type[BaseModel]): The Pydantic model class.
- user_message (str): The user message to be used in the prompt.
with_timeout
- timeout (float, optional): The timeout duration in seconds. If None, will try to get timeout from the instance’s timeout attribute. (default: :obj:
None
)
browser_toolkit_save_auth_cookie
- cookie_json_path (str): Path where the authentication cookies and storage state will be saved as a JSON file. If the file already exists, it will be loaded first and then overwritten with updated state. The function checks if this file exists before attempting to use it.
- url (str): The URL to navigate to for authentication (e.g., a login page).
- wait_time (int): The time in seconds to wait for the user to manually authenticate.
- Usage: 1. The function opens a browser window and navigates to the specified URL 2. User manually logs in during the wait_time wait period 3. Browser storage state (including auth cookies) is saved to the specified file 4. The saved state can be used in subsequent browser sessions to maintain authentication
run_async
- func (Callable[…, Any]): The async function to wrap.