fabricatio-improve
Content review, correction, and improvement for LLM applications built on Fabricatio's agent framework.
Installation
pip install fabricatio[improve]
# or
uv pip install fabricatio[improve]
For a full installation with all Fabricatio components:
pip install fabricatio[full]
# or
uv pip install fabricatio[full]
Overview
fabricatio-improve provides two capability classes that integrate into the Fabricatio agent architecture:
- Review — analyzes text, tasks, or objects to identify problems and propose solutions using LLM-driven evaluation against configurable criteria.
- Correct — applies reviewed problems and solutions to fix troubled text or objects, including best-solution selection and template-based correction.
Key Classes
Capabilities
| Class | Base Classes | Description |
|---|---|---|
Review |
Rating, Propose |
Reviews content against a topic and criteria, producing an Improvement with identified problems and proposed solutions. |
Correct |
Rating |
Decides best solutions from review results, then applies fixes to troubled objects or strings using templates. |
Models
| Model | Description |
|---|---|
Improvement |
Result of a review — holds focused_on topic and a list of ProblemSolutions. Supports gathering multiple improvements. |
Problem |
A detected issue with description (cause), severity_level (0-10), and location. |
Solution |
A proposed fix with description (mechanism), execute_steps, feasibility_level, and impact_level. |
ProblemSolutions |
A pair of one Problem with its candidate Solution list. Supports deciding the final solution. |
KWArgs Types
| Type | Used By | Description |
|---|---|---|
ReviewKwargs |
Review |
Review parameters including required topic, optional criteria set, and rating_manual dict. |
CorrectKwargs |
Correct |
Correction parameters including the improvement to apply. |
Configuration
All options below are read through the fabricatio configuration chain (see the
Configuration Guide). Set them under the
[ext.improve] table in fabricatio.toml, equivalently under
[tool.fabricatio.ext.improve] in pyproject.toml, or via
FABRICATIO_EXT__IMPROVE__<FIELD_UPPER> environment variables.
[ext.improve]
review_string_template = "built-in/review_string"
fix_troubled_string_template = "built-in/fix_troubled_string"
fix_troubled_obj_template = "built-in/fix_troubled_obj"
| Option | Type | Default | Description |
|---|---|---|---|
review_string_template |
str |
"built-in/review_string" |
The name of the review string template which will be used to review a string. |
fix_troubled_string_template |
str |
"built-in/fix_troubled_string" |
The name of the fix troubled string template which will be used to fix a troubled string. |
fix_troubled_obj_template |
str |
"built-in/fix_troubled_obj" |
The name of the fix troubled object template which will be used to fix a troubled object. |
Access at runtime: from fabricatio_improve.config import improve_config.
Usage
Review
from fabricatio_improve.capabilities.review import Review
class MyAgent(Review):
"""An agent that can review content."""
async def review_content():
agent = MyAgent()
improvement = await agent.review_string(
"The quick brown fox jump over the lazy dog.",
topic="grammar",
criteria={"subject-verb agreement", "spelling"},
rating_manual={"spelling": "no typos: 10, minor typos: 5, many typos: 0"},
)
for ps in improvement.problem_solutions:
print(f"Problem: {ps.problem.description} (severity: {ps.problem.severity_level}/10)")
for sol in ps.solutions:
print(f" Solution: {sol.description}")
print(f" Steps: {', '.join(sol.execute_steps)}")
Correct
from fabricatio_improve.capabilities.correct import Correct
from fabricatio_improve.models.improve import Improvement
from fabricatio_improve.models.problem import Problem, ProblemSolutions, Solution
class MyCorrector(Correct):
"""An agent that can correct content."""
async def correct_content():
corrector = MyCorrector()
# Build an improvement from prior review
problem = Problem(
name="subject-verb agreement",
cause="'jump' should be 'jumps' for third-person singular",
severity_level=7,
location="line 1",
)
solution = Solution(
name="fix verb",
mechanism="Change 'jump' to 'jumps'",
execute_steps=["locate the verb 'jump'", "replace with 'jumps'"],
feasibility_level=10,
impact_level=5,
)
improvement = Improvement(
focused_on="grammar",
problem_solutions=[ProblemSolutions(problem=problem, solutions=[solution])],
)
corrected = await corrector.correct_string(
"The quick brown fox jump over the lazy dog.",
improvement,
)
print(corrected)
Structure
fabricatio-improve/
├── capabilities/
│ ├── correct.py — Correct capability (apply fixes to content)
│ └── review.py — Review capability (detect problems, propose solutions)
└── models/
├── improve.py — Improvement result model
├── problem.py — Problem, Solution, ProblemSolutions models
└── kwargs_types.py — KWArgs types for correction and review
Dependencies
fabricatio-core— core interfaces and utilitiesfabricatio-capabilities— base capability patterns (Rating, Propose)
License
MIT — see LICENSE
Metadata
Release files for fabricatio-improve 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fabricatio_improve-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / fabricatio_improve-0.2.0-py3-none-any.whl
| Download URL | fabricatio_improve-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
378a0a05fcbb0fac2e0fe78cfc1ed27b531e3b8d21257b12e7d7a2a3d81d4bb5
|
|
BLAKE2b-256 checksum How to use checksums |
7d5c5f385e37660de6ca61e2332746b34b02fed9212729b8b78cb55e81809395
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}
|