semantic-eq


Namesemantic-eq JSON
Version 1.0.6 PyPI version JSON
download
home_pageNone
SummaryPython client for Semantic Equivalence API - optimize prompts for semantic equivalence
upload_time2025-07-24 14:58:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords semantic equivalence optimization api client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Semantic EQ Client

This package provides a simple Python client for the Semantic EQ API.

## Installation
```bash
pip install semantic-eq
```

## Usage

```python
from client_lib import SemanticEQ
import openai

# Initialize SemanticEQ client, compress your system prompt
seq_client = SemanticEQ(api_key="YOUR_SEMANTIC_EQ_API_KEY", system_prompt="<your-input-system-prompt>")

# Compress the original user prompt and system prompt
compressed = seq_client.compress_prompt(user_prompt="Your long and detailed prompt...")

# Call OpenAI's GPT-4 with the compressed prompt
openai.api_key = "YOUR_OPENAI_API_KEY"
response = openai.ChatCompletion.create(
    model="gpt-4o",  # or "gpt-4" if preferred
    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 semantic_eq_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_client_lib.sh
        ```
    *   **To specify an exact version** (e.g., for a major release like `2.0.0`), provide it as an argument:
        ```bash
        ./publish_client_lib.sh 2.0.0
        ```
3.  The script will handle everything else automatically.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "semantic-eq",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "semantic, equivalence, optimization, api, client",
    "author": null,
    "author_email": "Semantic EQ Team <team@semantic-eq.com>",
    "download_url": "https://files.pythonhosted.org/packages/e6/ec/ad0e9f473e883a83bae7941543e3b31e0b67fd71b432ee6785ff2a3f64e3/semantic_eq-1.0.6.tar.gz",
    "platform": null,
    "description": "# Semantic EQ Client\n\nThis package provides a simple Python client for the Semantic EQ API.\n\n## Installation\n```bash\npip install semantic-eq\n```\n\n## Usage\n\n```python\nfrom client_lib import SemanticEQ\nimport openai\n\n# Initialize SemanticEQ client, compress your system prompt\nseq_client = SemanticEQ(api_key=\"YOUR_SEMANTIC_EQ_API_KEY\", system_prompt=\"<your-input-system-prompt>\")\n\n# Compress the original user prompt and system prompt\ncompressed = seq_client.compress_prompt(user_prompt=\"Your long and detailed 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\",  # or \"gpt-4\" if preferred\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 semantic_eq_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_client_lib.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_client_lib.sh 2.0.0\n        ```\n3.  The script will handle everything else automatically.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for Semantic Equivalence API - optimize prompts for semantic equivalence",
    "version": "1.0.6",
    "project_urls": {
        "Homepage": "https://github.com/paulcrowley/semantic-eq",
        "Issues": "https://github.com/paulcrowley/semantic-eq/issues",
        "Repository": "https://github.com/paulcrowley/semantic-eq"
    },
    "split_keywords": [
        "semantic",
        " equivalence",
        " optimization",
        " api",
        " client"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9d1ee416d143c922809d982bf54ad1c6fe2dcf715e67007af7bde90266fa6bd2",
                "md5": "c025c40e82f0f37a2dbe2fdaac52b18f",
                "sha256": "9b433e714bb0fe0e80bc299b7281fa6447e3bef9eb8313db32be98a606ab87e4"
            },
            "downloads": -1,
            "filename": "semantic_eq-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c025c40e82f0f37a2dbe2fdaac52b18f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5035,
            "upload_time": "2025-07-24T14:58:34",
            "upload_time_iso_8601": "2025-07-24T14:58:34.257891Z",
            "url": "https://files.pythonhosted.org/packages/9d/1e/e416d143c922809d982bf54ad1c6fe2dcf715e67007af7bde90266fa6bd2/semantic_eq-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e6ecad0e9f473e883a83bae7941543e3b31e0b67fd71b432ee6785ff2a3f64e3",
                "md5": "96c0b56e680e733d1d1721428e7e3bda",
                "sha256": "6a75e4179c51a18a025b0d3c7b7891fe2f0bb0891128982c96a9ae109b26ed0c"
            },
            "downloads": -1,
            "filename": "semantic_eq-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "96c0b56e680e733d1d1721428e7e3bda",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4837,
            "upload_time": "2025-07-24T14:58:35",
            "upload_time_iso_8601": "2025-07-24T14:58:35.078233Z",
            "url": "https://files.pythonhosted.org/packages/e6/ec/ad0e9f473e883a83bae7941543e3b31e0b67fd71b432ee6785ff2a3f64e3/semantic_eq-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-24 14:58:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paulcrowley",
    "github_project": "semantic-eq",
    "github_not_found": true,
    "lcname": "semantic-eq"
}
        
Elapsed time: 1.49105s