Context manager
ContextManager #
Shortens a datapoint's context for the specific question an annotator answers.
A long, general context (e.g. a full scene description) is often far more detail than a single question needs. This manager tunes a context down to what is relevant for the question, which keeps it within the length the backend accepts and focuses the annotator. Results are cached server-side.
Source code in src/rapidata/rapidata_client/context/context_manager.py
shorten_context #
Shorten a single context for the given question.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
str
|
The (potentially long) context to shorten. |
required |
question
|
str
|
The question the context will be shown alongside. The context is tuned to what this question needs. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The shortened context. |
Source code in src/rapidata/rapidata_client/context/context_manager.py
shorten_contexts #
Shorten a batch of (context, question) pairs in one request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs
|
Sequence[tuple[str, str]]
|
The |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The shortened contexts, in the same order as |