Post_process_function

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

Describe the issue:

Configuration:

Relevant Logs or Screenshots:

Anyone having post processing function which can overwrite the output of inference_response.

I tried multiple things but found that post_process_function always return string output, which get’s added under DataMap.

Example,
If I use below function:

“post_process_function”: "def json = [‘{ "model": "’ + params.model + ‘",’ +\n ‘"dataAsMap": { "choices": "’ + params.message +\n ‘"}}’];\n return ‘’+json+‘’;\n \n "

then out put is:

{
“inference_results”: [
{
“output”: [
{
“name”: “response”,
“dataAsMap”: {
“response”: “”“[{ “model”: “llama3:latest”,“dataAsMap”: { “choices”: “{role=assistant, content=What a great question!..etc
}”}}]”“”
}
}
],
“status_code”: 200
}
]
}

But expecting is:

“response”: [
{ “model”: “llama3:latest”,“dataAsMap”: { “choices”: “{role=assistant, content=What a great question!..etc
}”}}
]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.