Skip to main content

Fwip

Your prompts, upgraded.

PyPI npm License: MIT Tests

Fwip optimizes your AI prompts for specific models using research-backed, model-specific formatting rules. No LLM required — it's deterministic and instant.

Why?

Most developers write one prompt and hope it works on every model. But models were trained on different data with different RLHF processes. Claude works best with XML tags. Qwen3 needs /think prefixes. Mistral's Magistral emits [TOOL_CALLS] markers that break JSON parsing. Fwip handles all of this automatically.

Quick Start

Python

pip install fwip
import fwip

result = fwip.adapt(
    "You are a helpful data analyst. Extract all key metrics from the report.",
    model="claude-sonnet",
    task="extraction",
)

print(result.system)
# <role>
# You are a helpful data analyst.
# </role>
#
# <instructions>
# Extract all key metrics from the report.
# </instructions>
#
# <output_format>
# Return structured output matching the schema.
# </output_format>

print(result.changes)
# [Change(rule='xml-structure', description='Restructured prompt with XML tags', ...)]

TypeScript

npm install fwip
import { adapt } from "fwip";

const result = adapt({
  prompt: "You are a helpful data analyst. Extract all key metrics.",
  model: "claude-sonnet",
  task: "extraction",
});

console.log(result.system);
console.log(result.changes);

Before / After

Model Before After
Claude Sonnet Plain text prompt XML-tagged <role>, <instructions>, <output_format>
Qwen3 32B No thinking directive /no_think prefix + Tier 3 JSON reinforcement + English enforcement
Magistral Standard prompt Suppressed [TOOL_CALLS] and [THINK] markers + ultra-strong JSON-only
GLM 4.7 Flash Verbose prompt Simplified + nested object fix + English enforcement
Nemotron 9B Full prompt /think prefix + simplified to 3 steps + Tier 3 JSON reinforcement

Supported Models

11 model families, 39+ model variants:

Family Models Key Adaptations
Claude Sonnet, Opus, Haiku XML tags, role extraction, Haiku simplification
OpenAI GPT-4o, o1, o3 Reasoning hints, grounding rules
Gemini Pro, Flash, Ultra Identity (baseline — no changes)
Qwen 235B, 32B, Coder Thinking mode, Tier 3 for 32B, English enforcement
DeepSeek V3, V3.1, V3.2 Self-verification, JSON reinforcement
Mistral Large, Magistral, Devstral, Ministral Marker suppression, type fixes, simplification
Llama 405B, 70B, 8B, 3B Grounding, small model simplification
Kimi K2, K2.5 Source grounding, English enforcement
GLM 4.7, 4.7 Flash Nested object fix, English, Flash simplification
Nemotron 30B, 12B, 9B Thinking mode, Tier 3 for small, simplification
MiniMax M2 Self-verification, contract-style

Task Types

Task When to Use
extraction Pulling structured data from documents
analysis Evaluating, comparing, or reasoning about data
generation Creating content, writing, summarizing
code Writing or reviewing code
general Everything else (default)

MCP Server

npm install -g @fwip/mcp-server

Add to your MCP config:

{
  "mcpServers": {
    "fwip": {
      "command": "fwip-mcp-server"
    }
  }
}

Adding New Model Adapters

See CONTRIBUTING.md for a 5-step guide to adding support for new models.

Research

Fwip's adaptation rules are derived from empirical testing across 46 model configurations on structured output tasks. Research paper coming soon.

License

MIT

Metadata

Release files for fwip 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fwip 0.1.0
File Size Uploaded Provenance Actions
fwip-0.1.0.tar.gz 17.0 kB Without provenance Details for fwip-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fwip 0.1.0
File Interpreter ABI Platform Actions
fwip-0.1.0-py3-none-any.whl Python 3 none any Details for fwip-0.1.0-py3-none-any.whl

Total release size: 40.1 kB

Release files / fwip-0.1.0.tar.gz

Download URL fwip-0.1.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0bf4f37c16e777d34403412d9944d3a33c2aee99b9f8874adbe9374da8743c4f
BLAKE2b-256 checksum
How to use checksums
7cc2d0fc8bccaf0a16fa0bb4d8976e5fa735bfcfb92a63acb849751f2e87effd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / fwip-0.1.0-py3-none-any.whl

Download URL fwip-0.1.0-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66a43a9e1130843e649df56a3d4b70b02dd7bb562c5aef19de026754e778a759
BLAKE2b-256 checksum
How to use checksums
a46ff52361acc54c1e7a7cf3f1dda41a4a91ea0ca1c233a6d7b328a20dde60ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for fwip 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page