vikram-fresche commited on
Commit
83d943a
·
1 Parent(s): 0a3c393

added custom handler v8

Browse files
Files changed (1) hide show
  1. handler.py +2 -2
handler.py CHANGED
@@ -93,12 +93,12 @@ class EndpointHandler:
93
  output_text = self.tokenizer.batch_decode(output_tokens)[0]
94
 
95
  # Extract the assistant's response by removing the input prompt
96
- response = output_text[len(prompt):].strip()
97
  logger.info(f"Generated response length: {len(response)}")
98
  logger.info(f"Generated response: {response}")
99
 
100
  #return [{"role": "assistant", "content": response}]
101
- return response
102
 
103
  except Exception as e:
104
  logger.error(f"Error during generation: {str(e)}", exc_info=True)
 
93
  output_text = self.tokenizer.batch_decode(output_tokens)[0]
94
 
95
  # Extract the assistant's response by removing the input prompt
96
+ response = output_text#[len(prompt):].strip()
97
  logger.info(f"Generated response length: {len(response)}")
98
  logger.info(f"Generated response: {response}")
99
 
100
  #return [{"role": "assistant", "content": response}]
101
+ return [{"result": response, "error": None}]
102
 
103
  except Exception as e:
104
  logger.error(f"Error during generation: {str(e)}", exc_info=True)