forked from phoenix/litellm-mirror
fix(cost_calculator.py): fix time import
This commit is contained in:
parent
af2917d655
commit
df753a8ab2
2 changed files with 22 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
# What is this?
|
# What is this?
|
||||||
## File for 'response_cost' calculation in Logging
|
## File for 'response_cost' calculation in Logging
|
||||||
|
import time
|
||||||
from typing import List, Literal, Optional, Tuple, Union
|
from typing import List, Literal, Optional, Tuple, Union
|
||||||
|
|
||||||
import litellm
|
import litellm
|
||||||
|
|
|
@ -1,22 +1,34 @@
|
||||||
import sys, os
|
import os
|
||||||
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
import os, io
|
import io
|
||||||
|
import os
|
||||||
|
|
||||||
sys.path.insert(
|
sys.path.insert(
|
||||||
0, os.path.abspath("../..")
|
0, os.path.abspath("../..")
|
||||||
) # Adds the parent directory to the system path
|
) # Adds the parent directory to the system path
|
||||||
import pytest, asyncio
|
import asyncio
|
||||||
import litellm
|
|
||||||
from litellm import embedding, completion, completion_cost, Timeout, acompletion
|
|
||||||
from litellm import RateLimitError
|
|
||||||
from litellm.tests.test_streaming import streaming_format_tests
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
import litellm
|
||||||
|
from litellm import (
|
||||||
|
RateLimitError,
|
||||||
|
Timeout,
|
||||||
|
acompletion,
|
||||||
|
completion,
|
||||||
|
completion_cost,
|
||||||
|
embedding,
|
||||||
|
)
|
||||||
from litellm.llms.vertex_ai import _gemini_convert_messages_with_history
|
from litellm.llms.vertex_ai import _gemini_convert_messages_with_history
|
||||||
|
from litellm.tests.test_streaming import streaming_format_tests
|
||||||
|
|
||||||
litellm.num_retries = 3
|
litellm.num_retries = 3
|
||||||
litellm.cache = None
|
litellm.cache = None
|
||||||
|
@ -114,7 +126,8 @@ async def test_get_response():
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
|
except litellm.RateLimitError:
|
||||||
|
pass
|
||||||
except litellm.UnprocessableEntityError as e:
|
except litellm.UnprocessableEntityError as e:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue