@@ -5,6 +5,7 @@ use dynamo_parsers::{ParserResult, ReasoningParser, ReasoningParserType, Reasoni
55
66use super :: { NvCreateChatCompletionRequest , NvCreateChatCompletionStreamResponse } ;
77use crate :: {
8+ local_model:: runtime_config,
89 protocols:: common:: { self } ,
910 types:: TokenIdType ,
1011} ;
@@ -15,11 +16,15 @@ impl NvCreateChatCompletionRequest {
1516 ///
1617 /// # Returns
1718 /// * [`DeltaGenerator`] configured with model name and response options.
18- pub fn response_generator ( & self ) -> DeltaGenerator {
19+ pub fn response_generator (
20+ & self ,
21+ runtime_config : runtime_config:: ModelRuntimeConfig ,
22+ ) -> DeltaGenerator {
1923 let options = DeltaGeneratorOptions {
2024 enable_usage : true ,
2125 enable_logprobs : self . inner . logprobs . unwrap_or ( false )
2226 || self . inner . top_logprobs . unwrap_or ( 0 ) > 0 ,
27+ runtime_config,
2328 } ;
2429
2530 DeltaGenerator :: new ( self . inner . model . clone ( ) , options)
@@ -33,6 +38,8 @@ pub struct DeltaGeneratorOptions {
3338 pub enable_usage : bool ,
3439 /// Determines whether log probabilities should be included in the response.
3540 pub enable_logprobs : bool ,
41+
42+ pub runtime_config : runtime_config:: ModelRuntimeConfig ,
3643}
3744
3845/// Generates incremental chat completion responses in a streaming fashion.
@@ -92,10 +99,14 @@ impl DeltaGenerator {
9299 // This is hardcoded for now, but can be made configurable later.
93100 // TODO: Make parser type configurable once front-end integration is determined
94101 // Change to GptOss to test GptOSS parser
95- let reasoning_parser_type = ReasoningParserType :: Basic ;
96-
97102 // Reasoning parser wrapper
98- let reasoning_parser = reasoning_parser_type. get_reasoning_parser ( ) ;
103+ let reasoning_parser = ReasoningParserType :: get_reasoning_parser_from_name (
104+ options
105+ . runtime_config
106+ . reasoning_parser
107+ . as_deref ( )
108+ . unwrap_or ( "basic" ) ,
109+ ) ;
99110
100111 Self {
101112 id : format ! ( "chatcmpl-{}" , uuid:: Uuid :: new_v4( ) ) ,
0 commit comments