-
Notifications
You must be signed in to change notification settings - Fork 19
fix: Make base_url handling consistent across all functions #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Make base_url handling consistent across all functions #427
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
Add "(aside)" to your comment to have me ignore it. |
| lb7OIbyQkMNb/1X/+jSA0GPOEnWXk5wtxWunQXV5p5u/ANXWr5Fge0catsJrHC1hKrx/ef6v3lfB | ||
| iLsQDjRukLDp7T/5d8oOLj2c9oO39YcMactvsP2e+myuW8+Fp7YM8DHkF4+iIn9Lm76n2t6s9Ymc | ||
| biG89x8ZCeaHrZbPWljypn/+9JPXc3MuYX5CLjW/0dHrDn2SgL9/pwL+819//fW/ficMmvb+qLeD | ||
| AeNjHv/930cF/p3e039zHP/nGAIZ0uLx9z//dQLh72/fNt/xf4/t+/EZ/v7nL/7PUYO/x3ZM6//n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some sensitive data is present here,
can you change inside conftest.py the vcr config to
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [
("cookie", "test_cookie"),
("authorization", "Bearer test_openai_api_key"),
("openai-organization", "test_openai_org_id"),
("openai-project", "test_openai_project_id"),
],
"decode_compressed_response": True,
"before_record_response": scrub_response_headers,
}
def scrub_response_headers(response):
"""
This scrubs sensitive response headers. Note they are case-sensitive!
"""
response["headers"]["openai-organization"] = "test_openai_org_id"
response["headers"]["Set-Cookie"] = "test_set_cookie"
return response
alizenhom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kindly adjust the test recording to not leak any sensitive data
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def vcr_config(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the vcr_config method to
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [
("cookie", "test_cookie"),
("authorization", "Bearer test_openai_api_key"),
("openai-organization", "test_openai_org_id"),
("openai-project", "test_openai_project_id"),
],
"decode_compressed_response": True,
"before_record_response": scrub_response_headers,
}
and scrub_response_headers is
def scrub_response_headers(response):
"""
This scrubs sensitive response headers. Note they are case-sensitive!
"""
response["headers"]["openai-organization"] = "test_openai_org_id"
response["headers"]["Set-Cookie"] = "test_set_cookie"
return response
28c372a to
d8a48f0
Compare
Fixed inconsistent base_url handling in openai patch.py:
Changes have been tested and verified working with both OpenAI and Azure providers.
Link to Devin run: https://preview.devin.ai/devin/c6cc20c608ec49afaca906f05d2eab41