Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
60e37f80
Unverified
Commit
60e37f80
authored
Sep 02, 2025
by
Lianmin Zheng
Committed by
GitHub
Sep 02, 2025
Browse files
Move parsers under a single folder (#9912)
parent
369b1433
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
10 additions
and
10 deletions
+10
-10
python/sglang/srt/parser/reasoning_parser.py
python/sglang/srt/parser/reasoning_parser.py
+1
-1
python/sglang/srt/server_args.py
python/sglang/srt/server_args.py
+1
-1
test/lang/test_separate_reasoning_execution.py
test/lang/test_separate_reasoning_execution.py
+3
-3
test/srt/test_harmony_parser.py
test/srt/test_harmony_parser.py
+1
-1
test/srt/test_jinja_template_utils.py
test/srt/test_jinja_template_utils.py
+1
-1
test/srt/test_reasoning_parser.py
test/srt/test_reasoning_parser.py
+1
-1
test/srt/test_vlm_accuracy.py
test/srt/test_vlm_accuracy.py
+1
-1
test/srt/test_vlm_input_format.py
test/srt/test_vlm_input_format.py
+1
-1
No files found.
python/sglang/srt/reasoning_parser.py
→
python/sglang/srt/
parser/
reasoning_parser.py
View file @
60e37f80
import
re
from
typing
import
Dict
,
Optional
,
Tuple
,
Type
from
sglang.srt.harmony_parser
import
HarmonyParser
from
sglang.srt.
parser.
harmony_parser
import
HarmonyParser
class
StreamingParseResult
:
...
...
python/sglang/srt/server_args.py
View file @
60e37f80
...
...
@@ -26,7 +26,7 @@ from typing import List, Literal, Optional, Union
from
sglang.srt.function_call.function_call_parser
import
FunctionCallParser
from
sglang.srt.hf_transformers_utils
import
check_gguf_file
,
get_config
from
sglang.srt.lora.lora_registry
import
LoRARef
from
sglang.srt.reasoning_parser
import
ReasoningParser
from
sglang.srt.
parser.
reasoning_parser
import
ReasoningParser
from
sglang.srt.utils
import
(
LORA_TARGET_ALL_MODULES
,
SUPPORTED_LORA_TARGET_MODULES
,
...
...
test/lang/test_separate_reasoning_execution.py
View file @
60e37f80
...
...
@@ -64,7 +64,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
for
ev
in
self
.
events
:
ev
.
set
()
@
patch
(
"sglang.srt.reasoning_parser.ReasoningParser"
)
@
patch
(
"sglang.srt.
parser.
reasoning_parser.ReasoningParser"
)
def
test_execute_separate_reasoning
(
self
,
mock_parser_class
):
"""Test that _execute_separate_reasoning correctly calls the ReasoningParser."""
# Setup mock parser
...
...
@@ -136,7 +136,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
# Verify that the text was updated
self
.
assertEqual
(
executor
.
text_
,
f
"[NORMAL from deepseek-r1]:
{
var_value
}
"
)
@
patch
(
"sglang.srt.reasoning_parser.ReasoningParser"
)
@
patch
(
"sglang.srt.
parser.
reasoning_parser.ReasoningParser"
)
def
test_reasoning_parser_integration
(
self
,
mock_parser_class
):
"""Test the integration between separate_reasoning and ReasoningParser."""
# Setup mock parsers for different model types
...
...
@@ -167,7 +167,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
self
.
assertEqual
(
reasoning
,
f
"[REASONING from qwen3]:
{
test_text
}
"
)
self
.
assertEqual
(
normal_text
,
f
"[NORMAL from qwen3]:
{
test_text
}
"
)
@
patch
(
"sglang.srt.reasoning_parser.ReasoningParser"
)
@
patch
(
"sglang.srt.
parser.
reasoning_parser.ReasoningParser"
)
def
test_reasoning_parser_invalid_model
(
self
,
mock_parser_class
):
"""Test that ReasoningParser raises an error for invalid model types."""
...
...
test/srt/test_harmony_parser.py
View file @
60e37f80
import
unittest
from
sglang.srt.harmony_parser
import
(
from
sglang.srt.
parser.
harmony_parser
import
(
CanonicalStrategy
,
Event
,
HarmonyParser
,
...
...
test/srt/test_jinja_template_utils.py
View file @
60e37f80
...
...
@@ -4,7 +4,7 @@ Unit tests for Jinja chat template utils.
import
unittest
from
sglang.srt.jinja_template_utils
import
(
from
sglang.srt.
parser.
jinja_template_utils
import
(
detect_jinja_template_content_format
,
process_content_for_template_format
,
)
...
...
test/srt/test_reasoning_parser.py
View file @
60e37f80
import
unittest
from
sglang.srt.reasoning_parser
import
(
from
sglang.srt.
parser.
reasoning_parser
import
(
BaseReasoningFormatDetector
,
DeepSeekR1Detector
,
KimiDetector
,
...
...
test/srt/test_vlm_accuracy.py
View file @
60e37f80
...
...
@@ -13,7 +13,6 @@ from PIL import Image
from
transformers
import
AutoModel
,
AutoProcessor
,
AutoTokenizer
from
sglang.srt.configs.model_config
import
ModelConfig
from
sglang.srt.conversation
import
generate_chat_conv
from
sglang.srt.entrypoints.openai.protocol
import
ChatCompletionRequest
from
sglang.srt.managers.mm_utils
import
embed_mm_inputs
,
init_embedding_cache
from
sglang.srt.managers.schedule_batch
import
(
...
...
@@ -23,6 +22,7 @@ from sglang.srt.managers.schedule_batch import (
)
from
sglang.srt.model_executor.model_runner
import
ModelRunner
from
sglang.srt.multimodal.processors.base_processor
import
BaseMultimodalProcessor
from
sglang.srt.parser.conversation
import
generate_chat_conv
from
sglang.srt.server_args
import
ServerArgs
...
...
test/srt/test_vlm_input_format.py
View file @
60e37f80
...
...
@@ -14,8 +14,8 @@ from transformers import (
)
from
sglang
import
Engine
from
sglang.srt.conversation
import
generate_chat_conv
from
sglang.srt.entrypoints.openai.protocol
import
ChatCompletionRequest
from
sglang.srt.parser.conversation
import
generate_chat_conv
TEST_IMAGE_URL
=
"https://github.com/sgl-project/sglang/blob/main/test/lang/example_image.png?raw=true"
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment