darcyai.output.output_stream

OutputStream Objects

class OutputStream(Configurable)

OutputStream is the base class that is used to write output to a stream.

Arguments

  • ignore_none (bool): Whether or not to call the endpoint when the data is None. Defaults to True.

Examples

>>> from darcyai.output.output_stream import OutputStream

>>> class MyOutputStream(OutputStream):
...     def write(self, data: dict):
...         print(data)

>>>     def close(self):
...         pass

write

def write(data: Any) -> Any

Processes the data and writes it to the output stream.

Arguments

  • data (Any): The data to be written to the output stream.

Returns

Any: The data that was written to the output stream.

close

def close() -> None

Closes the output stream.

set_config_value

def set_config_value(key: str, value: Any)

Sets a config value.

Arguments

  • key (str): The key of the config.
  • value (Any): The value to set.

get_config_value

def get_config_value(key: str) -> Any

Gets a config value.

Arguments

  • key (str): The key of the config.

Returns

Any: The value of the config.

init_config_registry

def init_config_registry()

Initializes the config registry.