mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(test) azure/embedding + completion_cost
This commit is contained in:
parent
f681f0f2b2
commit
72e7178c9b
1 changed files with 33 additions and 0 deletions
|
@ -125,3 +125,36 @@ def test_cost_azure_gpt_35():
|
|||
|
||||
|
||||
test_cost_azure_gpt_35()
|
||||
|
||||
|
||||
def test_cost_azure_embedding():
|
||||
try:
|
||||
import asyncio
|
||||
|
||||
litellm.set_verbose = True
|
||||
|
||||
async def _test():
|
||||
response = await litellm.aembedding(
|
||||
model="azure/azure-embedding-model",
|
||||
input=["good morning from litellm", "gm"],
|
||||
)
|
||||
|
||||
print(response)
|
||||
|
||||
return response
|
||||
|
||||
response = asyncio.run(_test())
|
||||
|
||||
cost = litellm.completion_cost(completion_response=response)
|
||||
|
||||
print("Cost", cost)
|
||||
expected_cost = float("7e-07")
|
||||
assert cost == expected_cost
|
||||
|
||||
except Exception as e:
|
||||
pytest.fail(
|
||||
f"Cost Calc failed for azure/gpt-3.5-turbo. Expected {expected_cost}, Calculated cost {cost}"
|
||||
)
|
||||
|
||||
|
||||
# test_cost_azure_embedding()
|
Loading…
Add table
Add a link
Reference in a new issue