Skip to content

Commit

Permalink
Fixed vcr set up for test_tool_selector_from_model_name by also match…
Browse files Browse the repository at this point in the history
…ing body
  • Loading branch information
jamesbraza committed Oct 6, 2024
1 parent 4bff08a commit 3f2158b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,36 @@ interactions:
response:
body:
string: !!binary |
H4sIAAAAAAAAAwAAAP//xFRdb5swFH3nV1h+DhMwd9C8pd26SIlWZek+2nVCxlzAmbGZ7SRNo/z3
CUgDSadtL9V4QOYe33PuMb536yCEeYqHCLOCWlZWwh1dzQRbJe8nNxu+vPzyeX4dhtfRxfkmP7t7
iwd1hkoWwOxT1iumykqA5Uq2MNNALdSsfhhEAfH98E0DlCoFUafllXWJcksuuRt4AXG90PWjfXah
OAODh+ibgxBC2+Zd1ylTeMBD5A2eIiUYQ3PAw8MmhLBWoo5gagw3lkqLBx3IlLQg69LlUogeYJUS
MaNCdMLts+2tu8OiQsRf6VQy/5O5uJpO5Wq2+Uler8n13bqn11JvqqagbCnZ4ZB6+CE+PBFDCEta
NrmlWkEsILNxQWV6woAQpjpfliBtXT3e3uO0sc7gvv4J3g4f7d/1vnaDf/I6is5HagLhfFx8eJi/
y0gY6ks2mb2YV83z4n+ZTfhYLxa3wj5Gmf9xRjgpbm/UePUSZk3JBcRUpvGaruBvXv/k7bD+3rvW
GrKloWJ/352TY8BC5ZVWiTnpB5xxyU0Ra6CmKR8bq6pWu9ZpFPDyqPdwpVVZ2diqHyBrQp8ELR/u
5kOHnkV70CpLRRcPvH17H/PFKVjKm+Y8zANGWQFpl+o5PXPPRX9H0RrkMn/G4uyZsNkYC2WccZmD
rjRvhgfOqjgkCSVhQijDzs75BQAA//8DAMjqX+ZKBQAA
H4sIAAAAAAAAAwAAAP//xFRdb5swFH3nV1j3OUyEko/mre2Wdd1aNV0fUq0TMuYCboyNbJOkjfLf
JyANJJ22vVTjAZl7OOfcY7jeOIQAj2FCgGXUsrwQ7tl0Vp5m8SUu6eXw7n5lx0pNmbJ4LqMAehVD
RU/I7CvrA1N5IdByJRuYaaQWK9X+yB/7QX/kDWogVzGKipYW1g2Um3PJXd/zA9cbuf3xjp0pztDA
hPxwCCFkU9+rPmWMa5gQr/daydEYmiJM9i8RAlqJqgLUGG4slRZ6LciUtCir1mUpRAewSomQUSFa
4+badNbtZlEhwvn96EKOfSk+Dsvb+Hy9Dlbp/NP1U8evkX4u6oaSUrL9JnXwfX1yZEYISJrX3Fwt
MRSY2DCjMj5SIASoTsscpa26h80jxHV0ho/VR/C8LRwQtp2nbe+fwp4s6Ge1sIO7F/5tpk9eUtQP
BadX7xZW8zT7b2n7J3r5ZX7Tj268q+lsML29uP768P1s+B5pTc4FhlTG4You8W9h/5Rtv/7Z+bE1
JqWhYvfHO0fbAEKlhVaROZoISLjkJgs1UlO3D8aqovGufGoHKA+mDwqt8sKGVi1QVoL9wG/0oD0h
WnQw3oFWWSrauu/tBvxQL4zRUl6P5/5EYJRlGLdUz+mEe2v6O4kmIJfpGxVnpwTm2VjMw4TLFHWh
eX18QFKEoyCiwSgKKANn6/wCAAD//wMA+sxjy0wFAAA=
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8ce7e3b79fe315d2-SJC
- 8ce7f0a35fe87aec-SJC
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Sun, 06 Oct 2024 18:59:38 GMT
- Sun, 06 Oct 2024 19:08:26 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=1Ai9wi4d_U4VyaDknfgrKKBjL8HT8vKgySPOOD6x37s-1728241178-1.0.1.1-dh0bmPA23NpURxzsso40KHCtptDuOXdHT1NPDYhgU9LkpNx5UH..FZ7e7sYGxWy2TWvgCDmU2CD5iotMowSk5w;
path=/; expires=Sun, 06-Oct-24 19:29:38 GMT; domain=.api.openai.com; HttpOnly;
- __cf_bm=GjY6L5nQVhy3qyvZZh45To4HjtfEIOeYLpEnW99Zlk4-1728241706-1.0.1.1-MTMnx30mHdItVeNoUzyz9eoesXBXEOjAaXLa3pfM_ncPITfCy4WbtY0UVVBCfl_E9Y5bbJwdXDOOOKUpw26lCQ;
path=/; expires=Sun, 06-Oct-24 19:38:26 GMT; domain=.api.openai.com; HttpOnly;
Secure; SameSite=None
- _cfuvid=tn5dmIzHFNrWu1jGIKrFFBRKCue6hrGJvxs.r0za8OY-1728241178251-0.0.1.1-604800000;
- _cfuvid=jOA7ZRL_JEhDd8CEGmU63H.GjAiFmWqDSqWbYnpD8o8-1728241706662-0.0.1.1-604800000;
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
Transfer-Encoding:
- chunked
Expand All @@ -95,7 +95,7 @@ interactions:
openai-organization:
- future-house-xr4tdh
openai-processing-ms:
- "1815"
- "986"
openai-version:
- "2020-10-01"
strict-transport-security:
Expand All @@ -105,15 +105,15 @@ interactions:
x-ratelimit-limit-tokens:
- "150000000"
x-ratelimit-remaining-requests:
- "29999"
- "29998"
x-ratelimit-remaining-tokens:
- "149999953"
x-ratelimit-reset-requests:
- 2ms
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_3ba11ee5acbd7d3c479200be31f85e3c
- req_1eac805d0dca14253c04482d805bb3ff
status:
code: 200
message: OK
Expand Down Expand Up @@ -171,29 +171,29 @@ interactions:
response:
body:
string: !!binary |
H4sIAAAAAAAAAwAAAP//xFTbjpswEH3nKyw/hwpYUtK8tUnTrLbVNpt2o023QsYM4NQXik0uG+Xf
K8gFkq3avqzKA7LncM7MMZ7ZWghhFuM+wjQjhoqc229HEw4jOV6I2QPpep9TQ9fiC9+Msrmzwp2K
oaIFUHNkvaJK5BwMU3IP0wKIgUrVDbye57tu0KsBoWLgFS3Nje0rWzDJbM/xfNsJbLd3YGeKUdC4
j75ZCCG0rd9VnTKGNe4jp3OMCNCapID7p48QwoXiVQQTrZk2RBrcaUCqpAFZlS5LzluAUYqHlHDe
JN4/29a6OSzCeRjkmbeYEzqYrO7GZTAdDsfT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P//AwCOLBC9UAUAAA==
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8ce7e3c45c9415d2-SJC
- 8ce7f0aae8c07aec-SJC
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Sun, 06 Oct 2024 18:59:39 GMT
- Sun, 06 Oct 2024 19:08:27 GMT
Server:
- cloudflare
Transfer-Encoding:
Expand All @@ -207,7 +207,7 @@ interactions:
openai-organization:
- future-house-xr4tdh
openai-processing-ms:
- "676"
- "786"
openai-version:
- "2020-10-01"
strict-transport-security:
Expand All @@ -225,7 +225,7 @@ interactions:
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_3fed4b217a451baa00a1e664b44c8a07
- req_78ba7fd6f2381afcca42b8ed1e88e153
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,36 @@ interactions:
response:
body:
string: !!binary |
H4sIAAAAAAAAAwAAAP//tFNNb5wwFLzzK6x3hgoozW64raJEW6lquv1U2lTImAc4NbZrm222q/3v
FbABssmhl3BAxsPMvLHf23uEAC8gJcBq6lijRbC62gimo+XH99vkevf9y7X6VtSf2qvfYXkRgt8x
VH6HzD2wXjHVaIGOKznAzCB12KlGi3gZJ1G0OOuBRhUoOlqlXZCooOGSB3EYJ0G4CKLlkV0rztBC
Sn54hBCy799dnbLAe0hJ6D/sNGgtrRDS8SdCwCjR7QC1lltHpQN/ApmSDmVXumyFmAFOKZExKsRk
PDz72Xo6LCpE1q5v7jZsE+ZvL2+q+1UuTb29fPf1w8xvkN7pvqCylWw8pBk+7qcnZoSApE3PbdQW
M4Gly2oqixMFQoCaqm1Quq562N9C0UdneNtdQhge4BHhMPs6+P8Vdr1e/WlzunrDzp38y+MLq85f
b9efXyys4VX9AmnH9c/Z5RssW0vFsSu8k4MBoSptVG5PugZKLrmtM4PU9oHAOqUH786nd4D2UYeC
NqrRLnPqF8pOMEriQQ+mKZrQJDmCTjkqZqzlmf+MXlago7xv4XFqGGU1FhM19Gbhnpo+JzEE5LJ6
ouIdlcDurMMmK7ms0GjD+xGDUmeLJKfJIk8oA+/g/QMAAP//AwAhjLt5cAQAAA==
H4sIAAAAAAAAA8RUXW/TMBR9z6+w7nOD0pAtW9+GWoqgDDaotsJQ5NpO4s1fjZ22o+p/R0m6Ju0Q
8DKRh8i5x/ecexzfu/EQAk5hgIDk2BFphH/x9qo8z8iH02x2Jd+Q01U45cHFp+HH+8VkBL0qQ8/v
GXFPWa+IlkYwx7VqYFIw7FjF2o/DszDqx8FJDUhNmajSMuP8SPuSK+6HQRj5Qez3z3bZueaEWRig
7x5CCG3qd1WnomwNAxT0niKSWYszBoP9JoSg0KKKALaWW4eVg14LEq0cU1XpqhSiAzitRUKwEK1w
82w66/awsBDJ+CuZL3GAR59vKF+Zm3fnExqvZ1lHr6F+NHVBaanI/pA6+D4+OBJDCBSWda7US5YI
lrokx4oeMSAEuMhKyZSrqofNHdDaOmF31U8ItnCwf9v52vb+yeso+nkr348W9lrq+Mswu7wcGpra
hxfzWvAs/19mb/GMpuOpXL2OJV0EajwdT9bX428vYdZKLliCFU1WeMn+5vVP3vbrH51rXbC0tFjs
7rt3dAwgdGYKPbdH/QApV9zmScGwrcsH67RptCudWgHKg94DU2hpXOL0A1MVYT8KGz5o50OLnpzt
QKcdFm08DHbtfciXUOYwr5tzPw8IJjmjbWrgdcw9F/0dRWOQq+wZi7djAvtoHZNJylXGClPwenhA
apI4muMonkeYgLf1fgEAAP//AwCjYIYGSgUAAA==
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8ce7e3b7885f96c5-SJC
- 8ce7f0a34ad367d3-SJC
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Sun, 06 Oct 2024 18:59:37 GMT
- Sun, 06 Oct 2024 19:08:26 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=HFn57_VQxpb2gMCkqIoLHi4dyiljNgxG8rc_6L_UuD0-1728241177-1.0.1.1-NdZetfWhoyqhqHHeJN5KdtJ4HYOVbibh81wE2O0Nwh30.OqqmxATDvh0VyhDyb8wYgC1tYdy7Uaasdv1W9X8xQ;
path=/; expires=Sun, 06-Oct-24 19:29:37 GMT; domain=.api.openai.com; HttpOnly;
- __cf_bm=Zj1HVlPzat2txEggSKv99KKn5dwTWg9NQSr18rVrk8I-1728241706-1.0.1.1-AwshqRQbghRTXm3UL2YId3qnltG.SLRLq5JGlPOgR7owudX2KQ0QNxWkjPBdnY3Gdq.j44APyStWSDZvLqCIoQ;
path=/; expires=Sun, 06-Oct-24 19:38:26 GMT; domain=.api.openai.com; HttpOnly;
Secure; SameSite=None
- _cfuvid=6dmGt.cJRQMle0M8SdXudRfpnZEOMYUVNHEPcYhZc64-1728241177669-0.0.1.1-604800000;
- _cfuvid=QJOgwn5rGdhwCIc.2DrTgvFTwX0u6diPhN5jfZm22_w-1728241706388-0.0.1.1-604800000;
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
Transfer-Encoding:
- chunked
Expand All @@ -94,7 +95,7 @@ interactions:
openai-organization:
- future-house-xr4tdh
openai-processing-ms:
- "1238"
- "706"
openai-version:
- "2020-10-01"
strict-transport-security:
Expand All @@ -112,7 +113,7 @@ interactions:
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_c1a8805a094a36b8dbdce38d5f02e1ed
- req_141a77ae216e3dcfeecdba5419734c30
status:
code: 200
message: OK
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def fixture_dummy_env() -> DummyEnv:

OPENAI_API_KEY_HEADER = "authorization"
ANTHROPIC_API_KEY_HEADER = "x-api-key"
# SEE: https://github.com/kevin1024/vcrpy/blob/v6.0.1/vcr/config.py#L43
VCR_DEFAULT_MATCH_ON = "method", "scheme", "host", "port", "path", "query"


@pytest.fixture(scope="session", name="vcr_config")
Expand Down
3 changes: 2 additions & 1 deletion tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ToolSelectorLedger,
)
from tests import CILLMModelNames
from tests.conftest import VCR_DEFAULT_MATCH_ON


class TestDummyEnv:
Expand Down Expand Up @@ -328,7 +329,7 @@ async def test_exec_tool_calls_handling(self, model_name: str) -> None:
assert isinstance(failure_tool_response, ToolResponseMessage)
assert env.RIGHT_HAND_BROKEN_MESSAGE in failure_tool_response.content

@pytest.mark.vcr
@pytest.mark.vcr(match_on=[*VCR_DEFAULT_MATCH_ON, "body"])
@pytest.mark.parametrize("model_name", [CILLMModelNames.OPENAI.value])
@pytest.mark.asyncio
async def test_tool_selector_from_model_name(
Expand Down

0 comments on commit 3f2158b

Please sign in to comment.