openai-responses


Nameopenai-responses JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttps://mharrisb1.github.io/openai-responses-python/
Summary🧪🤖 Pytest plugin for automatically mocking OpenAI requests
upload_time2024-06-19 16:27:03
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.32+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)

> [!NOTE]
> For working with OpenAI Python SDK versions `>=1.25,<1.32` please use version [`v0.6`](https://github.com/mharrisb1/openai-responses-python/releases/tag/v0.6.1)

## 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)
- [Models](https://platform.openai.com/docs/api-reference/models)
- [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)
- [Vector Stores](https://platform.openai.com/docs/api-reference/vector-stores)
- [Vector Store Files](https://platform.openai.com/docs/api-reference/vector-stores-files)
- [Vector Store File Batches](https://platform.openai.com/docs/api-reference/vector-stores-file-batches)

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

> [!TIP]
> ✨ Support for creating [streaming responses](https://mharrisb1.github.io/openai-responses-python/user_guide/streaming/) 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/32/67/3ccc88296a67d03e8a5feec8df2e874aa04d7b1265c969aa2b60f4149ff1/openai_responses-0.8.0.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.32+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)\n\n> [!NOTE]\n> For working with OpenAI Python SDK versions `>=1.25,<1.32` please use version [`v0.6`](https://github.com/mharrisb1/openai-responses-python/releases/tag/v0.6.1)\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- [Models](https://platform.openai.com/docs/api-reference/models)\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- [Vector Stores](https://platform.openai.com/docs/api-reference/vector-stores)\n- [Vector Store Files](https://platform.openai.com/docs/api-reference/vector-stores-files)\n- [Vector Store File Batches](https://platform.openai.com/docs/api-reference/vector-stores-file-batches)\n\nView full support coverage [here](https://mharrisb1.github.io/openai-responses-python/coverage).\n\n> [!TIP]\n> \u2728 Support for creating [streaming responses](https://mharrisb1.github.io/openai-responses-python/user_guide/streaming/) 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.8.0",
    "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": "1450ddffdad3bad3fe48001282c2bb6322434926f55f6bd2ec748e9d00585a4f",
                "md5": "961f2aa7728153284505e2e84a43a729",
                "sha256": "ed9ed798ce8dab80a68d740a70d135b029e7fcc3552444bbb521081fd2fcc48e"
            },
            "downloads": -1,
            "filename": "openai_responses-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "961f2aa7728153284505e2e84a43a729",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 47401,
            "upload_time": "2024-06-19T16:26:52",
            "upload_time_iso_8601": "2024-06-19T16:26:52.373792Z",
            "url": "https://files.pythonhosted.org/packages/14/50/ddffdad3bad3fe48001282c2bb6322434926f55f6bd2ec748e9d00585a4f/openai_responses-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "32673ccc88296a67d03e8a5feec8df2e874aa04d7b1265c969aa2b60f4149ff1",
                "md5": "4fda667f5ef1a082a808b70005d0d113",
                "sha256": "f1841def73fa34e319561f24f4d4b8f50be11641cb527349003e2d62def24f4d"
            },
            "downloads": -1,
            "filename": "openai_responses-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4fda667f5ef1a082a808b70005d0d113",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 24558,
            "upload_time": "2024-06-19T16:27:03",
            "upload_time_iso_8601": "2024-06-19T16:27:03.867918Z",
            "url": "https://files.pythonhosted.org/packages/32/67/3ccc88296a67d03e8a5feec8df2e874aa04d7b1265c969aa2b60f4149ff1/openai_responses-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-19 16:27:03",
    "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.41538s