mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
test: fix proxy custom logger test
This commit is contained in:
parent
91ce50338a
commit
4c0e95aec9
1 changed files with 8 additions and 2 deletions
|
@ -37,6 +37,12 @@ def client():
|
|||
with TestClient(app) as client:
|
||||
yield client
|
||||
|
||||
# Your bearer token
|
||||
token = os.getenv("PROXY_MASTER_KEY")
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {token}"
|
||||
}
|
||||
|
||||
|
||||
def test_chat_completion(client):
|
||||
|
@ -62,7 +68,7 @@ def test_chat_completion(client):
|
|||
}
|
||||
|
||||
|
||||
response = client.post("/chat/completions", json=test_data)
|
||||
response = client.post("/chat/completions", json=test_data, headers=headers)
|
||||
print("made request", response.status_code, response.text)
|
||||
assert my_custom_logger.async_success == True # checks if the status of async_success is True, only the async_log_success_event can set this to true
|
||||
assert my_custom_logger.async_completion_kwargs["model"] == "chatgpt-v-2" # checks if kwargs passed to async_log_success_event are correct
|
||||
|
@ -89,7 +95,7 @@ def test_embedding(client):
|
|||
"model": "azure-embedding-model",
|
||||
"input": ["hello"]
|
||||
}
|
||||
response = client.post("/embeddings", json=test_data)
|
||||
response = client.post("/embeddings", json=test_data, headers=headers)
|
||||
print("made request", response.status_code, response.text)
|
||||
assert my_custom_logger.async_success_embedding == True # checks if the status of async_success is True, only the async_log_success_event can set this to true
|
||||
assert my_custom_logger.async_embedding_kwargs["model"] == "azure-embedding-model" # checks if kwargs passed to async_log_success_event are correct
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue