Call Sequencer
Call Sequencer is a Python package for sequencing function calls as blocks.
Installation
You can install the package via pip:
pip install call-sequencer
Usage
Using Chains of Functions
from call_sequencer import CallSequencer
# Example Usage
@CallSequencer.simple
def sanitize(param) -> str:...
@CallSequencer.simple
def retrive_data(param)-> str:...
@CallSequencer.with_args
def query_llm(param, *args, **kwargs)-> str:...
@CallSequencer.simple
def extract_code(param)-> str:...
@CallSequencer.simple
def execute_code(param)-> str:...
code_evaluator = (
CallSequencer.start("Hello") # Initial input block
>> sanitize
>> retrive_data
>> query_llm("extra_param")
>> extract_code
>> execute_code
>> query_llm("another_param")
)
# Run the chain
result = code_evaluator()
print("Final Result:", result)
Predefined Functions
Explanation of Markdown Parsing Functions
-
extract_title
- Extracts the title from a Markdown string, identified by a single
#at the beginning of a line. ReturnsNoneif no title is found.
- Extracts the title from a Markdown string, identified by a single
-
extract_code_blocks
- Extracts all code blocks from a Markdown string delimited by triple backticks (
```). Returns a list of code block strings.
- Extracts all code blocks from a Markdown string delimited by triple backticks (
-
extract_tables
- Extracts tables from a Markdown string formatted with pipes (
|). Returns a list of table row strings.
- Extracts tables from a Markdown string formatted with pipes (
-
extract_lists
- Extracts both ordered (numbered) and unordered (bulleted) lists from a Markdown string. Returns a list of list item strings.
-
extract_first_code_block
- Extracts the content of the first code block encountered in a Markdown string. Returns
Noneif no code block is found.
- Extracts the content of the first code block encountered in a Markdown string. Returns
-
extract_headings
- Extracts all headings from a Markdown string, identified by lines starting with multiple
#characters. Returns a list of heading strings.
- Extracts all headings from a Markdown string, identified by lines starting with multiple
-
extract_bold_text
- Extracts text formatted in bold (
**text**) from a Markdown string. Returns a list of bold text strings.
- Extracts text formatted in bold (
-
extract_italic_text
- Extracts text formatted in italics (
*text*) from a Markdown string. Returns a list of italic text strings.
- Extracts text formatted in italics (
-
extract_links
- Extracts hyperlinks in the format
[text](url)from a Markdown string. Returns a list of tuples where each tuple contains the text and URL.
- Extracts hyperlinks in the format
-
extract_all_text
- Strips out all Markdown formatting (bold, italic, links) and returns plain text from a Markdown string. Returns a plain string of text content.
These functions are designed to parse and extract specific elements from Markdown strings, useful for processing and analyzing text generated by large language models or similar applications.
Explanation of Code Runner Functions
-
run_python_code
- Runs a given Python code string and returns the result. Accepts additional global variables through
**globals_dict.
- Runs a given Python code string and returns the result. Accepts additional global variables through
-
run_shell_command
- Executes a shell command and returns the output as a dictionary containing
stdout,stderr, andreturncode.
- Executes a shell command and returns the output as a dictionary containing
-
evaluate_expression
- Evaluates a Python expression and returns the result.
-
install_package
- Installs a Python package using pip and returns the output as a dictionary containing
stdout,stderr, andreturncode.
- Installs a Python package using pip and returns the output as a dictionary containing
-
uninstall_package
- Uninstalls a Python package using pip and returns the output as a dictionary containing
stdout,stderr, andreturncode.
- Uninstalls a Python package using pip and returns the output as a dictionary containing
-
list_installed_packages
- Lists all installed Python packages using pip and returns the output as a dictionary containing
stdout,stderr, andreturncode.
- Lists all installed Python packages using pip and returns the output as a dictionary containing
-
get_package_info
- Retrieves information about a Python package using pip show and returns the output as a dictionary containing
stdout,stderr, andreturncode.
- Retrieves information about a Python package using pip show and returns the output as a dictionary containing
-
write_file
- Writes a string content to a specified file. If the operation is successful, returns
None; otherwise, returns an error message.
- Writes a string content to a specified file. If the operation is successful, returns
-
read_file
- Reads the content of a specified file and returns it as a string. If the operation fails, returns an error message.
-
append_to_file
- Appends string content to a specified file. If the operation is successful, returns
None; otherwise, returns an error message.
- Appends string content to a specified file. If the operation is successful, returns
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for call-sequencer 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| call-sequencer-1.0.4.tar.gz | 7.0 kB | Without provenance | Details for call-sequencer-1.0.4.tar.gz |
Release files / call-sequencer-1.0.4.tar.gz
| Download URL | call-sequencer-1.0.4.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dea2b829bff56d032f115a011761cc2eb45c2d7ddf06cda14e05bda2c27b65f
|
|
BLAKE2b-256 checksum How to use checksums |
997eb9549807c4e3a75cfdbf43ab3321d1eedd2ff079dee48bf9e80bc2d6052b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|
Security for call-sequencer 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.