-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #16 from mharrisb1:release/0.2.x
chore(docs): add link to doc site
- Loading branch information
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |