🧪🤖 openai-responses
Pytest plugin for automatically mocking OpenAI requests. Powered by RESPX.
![sdk support](https://img.shields.io/badge/SDK_Support-v1.32+-white?logo=openai&logoColor=black&labelColor=white)
Supported Endpoints
View full support coverage here.
[!TIP]
✨ 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 or with HTTPX).
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 or docs for more.
Installation
![PyPI - Downloads](https://img.shields.io/pypi/dm/openai-responses)
Available on PyPI
pip install openai-responses
Documentation
![Docs](https://github.com/mharrisb1/openai-responses-python/actions/workflows/docs.yml/badge.svg)
See the documentation site for more info.
License
![PyPI - License](https://img.shields.io/pypi/l/openai-responses)
See LICENSE for more info.
Contributing
![Stargazers](https://img.shields.io/github/stars/mharrisb1/openai-responses-python?style)
See CONTRIBUTING.md for info on PRs, issues, and feature requests.
Changelog
See CHANGELOG.md for summarized notes on changes or view releases for more details information on changes.