Skip to content

Commit

Permalink
Merge pull request #400 from NVIDIA/fix/autorization-header-leak-for-…
Browse files Browse the repository at this point in the history
…nemollm

Fix Authorization header leak for NeMo LLM.
  • Loading branch information
drazvan authored Mar 13, 2024
2 parents 89a5007 + 1138710 commit 28f59c5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions nemoguardrails/llm/providers/nemollm.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ def _generate(
generations=generations,
llm_output={
"url": self._get_request_url(),
"headers": self._get_request_headers(),
"headers": {
k: v
for k, v in self._get_request_headers().items()
# We make sure the Authorization header is not returned as this
# can lean the authorization key.
if k != "Authorization"
},
"model_name": self.model,
},
)
Expand Down Expand Up @@ -293,7 +299,13 @@ async def _agenerate(
generations=generations,
llm_output={
"url": self._get_request_url(),
"headers": self._get_request_headers(),
"headers": {
k: v
for k, v in self._get_request_headers().items()
# We make sure the Authorization header is not returned as this
# can lean the authorization key.
if k != "Authorization"
},
"model_name": self.model,
},
)

0 comments on commit 28f59c5

Please sign in to comment.