🧪🤖 Pytest plugin for automatically mocking OpenAI requests
Project description
🧪🤖 openai-responses
Pytest plugin for automatically mocking OpenAI requests. Powered by RESPX.
Supported Endpoints
- Chat
- Embeddings
- Files
- Models
- Moderations
- Assistants
- Threads
- Messages
- Runs
- Run Steps
- Vector Stores
- Vector Store Files
- Vector Store File Batches
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
Available on PyPI
pip install openai-responses
Documentation
See the documentation site for more info.
License
See LICENSE for more info.
Contributing
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openai_responses-0.11.1.tar.gz
(26.6 kB
view hashes)
Built Distribution
Close
Hashes for openai_responses-0.11.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03867c73165152e5b761a1f7be850efba2966347705cb9f0bd01589d4e711daa |
|
MD5 | 9ee4eb55986b982de515f1c98dae1177 |
|
BLAKE2b-256 | 850f6b03c270eeb9a343acbf7a552fa6271ea76af0bed13fc24b1483b1823b2f |