Skip to content

Commit

Permalink
Merge pull request #16 from mharrisb1:release/0.2.x
Browse files Browse the repository at this point in the history
chore(docs): add link to doc site
  • Loading branch information
mharrisb1 authored Apr 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents f0b34f7 + 2872f43 commit 498b169
Showing 3 changed files with 79 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.2.0

Migrates assistant endpoints to Assistants V2

- [#8: feat: assistants v2](https://github.com/mharrisb1/openai-responses-python/issues/8)
- [#13: feat(endpoints): add token usage estimates to chat endpoint](https://github.com/mharrisb1/openai-responses-python/issues/13)

## 0.1.1

Fixes some issues with chat completions and other stateless mocks
17 changes: 16 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Contributing

All contributions are welcome but I need to setup CI tests so nothing will be merged in until that is done.
All contributions are welcome.

## Development Environment

This project uses [Poetry](https://python-poetry.org/) to manage Python environment, [Black](https://github.com/psf/black) to format code,
and [mypy](https://mypy-lang.org/) to run static analysis. Please make sure your environment is setup with these enabled.

To make sure everything is working correctly, make sure you have Poetry installed, then install the dependencies, and then run [tox](https://tox.wiki/en/4.14.2/).

```sh
pipx install poetry==1.8 --force
poetry config virtualenvs.in-project true
poetry install --with dev
poetry shell
tox run
```
60 changes: 56 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,60 @@
# openai-responses-python
# openai-responses

[![PyPI version](https://badge.fury.io/py/openai-responses.svg)](https://badge.fury.io/py/openai-responses)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/openai-responses)](https://pypi.org/project/openai-responses/)
[![PyPI - License](https://img.shields.io/pypi/l/openai-responses)](https://opensource.org/blog/license/mit)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openai-responses.svg)](https://pypi.org/project/openai-responses/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/openai-responses)](https://pypi.org/project/openai-responses/)
[![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)


Pytest plugin for automatically mocking OpenAI requests. Simply decorate any test function that contains code that calls an OpenAI endpoint (either using the SDK or HTTPX).

```python
import openai_responses
from openai import OpenAI


@openai_responses.mock.chat.completions(
choices=[
{"message": {"content": "Hello, how can I help?"}},
{"message": {"content": "Hi! I'm here to help!"}},
{"message": {"content": "How can I help?"}},
],
)
def test_create_completion_with_multiple_choices():
client = OpenAI(api_key="fakeKey")
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
n=3,
)
assert len(completion.choices) == 3
```

## Installation

Available on [PyPi](https://pypi.org/project/openai-responses/)

```bash
pip install openai-responses
```

## Usage

See the [documentation site](https://mharrisb1.github.io/openai-responses-python) for more info.

## License

See [LICENSE](https://github.com/mharrisb1/openai-responses-python/blob/main/LICENSE) for more info.

## Contributing

See [CONTRIBUTING.md](https://github.com/mharrisb1/openai-responses-python/blob/main/CONTRIBUTING.md) for more info.

## Changelog

Automatically mock OpenAI requests
See [CHANGELOG.md](https://github.com/mharrisb1/openai-responses-python/blob/main/CHANGELOG.md) for more info.

0 comments on commit 498b169

Please sign in to comment.