Skip to main content

🧪🤖 Pytest plugin for automatically mocking OpenAI requests

Project description

🧪🤖 openai-responses

Pytest plugin for automatically mocking OpenAI requests. Powered by RESPX.

sdk support

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 version PyPI - Python Version PyPI - Downloads

Available on PyPI

pip install openai-responses

Documentation

Docs

See the documentation site for more info.

License

PyPI - License

See LICENSE for more info.

Contributing

Open Issues Stargazers

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


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.2.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

openai_responses-0.11.2-py3-none-any.whl (51.7 kB view details)

Uploaded Python 3

File details

Details for the file openai_responses-0.11.2.tar.gz.

File metadata

  • Download URL: openai_responses-0.11.2.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/23.5.0

File hashes

Hashes for openai_responses-0.11.2.tar.gz
Algorithm Hash digest
SHA256 2de311d18aa5518630802f0487abbf5c3254ac8eaa0d334c5ad9146bd7082e2f
MD5 c862d9c6f6a975a08e48e592c0da4d87
BLAKE2b-256 3638d91a4b00235dc94a313401066587488e1ede053f0f80359a6e8088cf2149

See more details on using hashes here.

File details

Details for the file openai_responses-0.11.2-py3-none-any.whl.

File metadata

File hashes

Hashes for openai_responses-0.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 302993370c6c76a502bb58b1a8ee750c6b10d74f9093b995bb54801c79b06e17
MD5 da19a775110ecf5c86cba66a99497d44
BLAKE2b-256 2f44244f749b2073f893e8dec12ec62b8717f55f89690e9c10daea2dd9bcb3b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page