@@ -277,7 +277,7 @@ def StringToChatHandler(
277277 UseGPU : bool ,
278278 ImageTokens : tuple [int , int ],
279279 Verbose : bool
280- ) -> CH_Llava15 | CH_Llava16 | CH_Llama3VisionAlpha | CH_MiniCPMv26 | CH_Moondream | CH_NanoLlava | CH_Qwen25VL | None :
280+ ) -> CH_Llava15 | None :
281281 """
282282 Converts a string (chat handler name) into a class.
283283
@@ -288,7 +288,7 @@ def StringToChatHandler(
288288 ImageTokens (tuple[int, int]): Min and max image tokens.
289289
290290 Returns:
291- CH_Llava15 | CH_Llava16 | CH_Llama3VisionAlpha | CH_MiniCPMv26 | CH_Moondream | CH_NanoLlava | CH_Qwen25VL | CH_Qwen3VL | None
291+ CH_Llava15 | None
292292 """
293293 # Lower the chat handler name
294294 chatHandler = ChatHandler .lower ()
@@ -727,132 +727,6 @@ def LoadLlamaModel(Configuration: dict[str, Any]) -> dict[str, Llama | Any]:
727727 cacheType = None
728728 logs .WriteLog (logs .INFO , "[llama_utils] `_private_cache_type` not defined. Set to None." )
729729
730- # Set reasoning configuration
731- if ("reasoning" in Configuration ):
732- reasoningConfiguration = Configuration ["reasoning" ]
733- autoReasoningClassifier = None # Requires the `text-classification` service
734- autoReasoningConvert = {} # {"classifier_output": "level_name", "default": "level_name"}
735- reasoningLevels = []
736- reasoningDefaultMode = "auto"
737- nonReasoningLevel = None
738- defaultReasoningLevel = None
739- reasoningStartToken = "<think>"
740- reasoningEndToken = "</think>"
741- reasoningParameters = {}
742- reasoningUserPrompt = {"position" : "end" , "separator" : " " , "levels" : []}
743- reasoningSystemPrompt = {"position" : "end" , "separator" : " " , "levels" : []}
744-
745- if ("levels" in reasoningConfiguration ):
746- reasoningLevels = reasoningConfiguration ["levels" ]
747-
748- if ("_private_auto" in reasoningConfiguration ):
749- if ("classifier" in reasoningConfiguration ["_private_auto" ]):
750- autoReasoningClassifier = reasoningConfiguration ["_private_auto" ]["classifier" ]
751-
752- if ("convert" in reasoningConfiguration ["_private_auto" ]):
753- autoReasoningConvert = reasoningConfiguration ["_private_auto" ]["convert" ]
754-
755- if ("default_mode" in reasoningConfiguration ):
756- defaultMode = reasoningConfiguration ["default_mode" ]
757-
758- if (defaultMode != "reasoning" and defaultMode != "nonreasoning" and defaultMode != "auto" ):
759- logs .PrintLog (logs .WARNING , "[llama_utils] Default reasoning mode is expected to be `reasoning`, `nonreasoning`, or `auto`. Setting to default." )
760- defaultMode = "auto"
761-
762- if ("non_reasoning_level" in reasoningConfiguration ):
763- nonReasoningLevel = reasoningConfiguration ["non_reasoning_level" ]
764-
765- if ("default_reasoning_level" in reasoningConfiguration ):
766- defaultReasoningLevel = reasoningConfiguration ["default_reasoning_level" ]
767-
768- if (nonReasoningLevel not in reasoningLevels ):
769- raise ValueError (f"Non-reasoning level `{ nonReasoningLevel } ` not in the levels list `{ reasoningLevels } `." )
770-
771- if (defaultReasoningLevel not in reasoningLevels ):
772- raise ValueError (f"Reasoning level `{ defaultReasoningLevel } ` not in the levels list `{ reasoningLevels } `." )
773-
774- if ("start_token" in reasoningConfiguration ):
775- reasoningStartToken = reasoningConfiguration ["start_token" ]
776- else :
777- logs .WriteLog (logs .INFO , f"[llama_utils] Reasoning start token not detected in config. Using default `{ reasoningStartToken } `." )
778-
779- if ("end_token" in reasoningConfiguration ):
780- reasoningStartToken = reasoningConfiguration ["end_token" ]
781- else :
782- logs .WriteLog (logs .INFO , f"[llama_utils] Reasoning end token not detected in config. Using default `{ reasoningEndToken } `." )
783-
784- if ("_private_parameters" in reasoningConfiguration ):
785- reasoningParameters = reasoningConfiguration ["_private_parameters" ]
786-
787- if ("_private_user_prompt" in reasoningConfiguration ):
788- if ("position" in reasoningConfiguration ["_private_user_prompt" ]):
789- reasoningUserPrompt ["position" ] = reasoningConfiguration ["_private_user_prompt" ]["position" ]
790- else :
791- logs .PrintLog (logs .INFO , f"[llama_utils] Position not set at user prompt (reasoning). Using default `{ reasoningUserPrompt ['position' ]} `." )
792-
793- if ("separator" in reasoningConfiguration ["_private_user_prompt" ]):
794- reasoningUserPrompt ["separator" ] = reasoningConfiguration ["_private_user_prompt" ]["separator" ]
795- else :
796- logs .PrintLog (logs .INFO , f"[llama_utils] Separator not set at user prompt (reasoning). Using default `{ reasoningUserPrompt ['separator' ]} `." )
797-
798- if ("levels" in reasoningConfiguration ["_private_user_prompt" ]):
799- reasoningUserPrompt ["levels" ] = reasoningConfiguration ["_private_user_prompt" ]["levels" ]
800-
801- if ("_private_system_prompt" in reasoningConfiguration ):
802- if ("position" in reasoningConfiguration ["_private_system_prompt" ]):
803- reasoningSystemPrompt ["position" ] = reasoningConfiguration ["_private_system_prompt" ]["position" ]
804- else :
805- logs .PrintLog (logs .INFO , f"[llama_utils] Position not set at system prompt (reasoning). Using default `{ reasoningSystemPrompt ['position' ]} `." )
806-
807- if ("separator" in reasoningConfiguration ["_private_system_prompt" ]):
808- reasoningSystemPrompt ["separator" ] = reasoningConfiguration ["_private_system_prompt" ]["separator" ]
809- else :
810- logs .PrintLog (logs .INFO , f"[llama_utils] Separator not set at system prompt (reasoning). Using default `{ reasoningSystemPrompt ['separator' ]} `." )
811-
812- if ("levels" in reasoningConfiguration ["_private_system_prompt" ]):
813- reasoningSystemPrompt ["levels" ] = reasoningConfiguration ["_private_system_prompt" ]["levels" ]
814-
815- reasoning = {
816- "auto" : {
817- "classifier" : autoReasoningClassifier ,
818- "convert" : autoReasoningConvert
819- },
820- "levels" : reasoningLevels ,
821- "default_mode" : reasoningDefaultMode ,
822- "non_reasoning_level" : nonReasoningLevel ,
823- "default_reasoning_level" : defaultReasoningLevel ,
824- "start_token" : reasoningStartToken ,
825- "end_token" : reasoningEndToken ,
826- "parameters" : reasoningParameters ,
827- "user_prompt" : reasoningUserPrompt ,
828- "system_prompt" : reasoningSystemPrompt
829- }
830- else :
831- reasoning = {
832- "auto" : {
833- "classifier" : None ,
834- "convert" : {}
835- },
836- "levels" : ["no_reasoning" ],
837- "default_mode" : "nonreasoning" ,
838- "non_reasoning_level" : "no_reasoning" ,
839- "default_reasoning_level" : "no_reasoning" ,
840- "start_token" : "<think>" ,
841- "end_token" : "</think>" ,
842- "parameters" : {},
843- "user_prompt" : {
844- "position" : "end" ,
845- "separator" : " " ,
846- "levels" : {}
847- },
848- "system_prompt" : {
849- "position" : "end" ,
850- "separator" : " " ,
851- "levels" : {}
852- }
853- }
854- logs .WriteLog (logs .INFO , f"[llama_utils] `reasoning` not defined. Set to default mode; { reasoning } ." )
855-
856730 # Set multimodal type
857731 if ("multimodal" in Configuration ):
858732 multimodal = Configuration ["multimodal" ]
@@ -926,6 +800,5 @@ def LoadLlamaModel(Configuration: dict[str, Any]) -> dict[str, Llama | Any]:
926800 logs .WriteLog (logs .INFO , f"[llama_utils] Model loaded in { loadingTime } seconds." )
927801 return {
928802 "_private_model" : model ,
929- "_private_type" : "lcpp" ,
930- "reasoning" : reasoning
803+ "_private_type" : "lcpp"
931804 }
0 commit comments