NPM library for LLM prompt engineering
Top 18.0% on sourcepulse
This library provides an NPM utility for developers to construct and manage prompts for Large Language Models (LLMs), simplifying complex prompt engineering tasks and codifying best practices for natural language to code and chat scenarios. It targets developers working with LLMs like GPT-3 and Codex, enabling more effective interaction with these models through structured prompt creation and context management.
How It Works
The library offers generic PromptEngine
, CodeEngine
, and ChatEngine
classes. These engines facilitate prompt composition using a description, input/output examples, and a dialog history. This approach ensures stateless LLMs maintain conversational context, crucial for multi-turn interactions. The CodeEngine
is tailored for natural language to code tasks, allowing customization for different programming languages, while ChatEngine
manages conversational flow for dialogue-based LLMs.
Quick Start & Requirements
npm install prompt-engine
Highlighted Details
CodeEngine
for NL-to-Code and ChatEngine
for conversational prompts.buildPrompt
, addInteraction
, resetContext
, and more for flexible prompt manipulation.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The library's prompt overflow management strategy removes the oldest interaction, which might lead to loss of early context in very long conversations. The effectiveness of generated prompts is dependent on the capabilities of the target LLM.
2 years ago
Inactive