|
@@ -63,6 +63,7 @@ def apply_model_params_to_body_openai(params: dict, form_data: dict) -> dict:
|
|
|
"seed": lambda x: x,
|
|
|
"stop": lambda x: [bytes(s, "utf-8").decode("unicode_escape") for s in x],
|
|
|
"logit_bias": lambda x: x,
|
|
|
+ "response_format": dict,
|
|
|
}
|
|
|
return apply_model_params_to_body(params, form_data, mappings)
|
|
|
|
|
@@ -250,4 +251,13 @@ def convert_payload_openai_to_ollama(openai_payload: dict) -> dict:
|
|
|
if "metadata" in openai_payload:
|
|
|
ollama_payload["metadata"] = openai_payload["metadata"]
|
|
|
|
|
|
+ if "response_format" in openai_payload:
|
|
|
+ response_format = openai_payload["response_format"]
|
|
|
+ format_type = response_format.get("type", None)
|
|
|
+
|
|
|
+ schema = response_format.get(format_type, None)
|
|
|
+ if schema:
|
|
|
+ format = schema.get("schema", None)
|
|
|
+ ollama_payload["format"] = format
|
|
|
+
|
|
|
return ollama_payload
|