Vertical.ai / backend /scripts /verify_manual_request.py
Abhisingh-18's picture
Mirror of github.com/Abhisingh18/Vertical.ai
1f7ead8 verified
Raw
History Blame Contribute Delete
1.06 kB
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()