Files
wehub-resource-sync 85742ab165
CPU Test / Lint - next (push) Waiting to run
Dashboard / Chromatic (push) Waiting to run
CPU Test / Lint - fast (push) Waiting to run
CPU Test / Build documentation (push) Waiting to run
CPU Test / Test (Store, legacy, Python 3.10) (push) Waiting to run
CPU Test / Test (Utilities, legacy, Python 3.10) (push) Waiting to run
CPU Test / Test (Weave, legacy, Python 3.10) (push) Waiting to run
CPU Test / Test (AgentOps, stable, Python 3.11) (push) Waiting to run
CPU Test / Test (LLM proxy, stable, Python 3.11) (push) Waiting to run
CPU Test / Test (Others, stable, Python 3.11) (push) Waiting to run
CPU Test / Test (Store, stable, Python 3.11) (push) Waiting to run
CPU Test / Test (Utilities, stable, Python 3.11) (push) Waiting to run
CPU Test / Test (Weave, stable, Python 3.11) (push) Waiting to run
CPU Test / Test (AgentOps, stable, Python 3.12) (push) Waiting to run
CPU Test / Test (LLM proxy, stable, Python 3.12) (push) Waiting to run
CPU Test / Test (Others, stable, Python 3.12) (push) Waiting to run
CPU Test / Test (Store, stable, Python 3.12) (push) Waiting to run
CPU Test / Test (Utilities, stable, Python 3.12) (push) Waiting to run
CPU Test / Test (Weave, stable, Python 3.12) (push) Waiting to run
CPU Test / Test (AgentOps, latest, Python 3.13) (push) Waiting to run
CPU Test / Test (LLM proxy, latest, Python 3.13) (push) Waiting to run
CPU Test / Test (Others, latest, Python 3.13) (push) Waiting to run
CPU Test / Test (Store, latest, Python 3.13) (push) Waiting to run
CPU Test / Lint - slow (push) Waiting to run
CPU Test / Lint - JavaScript (push) Waiting to run
CPU Test / Test (AgentOps, legacy, Python 3.10) (push) Waiting to run
CPU Test / Test (LLM proxy, legacy, Python 3.10) (push) Waiting to run
CPU Test / Test (Others, legacy, Python 3.10) (push) Waiting to run
CPU Test / Test (Utilities, latest, Python 3.13) (push) Waiting to run
CPU Test / Test (Weave, latest, Python 3.13) (push) Waiting to run
CPU Test / Test (JavaScript) (push) Waiting to run
Deploy Documentation / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:44:17 +08:00

56 lines
1.5 KiB
Python

# Copyright (c) Microsoft. All rights reserved.
"""Utility script to perform a sanity check on LiteLLM proxy server."""
import sys
import openai
def main() -> None:
client = openai.OpenAI(timeout=30.0)
models = client.models.list()
print("Available models:", models)
total_requests = 0
success_count = 0
for model in models.data:
try:
total_requests += 1
response = client.chat.completions.create(
model=model.id,
messages=[{"role": "user", "content": "Hello!"}],
)
print(f"Chat completion from model {model.id}:", response)
success_count += 1
except Exception as e:
print(f"Chat completion failed for model {model.id}: {e}")
try:
total_requests += 1
response = client.responses.create(
model=model.id,
input="Hello, world!",
)
print(f"Response from model {model.id}:", response)
success_count += 1
except Exception as e:
print(f"Response failed for model {model.id}: {e}")
if total_requests == 0:
print("No requests made.")
sys.exit(1)
success_rate = success_count / total_requests
print(f"Success rate: {success_rate * 100:.2f}% ({success_count}/{total_requests})")
if success_rate >= 0.8:
sys.exit(0)
else:
sys.exit(1)
if __name__ == "__main__":
main()