Skip to content

Commit 5989664

Browse files
committed
Adds cache flag to CBlock.
1 parent a1a4eb7 commit 5989664

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

mellea/stdlib/base.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,23 @@
1515
class CBlock:
1616
"""A `CBlock` is a block of content that can serve as input to or output from an LLM."""
1717

18-
def __init__(self, value: str | None, meta: dict[str, Any] | None = None):
19-
"""Initializes the CBlock with a string and some metadata."""
18+
def __init__(
19+
self,
20+
value: str | None,
21+
meta: dict[str, Any] | None = None,
22+
*,
23+
cache: bool = False,
24+
):
25+
"""Initializes the CBlock with a string and some metadata.
26+
27+
Args:
28+
value: the underlying value stored in this CBlock
29+
meta: Any meta-information about this CBlock (e.g., the inference engine's Completion object).
30+
cache: If set to `True` then this CBlock's KV cache might be stored by the inference engine. Experimental."""
2031
if value is not None and not isinstance(value, str):
2132
raise TypeError("value to a Cblock should always be a string or None")
2233
self._underlying_value = value
34+
self.cache = cache
2335
if meta is None:
2436
meta = {}
2537
self._meta = meta

0 commit comments

Comments
 (0)