POST
/
compress-prompt
curl --request POST \
  --url http://localhost:5000/compress-prompt \
  --header 'Content-Type: application/json' \
  --data '{
  "concate_question": true,
  "context": [
    "<string>"
  ],
  "instruction": "",
  "keep_first_sentence": 0,
  "keep_last_sentence": 0,
  "keep_sentence_number": 0,
  "question": "",
  "rank_method": "longllmlingua",
  "ratio": 0.5,
  "target_token": -1,
  "use_context_level_filter": true,
  "use_sentence_level_filter": false,
  "use_token_level_filter": true
}'
{
  "compressed_prompt": "<string>"
}

Body

application/json
context
string[]
required

Context or documents (low compression sensitivity)

concate_question
boolean
default:true

Includes the question in the compressed prompt

instruction
string
default:

Instruction (high compression sensitivity)

keep_first_sentence
integer
default:0

Retains the first 'k' sentences in each context

keep_last_sentence
integer
default:0

Retains the last 'k' sentences in each context

keep_sentence_number
integer
default:0

Retains a specific number of sentences in each context

question
string
default:

Question (high compression sensitivity)

rank_method
string
default:longllmlingua

Method for ranking in coarse-level compression

ratio
number
default:0.5

Target compression ratio (default: 0.5)

target_token
number
default:-1

Target compression token count (default: -1)

use_context_level_filter
boolean
default:true

Enables context-level compression

use_sentence_level_filter
boolean
default:false

Enables sentence-level compression

use_token_level_filter
boolean
default:true

Enables token-level compression

Response

200
application/json
Compressed prompt
compressed_prompt
string

The compressed prompt result