nbroad HF staff commited on
Commit
448bd5e
1 Parent(s): ce5070a

add randomness to query

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,5 +1,7 @@
1
  import os
2
  import json
 
 
3
  from datetime import datetime
4
  from typing import List, Dict
5
 
@@ -44,12 +46,18 @@ class LogEntry(BaseModel):
44
  timestamp: str
45
  failure_message: str
46
 
 
 
 
 
 
 
47
  async def check_apis():
48
  results = []
49
  for model in models:
50
  try:
51
  response = await client.chat_completion(
52
- messages=[{"role": "user", "content": "What is the capital of France?"}],
53
  max_tokens=10,
54
  )
55
  success = True
 
1
  import os
2
  import json
3
+ import random
4
+ import string
5
  from datetime import datetime
6
  from typing import List, Dict
7
 
 
46
  timestamp: str
47
  failure_message: str
48
 
49
+
50
+
51
+ def random_string(length=10):
52
+ characters = string.ascii_letters + string.digits
53
+ return ''.join(random.choice(characters) for _ in range(length))
54
+
55
  async def check_apis():
56
  results = []
57
  for model in models:
58
  try:
59
  response = await client.chat_completion(
60
+ messages=[{"role": "user", "content": f"{random_string()}\nWhat is the capital of France?"}],
61
  max_tokens=10,
62
  )
63
  success = True