openai-responses


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

## Supported Endpoints

- [Chat](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_chat_completion.py)
- [Embeddings](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_embeddings.py)
- [Files](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_files.py)
- [Models](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_models.py)
- [Moderations](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_moderations.py)
- [Assistants](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_assistants.py)
- [Threads](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_threads.py)
- [Messages](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_messages.py)
- [Runs](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_runs.py)
- [Run Steps](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_run_steps.py)
- [Vector Stores](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_vector_stores.py)
- [Vector Store Files](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_vector_store_files.py)
- [Vector Store File Batches](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_vector_store_file_batches.py)

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/9b/3c/b7dc26d9b6d16bcc63b85f73343b688b2536a864cc2fb5b1fa4fa18a5271/openai_responses-0.11.3.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.50+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)\n\n## Supported Endpoints\n\n- [Chat](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_chat_completion.py)\n- [Embeddings](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_embeddings.py)\n- [Files](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_files.py)\n- [Models](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_models.py)\n- [Moderations](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_moderations.py)\n- [Assistants](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_assistants.py)\n- [Threads](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_threads.py)\n- [Messages](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_messages.py)\n- [Runs](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_runs.py)\n- [Run Steps](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_run_steps.py)\n- [Vector Stores](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_vector_stores.py)\n- [Vector Store Files](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_vector_store_files.py)\n- [Vector Store File Batches](https://github.com/mharrisb1/openai-responses-python/blob/main/examples/test_vector_store_file_batches.py)\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.11.3",
    "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": "fc25f7fa50b1393e7e3e0205b6701c3011f40287752386b03a86f6e0fc26cb33",
                "md5": "8c0a0e8fe028901a00b51a9eb87bc216",
                "sha256": "e055da320c870d6cf5ecfaac7b7085dd7305cfa789b2273adbcbdc58c9d65589"
            },
            "downloads": -1,
            "filename": "openai_responses-0.11.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c0a0e8fe028901a00b51a9eb87bc216",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 51670,
            "upload_time": "2024-12-20T03:15:02",
            "upload_time_iso_8601": "2024-12-20T03:15:02.849614Z",
            "url": "https://files.pythonhosted.org/packages/fc/25/f7fa50b1393e7e3e0205b6701c3011f40287752386b03a86f6e0fc26cb33/openai_responses-0.11.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b3cb7dc26d9b6d16bcc63b85f73343b688b2536a864cc2fb5b1fa4fa18a5271",
                "md5": "9461e8b77143d54d7a75caf5c2b1eebc",
                "sha256": "c03967771423fac77c2a668f71acbe365930185b1624299042c6cfe99dfbe391"
            },
            "downloads": -1,
            "filename": "openai_responses-0.11.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9461e8b77143d54d7a75caf5c2b1eebc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 26587,
            "upload_time": "2024-12-20T03:15:04",
            "upload_time_iso_8601": "2024-12-20T03:15:04.149796Z",
            "url": "https://files.pythonhosted.org/packages/9b/3c/b7dc26d9b6d16bcc63b85f73343b688b2536a864cc2fb5b1fa4fa18a5271/openai_responses-0.11.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-20 03:15:04",
    "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.40574s