DVSemanticMetering class
Records embedding costs against a meter, and refuses past its limit.
Constructors
- DVSemanticMetering({required DVMeters meters, required DVMeterDefinition tokens})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- meters → DVMeters
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tokens → DVMeterDefinition
-
A counter of tokens, whose limit and behaviour at the limit decide when
embedding is refused.
final
Methods
-
charge(
String text, {required String key}) → Future< void> -
Charges for embedding
textunderkey, or throws DVSemanticBudgetExceeded before anything is embedded. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
estimateTokens(
String text) → int - A rough token count: providers bill tokens, and four characters is the usual approximation when the tokenizer is not at hand.