Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout branch
uses: actions/checkout@v3
Expand All @@ -21,7 +21,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

Pytest plugin for automatically mocking OpenAI requests. Powered by [RESPX](https://github.com/lundberg/respx).

[![sdk support](https://img.shields.io/badge/SDK_Support-v1.66+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)
[![sdk support](https://img.shields.io/badge/SDK_Support-v2.0+-white?logo=openai&logoColor=black&labelColor=white)](https://github.com/openai/openai-python)

> [!NOTE]
> This project is in maintenance mode unless I see an appetite for more community contributions. I built this because we at [Definite](https://definite.app) needed a way to easily and quickly test the integration between [openai-python](https://github.com/openai/openai-python) and our codebase but we have [moved on to other frameworks/SDKs](https://pydantic.dev/articles/building-data-team-with-pydanticai). With that, my need and desire to work on this library has dropped significantly.
>
>
> I will be encouraging community contributions to fill in the gap for some of the new features released since the last major update to this library such as [evals](https://platform.openai.com/docs/api-reference/evals), [graders](https://platform.openai.com/docs/api-reference/graders), [containers](https://platform.openai.com/docs/api-reference/containers), and all of the new [administration](https://platform.openai.com/docs/api-reference/administration) endpoints.
>
> Absent community contributions, if the work required just for maintenance mode becomes too much (>2 hours a month) then this project will be fully deprecated and archived.
Expand Down
3 changes: 1 addition & 2 deletions examples/test_langchain_openai.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from langchain_openai import ChatOpenAI
from pydantic.v1 import SecretStr
from pydantic import SecretStr

import openai_responses
from openai_responses import OpenAIMock
Expand All @@ -24,7 +24,6 @@ def test_langchain_chat_openai_invoke(openai_mock: OpenAIMock):
name="My Custom Chatbot",
model="gpt-4o",
temperature=0,
max_tokens=None,
timeout=None,
max_retries=2,
api_key=SecretStr("sk-fake123"),
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ classifiers = [
openai_responses = "openai_responses.plugin"

[tool.poetry.dependencies]
python = ">=3.9,<4.0"
openai = ">=1.66,<2.0"
python = ">=3.10,<4.0"
openai = ">=2.0,<3.0"
requests-toolbelt = "^1"
respx = "^0.22.0"

[tool.poetry.group.dev.dependencies]
black = "^24.2.0"
langchain-openai = "^0.1.20"
langchain-openai = "^1.1.0"
mypy = "^1.9.0"
pytest = "^8.1.1"
pytest-asyncio = "^0.23.6"
Expand All @@ -42,7 +42,7 @@ ignore_missing_imports = true

[tool.pyright]
typeCheckingMode = "strict"
pythonVersion = "3.9"
pythonVersion = "3.10"
exclude = [".venv"]
venvPath = "."
venv = ".venv"
Expand Down
4 changes: 3 additions & 1 deletion src/openai_responses/_routes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def _handler(request: httpx.Request, route: respx.Route, **kwargs: Any):
assert not callable(self._response)
return httpx.Response(
status_code=self._status_code,
json=model_dict(self._build(self._response, request), by_alias=True),
json=model_dict(
self._build(self._response, request), by_alias=True
),
)

return _handler
Expand Down
3 changes: 2 additions & 1 deletion src/openai_responses/_routes/beta/vector_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import httpx
import respx

from openai._types import SequenceNotStr
from openai.pagination import SyncCursorPage
from openai.types.vector_store import VectorStore
from openai.types.vector_store_create_params import VectorStoreCreateParams
Expand Down Expand Up @@ -49,7 +50,7 @@ def _handler(self, request: httpx.Request, route: respx.Route) -> httpx.Response
model = self._build({}, request)
self._state.vector_stores.put(model)
content: VectorStoreCreateParams = json_loads(request.content)
file_ids = content.get("file_ids", [])
file_ids: SequenceNotStr[str] = content.get("file_ids", [])
for file_id in file_ids:
found_file = self._state.files.get(file_id)
if not found_file:
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ commands =

[testenv:unit]
commands =
pytest tests/unit -v {posargs}
pytest tests/unit -p no:warnings -v {posargs}

[testenv:pydantic{1,2}-examples]
commands =
pytest examples -v {posargs}
pytest examples -p no:warnings -v {posargs}