Skip to main content

ScoreBasedContextCreator

class ScoreBasedContextCreator(BaseContextCreator):
A context creation strategy that orders records chronologically. Parameters:
  • token_counter (BaseTokenCounter): Token counter instance used to compute the combined token count of the returned messages.
  • token_limit (int): Retained for API compatibility. No longer used to filter records.

init

def __init__(self, token_counter: BaseTokenCounter, token_limit: int):

token_counter

def token_counter(self):

token_limit

def token_limit(self):

create_context

def create_context(self, records: List[ContextRecord]):
Returns messages sorted by timestamp and their total token count.