MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / parse

Method parse

tensorrt_llm/llmapi/reasoning_parser.py:50–62  ·  view source on GitHub ↗
(self, text: str)

Source from the content-addressed store, hash-verified

48 return reasoning_parser_result
49
50 def parse(self, text: str) -> ReasoningParserResult:
51 if not self.reasoning_at_start:
52 splits = text.partition(self.reasoning_start)
53 if splits[1] == "":
54 # no reasoning start tag found
55 return ReasoningParserResult(content=text)
56 # reasoning start tag found
57 # text before reasoning start tag is dropped
58 text = splits[2]
59 splits = text.partition(self.reasoning_end)
60 reasoning_content, content = splits[0], splits[2]
61 return ReasoningParserResult(content=content,
62 reasoning_content=reasoning_content)
63
64 def parse_delta(self, delta_text: str) -> ReasoningParserResult:
65 self._buffer += delta_text

Callers 15

merge_junit_xmlsFunction · 0.45
xml_to_htmlFunction · 0.45
filter_failed_testsFunction · 0.45
generate_trt_engineMethod · 0.45
generate_trt_engineMethod · 0.45
trt_gteFunction · 0.45
build_trt_engineFunction · 0.45
to_astMethod · 0.45
ssd_chunk_scan.pyFile · 0.45
softplus.pyFile · 0.45
check_environmentsFunction · 0.45

Calls 1

Tested by 4

merge_junit_xmlsFunction · 0.36
xml_to_htmlFunction · 0.36
filter_failed_testsFunction · 0.36