22 lines
757 B
Python
22 lines
757 B
Python
"""
|
|
This file is used by the worker that processes requests.
|
|
"""
|
|
import traceback
|
|
|
|
import requests
|
|
|
|
from llm_server.config.global_config import GlobalConfig
|
|
|
|
|
|
# def generate(json_data: dict):
|
|
# try:
|
|
# r = requests.post(f'{GlobalConfig.get().backend_url}/api/v1/generate', json=json_data, verify=GlobalConfig.get().verify_ssl, timeout=GlobalConfig.get().backend_generate_request_timeout)
|
|
# except requests.exceptions.ReadTimeout:
|
|
# return False, None, 'Request to backend timed out'
|
|
# except Exception as e:
|
|
# traceback.print_exc()
|
|
# return False, None, 'Request to backend encountered error'
|
|
# if r.status_code != 200:
|
|
# return False, r, f'Backend returned {r.status_code}'
|
|
# return True, r, None
|