@@ -28,6 +28,17 @@ class CitationRequirement(Requirement):
2828 1. In the constructor (for reusable requirements with fixed documents)
2929 2. Attached to the assistant message in the context (for dynamic documents)
3030
31+ Args:
32+ min_citation_coverage: Minimum ratio of cited content (0.0-1.0).
33+ The ratio of characters with citations to total response length
34+ must meet or exceed this threshold. Default is 0.8 (80% coverage).
35+ documents: Optional documents to validate against. Can be Document
36+ objects or strings (will be converted to Documents). If provided,
37+ these documents will be used instead of documents attached to
38+ messages in the context. Default is None (use context documents).
39+ description: Custom description for the requirement. If None,
40+ generates a description based on coverage threshold.
41+
3142 Example:
3243 ```python
3344 from mellea.backends.huggingface import LocalHFBackend
@@ -55,19 +66,7 @@ def __init__(
5566 documents : Iterable [Document ] | Iterable [str ] | None = None ,
5667 description : str | None = None ,
5768 ):
58- """Initialize citation coverage requirement.
59-
60- Args:
61- min_citation_coverage: Minimum ratio of cited content (0.0-1.0).
62- The ratio of characters with citations to total response length
63- must meet or exceed this threshold. Default: 0.8 (80% coverage)
64- documents: Optional documents to validate against. Can be Document
65- objects or strings (will be converted to Documents). If provided,
66- these documents will be used instead of documents attached to
67- messages in the context. Default: None (use context documents)
68- description: Custom description for the requirement. If None,
69- generates a description based on coverage threshold.
70- """
69+ """Initialize citation coverage requirement."""
7170 if not 0.0 <= min_citation_coverage <= 1.0 :
7271 raise ValueError (
7372 f"min_citation_coverage must be between 0.0 and 1.0, got { min_citation_coverage } "
@@ -302,8 +301,8 @@ def citation_check(
302301 Args:
303302 documents: Documents to check for citations. Can be Document objects
304303 or strings (will be converted to Documents).
305- min_citation_coverage: Minimum ratio of cited content (0.0-1.0).
306- Default: 0.8 (80% coverage)
304+ min_citation_coverage: Minimum ratio of cited content (0.0-1.0),
305+ defaults to 0.8 (80% coverage).
307306 description: Custom description for the requirement. If None,
308307 generates a description based on coverage threshold.
309308
0 commit comments