Skip to main content

fabricatio-question

MIT Python Versions PyPI Version PyPI Downloads PyPI Downloads Build Tool: uv

Interactive questioning extension for fabricatio agents. Generates LLM-driven selection prompts and presents them to users via terminal UI, enabling agents to gather structured feedback during planning and decision-making.

Installation

pip install fabricatio[question]
# or
uv pip install fabricatio[question]

For a full installation including all fabricatio components:

pip install fabricatio[full]

API

Capability: Questioning

Extends fabricatio_core.capabilities.propose.Propose. Mix into an agent to add interactive questioning.

Method Description
async selection(q: str, k: int = 1, **kwargs) -> str | List[str] Generates a selection question via LLM, presents it interactively, and returns the user's choice(s). k=1 returns a single string; k>1 returns a list of up to k selections.
async selection_string(q: str, k: int = 1, **kwargs) -> str Like selection(), but returns a formatted string with the question topic, options, and selected indices.

Model: SelectionQuestion

A SketchedAble model representing an interactive selection prompt. Generated by the LLM from a user-provided topic.

Field Type Description
q str Question text displayed to the user.
option List[str] Available choices.
Method Description
async single() -> str Presents a single-choice selection via questionary.select.
async multiple(k: int = 0) -> List[str] Presents a multi-choice checkbox. When k > 0, validates that exactly k options are selected.

Utilities

fabricatio_question.utils

Function Description
async ask_retain(candidates: List[str]) -> List[str] Presents a checkbox list with all candidates pre-checked, returning the user's retained subset.
async ask_retain(candidates, value_mapping) -> List[V] Overload that maps retained choices back through value_mapping.
async ask_edit(text_seq: List[str]) -> List[str] Prompts the user to edit each string sequentially; only non-empty edits are returned.

Configuration

All options below are read through the fabricatio configuration chain (see the Configuration Guide). Set them under the [ext.question] table in fabricatio.toml, equivalently under [tool.fabricatio.ext.question] in pyproject.toml, or via FABRICATIO_EXT__QUESTION__<FIELD_UPPER> environment variables.

[ext.question]
selection_template = "built-in/selection"
selection_display_template = "built-in/selection_display"
Option Type Default Description
selection_template str "built-in/selection" Template name for selection question
selection_display_template str "built-in/selection_display" Template name for selection display.

Access at runtime: from fabricatio_question.config import question_config.

Usage

from fabricatio_question.capabilities.questioning import Questioning

class MyAgent(Questioning):
    ...

async def example():
    agent = MyAgent()

    # Single choice — returns a str
    choice: str = await agent.selection("Pick a database backend")

    # Multiple choices — returns list[str]
    picks: list[str] = await agent.selection("Select features to enable", k=3)

    # Get a formatted response string
    result: str = await agent.selection_string("Choose a deployment target")
from fabricatio_question.utils import ask_retain, ask_edit

# Let the user prune a candidate list
kept: list[str] = await ask_retain(["auth", "caching", "logging", "metrics"])

# Let the user edit a list of strings in-place
edited: list[str] = await ask_edit(["step 1", "step 2", "step 3"])

Dependencies

  • fabricatio-core — core interfaces and capabilities
  • questionary>=2.1.0 — interactive terminal prompts

License

MIT — see LICENSE

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabricatio_question-0.1.8-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file fabricatio_question-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: fabricatio_question-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_question-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5a082ac2cfbd29a03b2d872b183a0224bc4b20e37d7726d5fabb8383ac1e0e85
MD5 1c64203bc754af0238451e17ba681f5f
BLAKE2b-256 779a0f6f693138181d8691b4e29ec01c685ccca76536fb4b15609c188feb60a0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.8 This release

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page