File size: 1,064 Bytes
1f7ead8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import requests
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
from backend.app.config import config
def verify_manual():
print("Verifying via Raw Requests...")
API_URL = f"https://router.huggingface.co/models/{config.LLM_MODEL}"
headers = {"Authorization": f"Bearer {config.HUGGINGFACE_API_KEY}"}
prompt = "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHi<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
payload = {
"inputs": prompt,
"parameters": {
"max_new_tokens": 50,
"temperature": 0.7,
"top_p": 0.9,
"return_full_text": False
}
}
try:
response = requests.post(API_URL, headers=headers, json=payload)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.text}")
except Exception as e:
print(f"Exception: {e}")
if __name__ == "__main__":
verify_manual()
|