Skip to content

Commit

Permalink
Define defaults for ChunkTask
Browse files Browse the repository at this point in the history
  • Loading branch information
volkerstampa committed Feb 29, 2024
1 parent d4db4b7 commit 4be3230
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/intelligence_layer/core/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pydantic import BaseModel
from semantic_text_splitter import HuggingFaceTextSplitter

from intelligence_layer.core.model import ControlModel
from intelligence_layer.core.model import ControlModel, LuminousControlModel
from intelligence_layer.core.task import Task
from intelligence_layer.core.tracer.tracer import TaskSpan

Expand Down Expand Up @@ -50,8 +50,11 @@ class ChunkTask(Task[ChunkInput, ChunkOutput]):
max_tokens_per_chunk: The maximum number of tokens to fit into one chunk.
"""

def __init__(self, model: ControlModel, max_tokens_per_chunk: int):
def __init__(
self, model: ControlModel | None = None, max_tokens_per_chunk: int = 512
):
super().__init__()
model = model or LuminousControlModel()
self._splitter = HuggingFaceTextSplitter(model.get_tokenizer())
self._max_tokens_per_chunk = max_tokens_per_chunk

Expand Down

0 comments on commit 4be3230

Please sign in to comment.