본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

AI 프롬프트 압축 정책 구성 레퍼런스

원문 보기 위키 갱신

AI 프롬프트 압축 정책 구성 레퍼런스 (AI Prompt Compressor Policy Configuration Reference)

이 문서는 AI Prompt Compressor 플러그인과 함께 동작하는 API 스펙을 설명하는 구성 레퍼런스예요. 요청 본문에 담긴 프롬프트를 압축해 주는 /llm/v1/compressPrompt 엔드포인트의 요청과 응답 스키마를 자세히 다루고 있어요. 압축 방식(rate, target_token)과 토큰 범위, 모델 이름 같은 필수 파라미터를 지정하는 방법과, 압축된 프롬프트와 함께 돌려받는 토큰 절약 결과까지 확인할 수 있어요

출처: 문서

본문

---
openapi: 3.1.1
info:
  title: AI Compress Server API
  description: 'This spec describes the APIs that can work with AI Prompt Compressor
    plugin to compress the prompt in the request body.

    '
  version: 1.0.0
paths:
  "/llm/v1/compressPrompt":
    post:
      summary: Compress the prompt in the request body
      description: Returns the compressed prompt and compression results.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - text
              - model_name
              - compress_type
              - compress_ranges
              properties:
                text:
                  type:
                  - array
                  - string
                  items:
                    type: object
                    required:
                    - msg_id
                    - text
                    properties:
                      msg_id:
                        type: integer
                      text:
                        type: string
                compress_type:
                  type: string
                  enum:
                  - rate
                  - target_token
                compress_ranges:
                  type: array
                  items:
                    type: object
                    properties:
                      min_tokens:
                        type: integer
                      max_tokens:
                        type: integer
                      value:
                        type: number
                model_name:
                  type: string
                advanced_logging:
                  type: boolean
                  default: false
      responses:
        '200':
          description: Service is healthy
          content:
            application/json:
              schema:
                type: object
                properties:
                  text:
                    type: array
                    items:
                      type: object
                      properties:
                        compress_prompt:
                          type: string
                        compressor_results:
                          type: object
                          properties:
                            msg_id:
                              type: integer
                            original_token_count:
                              type: integer
                            compress_token_count:
                              type: integer
                            save_token_count:
                              type: integer
                            compress_value:
                              type: number
                            compress_type:
                              type: string
                              enum:
                              - rate
                              - target_token
                            compressor_model:
                              type: string
                            original_text:
                              type: string
                            compress_text:
                              type: string
                            information:
                              type: string
                        msg_id:
                          type: integer
                  duration:
                    type: number
        '400':
          description: when error happens
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
  "/status":
    get:
      summary: Health check
      description: Returns the health status of the service.
      responses:
        '200':
          description: Service is healthy
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  model_name:
                    type: string
                    enum:
                    - microsoft/llmlingua-2-xlm-roberta-large-meetingbank
                    - microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank
                  device_map:
                    type: string
                    enum:
                    - cuda
                    - cpu
                    - mps
                    - balanced
                    - balanced_low_0
                    - auto

관련 리소스

더 알아보기 (Learn more)

  • AI 정책 엔티티의 구조와 동작 방식을 이해하면 압축 정책을 더 잘 설정할 수 있어요 — AI Policy entity
  • 요청에 외부 지식을 주입하는 또 다른 AI 정책인 RAG 인젝터도 함께 살펴봐요 — AI RAG Injector Policy
  • 프롬프트 압축으로 절약되는 토큰 비용을 관리하는 방법을 확인해요 — Model cost management