Merge pull request #2175 from BerriAI/litellm_stricter_function_calling_streaming_tests

fix(utils.py): stricter azure function calling tests
This commit is contained in:
Krish Dholakia 2024-02-23 22:58:07 -08:00 committed by GitHub
commit a83bc2fd1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 262 additions and 33 deletions

View file

@ -376,11 +376,9 @@ class StreamingChoices(OpenAIObject):
self.delta = delta
else:
self.delta = Delta()
if logprobs is not None:
self.logprobs = logprobs
if enhancements is not None:
self.enhancements = enhancements
self.logprobs = logprobs
def __contains__(self, key):
# Define custom behavior for the 'in' operator
@ -8631,6 +8629,10 @@ class CustomStreamWrapper:
model_response.choices[0].finish_reason = response_obj[
"finish_reason"
]
if response_obj.get("original_chunk", None) is not None:
model_response.system_fingerprint = getattr(
response_obj["original_chunk"], "system_fingerprint", None
)
if response_obj["logprobs"] is not None:
model_response.choices[0].logprobs = response_obj["logprobs"]