SimpleComponent: a lightweight named-span component.
SimpleComponent accepts arbitrary keyword arguments (strings, CBlocks, or
Components) and renders them as a JSON object keyed by the argument names. It is
the go-to component type for ad-hoc prompts that do not require a dedicated
Component subclass or a Jinja2 template.
Classes
CLASS SimpleComponent
A Component that is make up of named spans.
Methods:
FUNC parts
- List of component values passed as keyword arguments.
FUNC make_simple_string
<|key|>value</|key|> tagged strings.
Args:
Returns:
- Newline-joined tagged representation of all keyword arguments.
FUNC make_json_string
CBlock and
ModelOutputThunk values use their .value attribute, while
Component values use format_for_llm().
Args:
kwargs: Mapping of span names toCBlock,Component, orModelOutputThunkvalues.
- JSON-encoded representation of the keyword arguments.
FUNC format_for_llm
make_json_string using the stored keyword arguments.
Returns:
- JSON-encoded string of all named spans in this component.