openai-responses


Nameopenai-responses JSON
Version 0.4.1 PyPI version JSON
download
home_pagehttps://mharrisb1.github.io/openai-responses-python/
Summary🧪🤖 Pytest plugin for automatically mocking OpenAI requests
upload_time2024-05-23 13:48:07
maintainerNone
docs_urlNone
authorMichael Harris
requires_python<4.0,>=3.9
licenseMIT
keywords openai pytest testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🧪🤖 openai-responses

Pytest plugin for automatically mocking OpenAI requests. Powered by [RESPX](https://github.com/lundberg/respx).

[![sdk support](https://img.shields.io/badge/SDK_Support-v1.25+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)

## Supported Endpoints

- [Chat](https://platform.openai.com/docs/api-reference/chat)
- [Embeddings](https://platform.openai.com/docs/api-reference/embeddings)
- [Files](https://platform.openai.com/docs/api-reference/files)
- [Assistants](https://platform.openai.com/docs/api-reference/assistants)
- [Threads](https://platform.openai.com/docs/api-reference/threads)
- [Messages](https://platform.openai.com/docs/api-reference/messages)
- [Runs](https://platform.openai.com/docs/api-reference/runs)
- [Run Steps](https://platform.openai.com/docs/api-reference/run-steps)

View full support coverage [here](https://mharrisb1.github.io/openai-responses-python/coverage).

> [!NOTE]
> ✨ Support for creating streaming responses added in v0.4

## Usage

Just decorate any test function that makes a call to the OpenAI API (either using [openai-python](https://github.com/openai/openai-python) or with [HTTPX](https://www.python-httpx.org/)).

```python
import openai

import openai_responses


@openai_responses.mock()
def test_create_assistant():
    client = openai.Client(api_key="sk-fake123")

    assistant = client.beta.assistants.create(
        instructions="You are a personal math tutor.",
        name="Math Tutor",
        tools=[{"type": "code_interpreter"}],
        model="gpt-4-turbo",
    )

    assert assistant.name == "Math Tutor"
```

See [examples](https://github.com/mharrisb1/openai-responses-python/tree/main/examples) or [docs](https://mharrisb1.github.io/openai-responses-python) for more.

## Installation

[![PyPI version](https://badge.fury.io/py/openai-responses.svg)](https://badge.fury.io/py/openai-responses)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openai-responses.svg)](https://pypi.org/project/openai-responses/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/openai-responses)](https://pypi.org/project/openai-responses/)

Available on [PyPI](https://pypi.org/project/openai-responses/)

```bash
pip install openai-responses
```

## Documentation

[![Docs](https://github.com/mharrisb1/openai-responses-python/actions/workflows/docs.yml/badge.svg)](https://mharrisb1.github.io/openai-responses-python)

See the [documentation site](https://mharrisb1.github.io/openai-responses-python) for more info.

## License

[![PyPI - License](https://img.shields.io/pypi/l/openai-responses)](https://opensource.org/blog/license/mit)

See [LICENSE](https://github.com/mharrisb1/openai-responses-python/blob/main/LICENSE) for more info.

## Contributing

[![Open Issues](https://img.shields.io/github/issues/mharrisb1/openai-responses-python)](https://github.com/mharrisb1/openai-responses-python/issues)
[![Stargazers](https://img.shields.io/github/stars/mharrisb1/openai-responses-python?style)](https://pypistats.org/packages/openai-responses)

See [CONTRIBUTING.md](https://github.com/mharrisb1/openai-responses-python/blob/main/CONTRIBUTING.md) for info on PRs, issues, and feature requests.

## Changelog

See [CHANGELOG.md](https://github.com/mharrisb1/openai-responses-python/blob/main/CHANGELOG.md) for summarized notes on changes or view [releases](https://github.com/mharrisb1/openai-responses-python/releases) for more details information on changes.

            

Raw data

            {
    "_id": null,
    "home_page": "https://mharrisb1.github.io/openai-responses-python/",
    "name": "openai-responses",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "openai, pytest, testing",
    "author": "Michael Harris",
    "author_email": "mharris@definite.app",
    "download_url": "https://files.pythonhosted.org/packages/93/b4/223f5233da01d46582d7793d4f6b86d4dc335ffbf0b68f04474a4dee2bb2/openai_responses-0.4.1.tar.gz",
    "platform": null,
    "description": "# \ud83e\uddea\ud83e\udd16 openai-responses\n\nPytest plugin for automatically mocking OpenAI requests. Powered by [RESPX](https://github.com/lundberg/respx).\n\n[![sdk support](https://img.shields.io/badge/SDK_Support-v1.25+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)\n\n## Supported Endpoints\n\n- [Chat](https://platform.openai.com/docs/api-reference/chat)\n- [Embeddings](https://platform.openai.com/docs/api-reference/embeddings)\n- [Files](https://platform.openai.com/docs/api-reference/files)\n- [Assistants](https://platform.openai.com/docs/api-reference/assistants)\n- [Threads](https://platform.openai.com/docs/api-reference/threads)\n- [Messages](https://platform.openai.com/docs/api-reference/messages)\n- [Runs](https://platform.openai.com/docs/api-reference/runs)\n- [Run Steps](https://platform.openai.com/docs/api-reference/run-steps)\n\nView full support coverage [here](https://mharrisb1.github.io/openai-responses-python/coverage).\n\n> [!NOTE]\n> \u2728 Support for creating streaming responses added in v0.4\n\n## Usage\n\nJust decorate any test function that makes a call to the OpenAI API (either using [openai-python](https://github.com/openai/openai-python) or with [HTTPX](https://www.python-httpx.org/)).\n\n```python\nimport openai\n\nimport openai_responses\n\n\n@openai_responses.mock()\ndef test_create_assistant():\n    client = openai.Client(api_key=\"sk-fake123\")\n\n    assistant = client.beta.assistants.create(\n        instructions=\"You are a personal math tutor.\",\n        name=\"Math Tutor\",\n        tools=[{\"type\": \"code_interpreter\"}],\n        model=\"gpt-4-turbo\",\n    )\n\n    assert assistant.name == \"Math Tutor\"\n```\n\nSee [examples](https://github.com/mharrisb1/openai-responses-python/tree/main/examples) or [docs](https://mharrisb1.github.io/openai-responses-python) for more.\n\n## Installation\n\n[![PyPI version](https://badge.fury.io/py/openai-responses.svg)](https://badge.fury.io/py/openai-responses)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openai-responses.svg)](https://pypi.org/project/openai-responses/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/openai-responses)](https://pypi.org/project/openai-responses/)\n\nAvailable on [PyPI](https://pypi.org/project/openai-responses/)\n\n```bash\npip install openai-responses\n```\n\n## Documentation\n\n[![Docs](https://github.com/mharrisb1/openai-responses-python/actions/workflows/docs.yml/badge.svg)](https://mharrisb1.github.io/openai-responses-python)\n\nSee the [documentation site](https://mharrisb1.github.io/openai-responses-python) for more info.\n\n## License\n\n[![PyPI - License](https://img.shields.io/pypi/l/openai-responses)](https://opensource.org/blog/license/mit)\n\nSee [LICENSE](https://github.com/mharrisb1/openai-responses-python/blob/main/LICENSE) for more info.\n\n## Contributing\n\n[![Open Issues](https://img.shields.io/github/issues/mharrisb1/openai-responses-python)](https://github.com/mharrisb1/openai-responses-python/issues)\n[![Stargazers](https://img.shields.io/github/stars/mharrisb1/openai-responses-python?style)](https://pypistats.org/packages/openai-responses)\n\nSee [CONTRIBUTING.md](https://github.com/mharrisb1/openai-responses-python/blob/main/CONTRIBUTING.md) for info on PRs, issues, and feature requests.\n\n## Changelog\n\nSee [CHANGELOG.md](https://github.com/mharrisb1/openai-responses-python/blob/main/CHANGELOG.md) for summarized notes on changes or view [releases](https://github.com/mharrisb1/openai-responses-python/releases) for more details information on changes.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83e\uddea\ud83e\udd16 Pytest plugin for automatically mocking OpenAI requests",
    "version": "0.4.1",
    "project_urls": {
        "Documentation": "https://mharrisb1.github.io/openai-responses-python/",
        "Homepage": "https://mharrisb1.github.io/openai-responses-python/",
        "Repository": "https://github.com/mharrisb1/openai-responses-python"
    },
    "split_keywords": [
        "openai",
        " pytest",
        " testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4f424ac43a0ea628ea0fbac0a4d12b42046e3b441746f5ecefaaf32d4c8d0e4",
                "md5": "013d51f9e362fb220c387111789d303c",
                "sha256": "fc79208c1f1ba63a0ada44511ffa3d66e5f97e2f80fa26f2007f62dfa37838ac"
            },
            "downloads": -1,
            "filename": "openai_responses-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "013d51f9e362fb220c387111789d303c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 34195,
            "upload_time": "2024-05-23T13:48:05",
            "upload_time_iso_8601": "2024-05-23T13:48:05.304974Z",
            "url": "https://files.pythonhosted.org/packages/d4/f4/24ac43a0ea628ea0fbac0a4d12b42046e3b441746f5ecefaaf32d4c8d0e4/openai_responses-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "93b4223f5233da01d46582d7793d4f6b86d4dc335ffbf0b68f04474a4dee2bb2",
                "md5": "449f5f60b995445d11dcbd377a4e4195",
                "sha256": "b2585afa96dda8a63d25a420d1faba58e149bbbb48b2ca9d1085fe6948cee4a3"
            },
            "downloads": -1,
            "filename": "openai_responses-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "449f5f60b995445d11dcbd377a4e4195",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 19175,
            "upload_time": "2024-05-23T13:48:07",
            "upload_time_iso_8601": "2024-05-23T13:48:07.809721Z",
            "url": "https://files.pythonhosted.org/packages/93/b4/223f5233da01d46582d7793d4f6b86d4dc335ffbf0b68f04474a4dee2bb2/openai_responses-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-23 13:48:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mharrisb1",
    "github_project": "openai-responses-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "openai-responses"
}
        
Elapsed time: 0.24726s