Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include optillm.py
include optillm/plugins/*.py
include optillm/cepo/*.py
include optillm/cepo/configs/*.yaml
2 changes: 1 addition & 1 deletion optillm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os

# Version information
__version__ = "0.2.0"
__version__ = "0.2.1"

# Get the path to the root optillm.py
spec = util.spec_from_file_location(
Expand Down
6 changes: 4 additions & 2 deletions optillm/plugins/longcepo/mapreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def fetch_map_response(client, model, chunk, query, system_prompt, summary):
tokenizer,
cb_log,
longcepo_config,
irrelevance_tags,
)
result = remove_chunks(result, irrelevance_tags)
if not result:
return "No information", cb_log

Expand Down Expand Up @@ -200,6 +200,7 @@ def collapse_chunks(
tokenizer,
cb_log: CBLog,
longcepo_config: LongCepoConfig,
irrelevance_tags: Tuple[str] = ("[NO INFORMATION]",),
) -> Tuple[List[str], CBLog]:
"""
Collapses context chunk pairs in sliding window until the total token count fits within the context window.
Expand All @@ -221,7 +222,7 @@ def collapse_chunks(
num_tokens = get_prompt_length(format_chunk_list(context_chunks), tokenizer)
token_budget = (
longcepo_config.max_context_window
- get_prompt_length(longcepo_config.collapse_prompt, tokenizer)
- get_prompt_length(longcepo_config.reduce_prompt, tokenizer)
- longcepo_config.max_output_tokens
)
logger.info(f"Pre-collapse length of chunks {num_tokens}, allowed {token_budget}")
Expand Down Expand Up @@ -269,6 +270,7 @@ def fetch_collapse_response(client, model, docs, query, system_prompt):
system_prompt,
cb_log,
)
context_chunks = remove_chunks(context_chunks, irrelevance_tags)
merge_pair_idx = (merge_pair_idx + 1) % max(len(context_chunks) - 1, 1)
num_tokens = get_prompt_length(format_chunk_list(context_chunks), tokenizer)
collapse_step += 1
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "optillm"
version = "0.2.0"
version = "0.2.1"
description = "An optimizing inference proxy for LLMs."
readme = "README.md"
license = "Apache-2.0"
Expand Down Expand Up @@ -81,4 +81,7 @@ optillm = [
"plugins/*.py",
"cepo/*.py",
"cepo/configs/*.yaml",
]
]

[tool.setuptools.data-files]
"" = ["optillm.py"]