Skip to main content

A smart prompt compression and optimization tool for LLMs

Project description

NeuroPrompt

A smart prompt compression and optimization tool for Large Language Models that automatically adapts to different types of content and provides comprehensive quality evaluation.

Installation

export OPENAI_API_KEY=<your_openai_key>
pip install neuroprompt

Features

  • Smart prompt compression with content-aware parameter optimization
  • Support for various content types (code, lists, technical content)
  • Comprehensive response quality evaluation
  • Cost optimization for OpenAI API calls
  • Automatic token counting and cost estimation

Quick Start

from neuroprompt import NeuroPromptCompress
from openai import OpenAI


@NeuroPromptCompress()
def chat_completion(messages, model="gpt-4o", temperature=0.7):
    client = OpenAI()
    return client.chat.completions.create(
        messages=messages,
        model=model,
        temperature=temperature
    )


# Example usage
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Your prompt here..."}
]

response = chat_completion(messages=messages)

Documentation

Basic Usage

The package provides two main decorators:

  1. NeuroPromptCompress: Basic compression without evaluation
  2. NeuroPromptCompressWithEval: Compression with comprehensive quality evaluation

Quality Metrics

The evaluation includes:

  • ROUGE scores
  • BLEU score
  • Semantic similarity
  • Information coverage
  • Expert evaluation using GPT-4o

License

Copyright © 2024 Tejas Chopra.

All rights reserved.

This is proprietary software. Unauthorized copying, modification, distribution, or use of this software, in whole or in part, is strictly prohibited.

Third Party Components

This software uses LLMLingua under MIT license. See the LICENSE file for full terms.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuroprompt-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuroprompt-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file neuroprompt-0.1.0.tar.gz.

File metadata

  • Download URL: neuroprompt-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for neuroprompt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 985a261da13f72b784356c549cef9d29ee0e192c330734b4f6cba87314d4f594
MD5 69eba85537fd52547b5ae2022530fbd4
BLAKE2b-256 38ad84c060ec5a5c6a2b60951bb285407f1b6d58d5cad176c1405e189e572d03

See more details on using hashes here.

File details

Details for the file neuroprompt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: neuroprompt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for neuroprompt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ad508526bd109842d6ec351f623a9e15184cf1dd42928124e2e231c9b1cfd3a
MD5 5ac70dd532b2176dcf7387ef237b31c9
BLAKE2b-256 8e48efe07eae2f32235de3ab5cd45b3ab399e5b9347f161769f0a39c84b6a1f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page