ContextBuilder class

Builds optimized context within a token budget.

Constructors

ContextBuilder({int tokenBudget = 100000})

Properties

hashCode int
The hash code for this object.
no setterinherited
items List<ContextItem>
Get all items.
no setter
remainingTokens int
Get remaining token budget.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tokenBudget int
final
usedTokens int
Get used tokens.
no setter

Methods

add(ContextItem item) bool
Add a context item.
addDirectoryListing(String path, {int depth = 2}) Future<bool>
Add directory listing to context.
addFile(String path, {int? maxLines}) Future<bool>
Add a file to context.
addGitDiff({String? ref, bool staged = false}) Future<bool>
Add git diff to context.
addMemory(String source, String content) bool
Add memory content.
addSearchResults(String query, List<SearchHit> hits) bool
Add search results to context.
build() String
Build the final context string.
clear() → void
Clear all context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(ContextItem item) → void
Remove an item.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited