mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
test(utils.py): adding logging for azure streaming
This commit is contained in:
parent
bfe1beaa6f
commit
c86be7665d
2 changed files with 4 additions and 1 deletions
|
@ -351,7 +351,7 @@ def test_completion_cohere_stream_bad_key():
|
||||||
|
|
||||||
def test_completion_azure_stream():
|
def test_completion_azure_stream():
|
||||||
try:
|
try:
|
||||||
litellm.set_verbose = True
|
litellm.set_verbose = False
|
||||||
messages = [
|
messages = [
|
||||||
{"role": "system", "content": "You are a helpful assistant."},
|
{"role": "system", "content": "You are a helpful assistant."},
|
||||||
{
|
{
|
||||||
|
|
|
@ -4458,6 +4458,7 @@ class CustomStreamWrapper:
|
||||||
|
|
||||||
def chunk_creator(self, chunk):
|
def chunk_creator(self, chunk):
|
||||||
model_response = ModelResponse(stream=True, model=self.model)
|
model_response = ModelResponse(stream=True, model=self.model)
|
||||||
|
print_verbose(f"model_response finish reason 1: {model_response.choices[0].finish_reason}")
|
||||||
try:
|
try:
|
||||||
# return this for all models
|
# return this for all models
|
||||||
completion_obj = {"content": ""}
|
completion_obj = {"content": ""}
|
||||||
|
@ -4497,6 +4498,7 @@ class CustomStreamWrapper:
|
||||||
print_verbose(f"len(completion_obj['content']: {len(completion_obj['content'])}")
|
print_verbose(f"len(completion_obj['content']: {len(completion_obj['content'])}")
|
||||||
if response_obj["is_finished"]:
|
if response_obj["is_finished"]:
|
||||||
model_response.choices[0].finish_reason = response_obj["finish_reason"]
|
model_response.choices[0].finish_reason = response_obj["finish_reason"]
|
||||||
|
print_verbose(f"model_response finish reason 2: {model_response.choices[0].finish_reason}")
|
||||||
elif self.custom_llm_provider and self.custom_llm_provider == "maritalk":
|
elif self.custom_llm_provider and self.custom_llm_provider == "maritalk":
|
||||||
response_obj = self.handle_maritalk_chunk(chunk)
|
response_obj = self.handle_maritalk_chunk(chunk)
|
||||||
completion_obj["content"] = response_obj["text"]
|
completion_obj["content"] = response_obj["text"]
|
||||||
|
@ -4601,6 +4603,7 @@ class CustomStreamWrapper:
|
||||||
|
|
||||||
model_response.model = self.model
|
model_response.model = self.model
|
||||||
print_verbose(f"model_response: {model_response}; completion_obj: {completion_obj}")
|
print_verbose(f"model_response: {model_response}; completion_obj: {completion_obj}")
|
||||||
|
print_verbose(f"model_response finish reason 3: {model_response.choices[0].finish_reason}")
|
||||||
if len(completion_obj["content"]) > 0: # cannot set content of an OpenAI Object to be an empty string
|
if len(completion_obj["content"]) > 0: # cannot set content of an OpenAI Object to be an empty string
|
||||||
hold, model_response_str = self.check_special_tokens(completion_obj["content"])
|
hold, model_response_str = self.check_special_tokens(completion_obj["content"])
|
||||||
if hold is False:
|
if hold is False:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue