forked from phoenix/litellm-mirror
fix /v1/batches POST
This commit is contained in:
parent
c0717133a9
commit
159a880dcc
1 changed files with 22 additions and 6 deletions
|
@ -4808,10 +4808,18 @@ async def create_batch(
|
||||||
"""
|
"""
|
||||||
global proxy_logging_obj
|
global proxy_logging_obj
|
||||||
data: Dict = {}
|
data: Dict = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Use orjson to parse JSON data, orjson speeds up requests significantly
|
body = await request.body()
|
||||||
form_data = await request.form()
|
body_str = body.decode()
|
||||||
data = {key: value for key, value in form_data.items() if key != "file"}
|
try:
|
||||||
|
data = ast.literal_eval(body_str)
|
||||||
|
except:
|
||||||
|
data = json.loads(body_str)
|
||||||
|
|
||||||
|
verbose_proxy_logger.debug(
|
||||||
|
"Request received by LiteLLM:\n{}".format(json.dumps(data, indent=4)),
|
||||||
|
)
|
||||||
|
|
||||||
# Include original request and headers in the data
|
# Include original request and headers in the data
|
||||||
data = await add_litellm_data_to_request(
|
data = await add_litellm_data_to_request(
|
||||||
|
@ -4915,10 +4923,18 @@ async def retrieve_batch(
|
||||||
"""
|
"""
|
||||||
global proxy_logging_obj
|
global proxy_logging_obj
|
||||||
data: Dict = {}
|
data: Dict = {}
|
||||||
|
data = {}
|
||||||
try:
|
try:
|
||||||
# Use orjson to parse JSON data, orjson speeds up requests significantly
|
body = await request.body()
|
||||||
form_data = await request.form()
|
body_str = body.decode()
|
||||||
data = {key: value for key, value in form_data.items() if key != "file"}
|
try:
|
||||||
|
data = ast.literal_eval(body_str)
|
||||||
|
except:
|
||||||
|
data = json.loads(body_str)
|
||||||
|
|
||||||
|
verbose_proxy_logger.debug(
|
||||||
|
"Request received by LiteLLM:\n{}".format(json.dumps(data, indent=4)),
|
||||||
|
)
|
||||||
|
|
||||||
# Include original request and headers in the data
|
# Include original request and headers in the data
|
||||||
data = await add_litellm_data_to_request(
|
data = await add_litellm_data_to_request(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue