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
2 changes: 1 addition & 1 deletion packages/paper-qa-nemotron/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dev = [
"pytest-recording",
"pytest-rerunfailures",
"pytest>=9", # Pin for pytest-subtests upstreaming
"vcrpy>=6", # Pin for https://github.com/kevin1024/vcrpy/issues/884
"vcrpy>=8", # Pin for dropping unused requests support
]
sagemaker = ["aiobotocore"]
typing = [
Expand Down
16 changes: 11 additions & 5 deletions packages/paper-qa-nemotron/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import httpx_aiohttp
import litellm.llms.custom_httpx.aiohttp_transport
import pytest
import vcr.stubs.httpx_stubs
import vcr.stubs.httpcore_stubs
from lmi.utils import (
ANTHROPIC_API_KEY_HEADER,
CROSSREF_KEY_HEADER,
Expand All @@ -29,6 +29,7 @@ def fixture_vcr_config() -> dict[str, Any]:
],
"record_mode": "once",
"cassette_library_dir": str(CASSETTES_DIR),
# "drop_unused_requests": True, # Restore after https://github.com/kevin1024/vcrpy/issues/961
}


Expand All @@ -50,9 +51,14 @@ async def __aiter__(self) -> AsyncIterator[bytes]:
yield chunk


async def _async_vcr_send(cassette, real_send, *args, **kwargs): # noqa: ARG001
"""VCR send that only sends, not possibly recording or playing back responses."""
return await real_send(*args, **kwargs)
async def _vcr_handle_async_request(
cassette, # noqa: ARG001
real_handle_async_request,
self,
real_request,
):
"""VCR handler that only sends, not possibly recording or playing back responses."""
return await real_handle_async_request(self, real_request)


# Permanently patch the original response stream,
Expand All @@ -64,4 +70,4 @@ async def _async_vcr_send(cassette, real_send, *args, **kwargs): # noqa: ARG001

# Permanently patch vcrpy's async VCR recording functionality,
# to work around https://github.com/kevin1024/vcrpy/issues/944
vcr.stubs.httpx_stubs._async_vcr_send = _async_vcr_send
vcr.stubs.httpcore_stubs._vcr_handle_async_request = _vcr_handle_async_request
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dev = [
"python-dotenv",
"refurb>=2", # Pin to keep recent
"typeguard",
"vcrpy>=6", # Pin for https://github.com/kevin1024/vcrpy/issues/884
"vcrpy>=8", # Pin for dropping unused requests support
]
docling = ["paper-qa-docling"]
image = ["fhlmi[image]"]
Expand Down
16 changes: 11 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import httpx_aiohttp
import litellm.llms.custom_httpx.aiohttp_transport
import pytest
import vcr.stubs.httpx_stubs
import vcr.stubs.httpcore_stubs
from dotenv import load_dotenv
from lmi.utils import (
ANTHROPIC_API_KEY_HEADER,
Expand Down Expand Up @@ -117,6 +117,7 @@ def fixture_vcr_config() -> dict[str, Any]:
"record_mode": "once" if not IN_GITHUB_ACTIONS else "none",
"allow_playback_repeats": True,
"cassette_library_dir": str(CASSETTES_DIR),
# "drop_unused_requests": True, # Restore after https://github.com/kevin1024/vcrpy/issues/961
}


Expand Down Expand Up @@ -213,9 +214,14 @@ async def __aiter__(self) -> AsyncIterator[bytes]:
yield chunk


async def _async_vcr_send(cassette, real_send, *args, **kwargs): # noqa: ARG001
"""VCR send that only sends, not possibly recording or playing back responses."""
return await real_send(*args, **kwargs)
async def _vcr_handle_async_request(
cassette, # noqa: ARG001
real_handle_async_request,
self,
real_request,
):
"""VCR handler that only sends, not possibly recording or playing back responses."""
return await real_handle_async_request(self, real_request)


# Permanently patch the original response stream,
Expand All @@ -227,4 +233,4 @@ async def _async_vcr_send(cassette, real_send, *args, **kwargs): # noqa: ARG001

# Permanently patch vcrpy's async VCR recording functionality,
# to work around https://github.com/kevin1024/vcrpy/issues/944
vcr.stubs.httpx_stubs._async_vcr_send = _async_vcr_send
vcr.stubs.httpcore_stubs._vcr_handle_async_request = _vcr_handle_async_request
12 changes: 5 additions & 7 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.