Feature Request: SuperCompress prompt preprocessing for llama-cpp-python

Open
#2,326 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
ai, backend

Research direction

Start with the README or examples for llama-cpp-python and inspect how examples call llama.create_completion(). Add an example that compresses a prompt with SuperCompress before passing it to the completion call, following the integration shown in the issue. Done when the example demonstrates the compression flow and can be followed by users with both packages installed.

Written by the indexing model from the issue text.

Description

Feature: Prompt Compression for llama-cpp-python

Problem: llama-cpp-python users often work with local models that have limited context (2048-4096 tokens). Long prompts waste valuable context window space.

Proposed Solution: Provide a SuperCompress integration example that compresses prompts before passing them to llama.create_completion().

from supercompress import Compressor
from llama_cpp import Llama

compressor = Compressor()
llm = Llama(model_path="./model.gguf")

compressed_prompt = compressor.compress(long_prompt, query)
output = llm.create_completion(compressed_prompt)

Benefits:

Dominant language
Python
Stars
10.7k
Forks
1.5k
Avg merge
1h 40m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abetlen/llama-cpp-python

All issues in abetlen/llama-cpp-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.