semlib.compare
Task
Comparison task to perform.
Intended to be passed to compare and similar methods, this specifies how the LLM should compare two items.
Source code in src/semlib/compare.py
CHOOSE_GREATER
class-attribute
instance-attribute
Ask the model to choose which of the two items (a) or (b) is greater.
The model must choose either "A"
or "B"
.
CHOOSE_GREATER_OR_ABSTAIN
class-attribute
instance-attribute
Ask the model to choose which of the two items (a) or (b) is greater, or abstain if unsure.
The model must choose "A"
, "B"
, or "neither"
.
CHOOSE_LESSER
class-attribute
instance-attribute
Ask the model to choose which of the two items (a) or (b) is lesser.
The model must choose either "A"
or "B"
.
CHOOSE_LESSER_OR_ABSTAIN
class-attribute
instance-attribute
Ask the model to choose which of the two items (a) or (b) is lesser, or abstain if unsure.
The model must choose "A"
, "B"
, or "neither"
.
COMPARE
class-attribute
instance-attribute
Ask the model to compare two items and determine their relative order.
The model must choose either "less"
or "greater"
.
Order
Result of a comparison.
Source code in src/semlib/compare.py
compare
async
compare[T](
a: T,
b: T,
/,
*,
by: str | None = None,
to_str: Callable[[T], str] | None = None,
template: str | Callable[[T, T], str] | None = None,
task: Task | str | None = None,
model: str | None = None,
) -> Order
Standalone version of compare.
Source code in src/semlib/compare.py
compare_sync
compare_sync[T](
a: T,
b: T,
/,
*,
by: str | None = None,
to_str: Callable[[T], str] | None = None,
template: str | Callable[[T, T], str] | None = None,
task: Task | str | None = None,
model: str | None = None,
) -> Order
Standalone synchronous version of compare.
Source code in src/semlib/compare.py
:::