aiq.tool.code_execution.utils#

Attributes#

LOG

Functions#

format_code_output(execution_dict, code_output_begin, ...)

Formatting code output to be displayed as an llm expects it.

_extract_between_separators(generation, separators[, ...])

Extracting all text between last occurrence of separators[0] and [1].

extract_code_to_execute(generation, code_begin, code_end)

extract_code_output(generation, code_output_begin, ...)

unroll_files(input_files)

python_doc_to_cmd_help(doc_class[, docs_prefix, ...])

Converts python doc to cmd help format.

Module Contents#

LOG#
format_code_output(
execution_dict: dict[str, str],
code_output_begin: str,
code_output_end: str,
code_output_format: str = 'llama',
)#

Formatting code output to be displayed as an llm expects it.

_extract_between_separators(
generation: str,
separators: tuple[str, str],
extract_all: bool = False,
)#

Extracting all text between last occurrence of separators[0] and [1].

If extract_all is True, returning a list with all occurrences of text between separators.

extract_code_to_execute(
generation: str,
code_begin: str,
code_end: str,
extract_all: bool = False,
)#
extract_code_output(
generation: str,
code_output_begin: str,
code_output_end: str,
extract_all: bool = False,
)#
unroll_files(input_files)#
python_doc_to_cmd_help(doc_class, docs_prefix='', arg_prefix='')#

Converts python doc to cmd help format.

Will color the args and change the format to match what we use in cmd help.