promptfold


Namepromptfold JSON
Version 1.0.15 PyPI version JSON
download
home_pageNone
SummaryPython client for PromptFold API - optimize prompts with PromptFold
upload_time2025-08-07 18:51:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords promptfold optimization api client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PromptFold Client Library

This package provides a simple Python client for the PromptFold API available on PyPI.

## Installation
```bash
pip install promptfold
```

## Usage

```python
import openai
from promptfold_client import PromptFold

# Initialize PromptFold client, compress your system prompt
pf_client = PromptFold(api_key="YOUR_PROMPTFOLD_API_KEY", system_prompt="Your system prompt.")

# Compress the original user prompt and system prompt
compressed = pf_client.compress_prompt(user_prompt="Input user prompt")

# Call OpenAI's GPT-4 with the compressed prompt
openai.api_key = "YOUR_OPENAI_API_KEY"
response = openai.ChatCompletion.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": compressed.compressed_system_prompt},
        {"role": "user", "content": compressed.compressed_user_prompt}
    ]
)

# Print the response from GPT-4
print(response["choices"][0]["message"]["content"])

```

## Publishing a New Version (for Maintainers)

Publishing the client is handled by a script that automates the entire process.

**Prerequisites:**
1.  **PyPI Account:** You need an account on [PyPI](https://pypi.org) and an API token.
2.  **Twine Configuration:** Your local machine must be configured to authenticate with PyPI. You can do this by setting the `TWINE_USERNAME` and `TWINE_PASSWORD` environment variables.

**To publish a new version:**
1.  Navigate to the client directory: `cd promptfold_client`
2.  Run the publishing script. You have two options:
    *   **To automatically bump the patch version** (e.g., `1.0.1` -> `1.0.2`), run the script without arguments:
        ```bash
        ./publish_pypi.sh
        ```
    *   **To specify an exact version** (e.g., for a major release like `2.0.0`), provide it as an argument:
        ```bash
        ./publish_pypi.sh 2.0.0
        ```
3.  The script will handle everything else automatically.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "promptfold",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "promptfold, optimization, api, client",
    "author": null,
    "author_email": "PromptFold Team <team@promptfold.com>",
    "download_url": "https://files.pythonhosted.org/packages/cd/3c/24ecc4de65d8678633130bfba5f6ebe572a7c5fc15948f218873fbfdb2ff/promptfold-1.0.15.tar.gz",
    "platform": null,
    "description": "# PromptFold Client Library\n\nThis package provides a simple Python client for the PromptFold API available on PyPI.\n\n## Installation\n```bash\npip install promptfold\n```\n\n## Usage\n\n```python\nimport openai\nfrom promptfold_client import PromptFold\n\n# Initialize PromptFold client, compress your system prompt\npf_client = PromptFold(api_key=\"YOUR_PROMPTFOLD_API_KEY\", system_prompt=\"Your system prompt.\")\n\n# Compress the original user prompt and system prompt\ncompressed = pf_client.compress_prompt(user_prompt=\"Input user prompt\")\n\n# Call OpenAI's GPT-4 with the compressed prompt\nopenai.api_key = \"YOUR_OPENAI_API_KEY\"\nresponse = openai.ChatCompletion.create(\n    model=\"gpt-4o\",\n    messages=[\n        {\"role\": \"system\", \"content\": compressed.compressed_system_prompt},\n        {\"role\": \"user\", \"content\": compressed.compressed_user_prompt}\n    ]\n)\n\n# Print the response from GPT-4\nprint(response[\"choices\"][0][\"message\"][\"content\"])\n\n```\n\n## Publishing a New Version (for Maintainers)\n\nPublishing the client is handled by a script that automates the entire process.\n\n**Prerequisites:**\n1.  **PyPI Account:** You need an account on [PyPI](https://pypi.org) and an API token.\n2.  **Twine Configuration:** Your local machine must be configured to authenticate with PyPI. You can do this by setting the `TWINE_USERNAME` and `TWINE_PASSWORD` environment variables.\n\n**To publish a new version:**\n1.  Navigate to the client directory: `cd promptfold_client`\n2.  Run the publishing script. You have two options:\n    *   **To automatically bump the patch version** (e.g., `1.0.1` -> `1.0.2`), run the script without arguments:\n        ```bash\n        ./publish_pypi.sh\n        ```\n    *   **To specify an exact version** (e.g., for a major release like `2.0.0`), provide it as an argument:\n        ```bash\n        ./publish_pypi.sh 2.0.0\n        ```\n3.  The script will handle everything else automatically.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for PromptFold API - optimize prompts with PromptFold",
    "version": "1.0.15",
    "project_urls": {
        "Homepage": "https://github.com/paulcrowley/promptfold",
        "Issues": "https://github.com/paulcrowley/promptfold/issues",
        "Repository": "https://github.com/paulcrowley/promptfold"
    },
    "split_keywords": [
        "promptfold",
        " optimization",
        " api",
        " client"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aa4f5f0da6d4d086df90c5fa41e5a387f9ab4eb9e4abcaea02210c3298187567",
                "md5": "798f86169650f76da37b0d04a2dc31f8",
                "sha256": "23203ced19c2fa362643207cfb181e7e5dd24e3c70309b3514ce93c7ad7f7520"
            },
            "downloads": -1,
            "filename": "promptfold-1.0.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "798f86169650f76da37b0d04a2dc31f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4997,
            "upload_time": "2025-08-07T18:51:43",
            "upload_time_iso_8601": "2025-08-07T18:51:43.470686Z",
            "url": "https://files.pythonhosted.org/packages/aa/4f/5f0da6d4d086df90c5fa41e5a387f9ab4eb9e4abcaea02210c3298187567/promptfold-1.0.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cd3c24ecc4de65d8678633130bfba5f6ebe572a7c5fc15948f218873fbfdb2ff",
                "md5": "d8be89445fb6bdae039fd513e38bb188",
                "sha256": "b7c7c9b536a3e99619bdff9edf83410fbdbfa35c548eda924f5728f875e4f91d"
            },
            "downloads": -1,
            "filename": "promptfold-1.0.15.tar.gz",
            "has_sig": false,
            "md5_digest": "d8be89445fb6bdae039fd513e38bb188",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4939,
            "upload_time": "2025-08-07T18:51:44",
            "upload_time_iso_8601": "2025-08-07T18:51:44.633988Z",
            "url": "https://files.pythonhosted.org/packages/cd/3c/24ecc4de65d8678633130bfba5f6ebe572a7c5fc15948f218873fbfdb2ff/promptfold-1.0.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-07 18:51:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paulcrowley",
    "github_project": "promptfold",
    "github_not_found": true,
    "lcname": "promptfold"
}
        
Elapsed time: 0.85692s