forked from phoenix/litellm-mirror
test: testing fixes
This commit is contained in:
parent
a301d8aa4b
commit
bbb5bd19e8
2 changed files with 12 additions and 3 deletions
|
@ -1266,9 +1266,7 @@ async def test_user_api_key_auth(prisma_client):
|
||||||
pytest.fail(f"This should have failed!. IT's an invalid key")
|
pytest.fail(f"This should have failed!. IT's an invalid key")
|
||||||
except ProxyException as exc:
|
except ProxyException as exc:
|
||||||
print(exc.message)
|
print(exc.message)
|
||||||
assert (
|
assert exc.message == "Authentication Error, No api key passed in."
|
||||||
exc.message == "Authentication Error, No API Key passed in. api_key is None"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Test case: Malformed API Key (missing 'Bearer ' prefix)
|
# Test case: Malformed API Key (missing 'Bearer ' prefix)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -8072,6 +8072,17 @@ class CustomStreamWrapper:
|
||||||
if self.sent_first_chunk == False:
|
if self.sent_first_chunk == False:
|
||||||
model_response.choices[0].delta["role"] = "assistant"
|
model_response.choices[0].delta["role"] = "assistant"
|
||||||
self.sent_first_chunk = True
|
self.sent_first_chunk = True
|
||||||
|
elif self.sent_first_chunk == True and hasattr(
|
||||||
|
model_response.choices[0].delta, "role"
|
||||||
|
):
|
||||||
|
_initial_delta = model_response.choices[
|
||||||
|
0
|
||||||
|
].delta.model_dump()
|
||||||
|
_initial_delta.pop("role", None)
|
||||||
|
model_response.choices[0].delta = Delta(**_initial_delta)
|
||||||
|
print_verbose(
|
||||||
|
f"model_response.choices[0].delta: {model_response.choices[0].delta}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
## else
|
## else
|
||||||
completion_obj["content"] = model_response_str
|
completion_obj["content"] = model_response_str
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue