Skip to content

Commit 02702b5

Browse files
committed
rename to chat_template_args
Signed-off-by: Chi McIsaac <[email protected]>
1 parent 4a8afd0 commit 02702b5

File tree

11 files changed

+22
-22
lines changed

11 files changed

+22
-22
lines changed

examples/multimodal/utils/chat_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ async def preprocess(self, raw_request: ChatCompletionRequest) -> PreprocessResu
160160
continue_final_message=request.continue_final_message,
161161
tool_dicts=None,
162162
documents=request.documents,
163-
chat_template_kwargs=request.chat_template_kwargs,
163+
chat_template_args=request.chat_template_args,
164164
tool_parser=self.openai_serving.tool_parser,
165165
truncate_prompt_tokens=request.truncate_prompt_tokens,
166166
add_special_tokens=request.add_special_tokens,

lib/llm/src/entrypoint/input/batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ async fn evaluate(
228228
inner,
229229
common: Default::default(),
230230
nvext: None,
231-
chat_template_kwargs: None,
231+
chat_template_args: None,
232232
};
233233
let mut stream = engine.generate(Context::new(req)).await?;
234234
let mut output = String::new();

lib/llm/src/entrypoint/input/text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ async fn main_loop(
122122
inner,
123123
common: Default::default(),
124124
nvext: Some(nvext),
125-
chat_template_kwargs: None,
125+
chat_template_args: None,
126126
};
127127

128128
// Call the model

lib/llm/src/http/service/openai.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ mod tests {
13241324
},
13251325
common: Default::default(),
13261326
nvext: None,
1327-
chat_template_kwargs: None,
1327+
chat_template_args: None,
13281328
};
13291329
let result = validate_chat_completion_required_fields(&request);
13301330
assert!(result.is_err());
@@ -1352,7 +1352,7 @@ mod tests {
13521352
},
13531353
common: Default::default(),
13541354
nvext: None,
1355-
chat_template_kwargs: None,
1355+
chat_template_args: None,
13561356
};
13571357
let result = validate_chat_completion_required_fields(&request);
13581358
assert!(result.is_ok());

lib/llm/src/preprocessor/prompt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ pub trait OAIChatLikeRequest {
7070

7171
fn should_add_generation_prompt(&self) -> bool;
7272

73-
/// Optional additional kwargs to merge into the chat template context
74-
fn chat_template_kwargs(&self) -> Option<HashMap<String, serde_json::Value>> {
73+
/// Optional additional args to merge into the chat template context
74+
fn chat_template_args(&self) -> Option<&HashMap<String, serde_json::Value>> {
7575
None
7676
}
7777

lib/llm/src/preprocessor/prompt/template/oai.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ impl OAIChatLikeRequest for NvCreateChatCompletionRequest {
127127
Some(TextInput::Single(String::new()))
128128
}
129129

130-
fn chat_template_kwargs(&self) -> Option<std::collections::HashMap<String, serde_json::Value>> {
131-
self.chat_template_kwargs.clone()
130+
fn chat_template_args(&self) -> Option<&std::collections::HashMap<String, serde_json::Value>> {
131+
self.chat_template_args.as_ref()
132132
}
133133
}
134134

@@ -223,9 +223,9 @@ impl OAIPromptFormatter for HfTokenizerConfigJsonFormatter {
223223
..mixins
224224
};
225225

226-
// Merge any additional kwargs into the context last so they take precedence
227-
let ctx = if let Some(kwargs) = req.chat_template_kwargs() {
228-
let extra = Value::from_serialize(kwargs);
226+
// Merge any additional args into the context last so they take precedence
227+
let ctx = if let Some(args) = req.chat_template_args() {
228+
let extra = Value::from_serialize(args);
229229
context! { ..ctx, ..extra }
230230
} else {
231231
ctx

lib/llm/src/protocols/openai/chat_completions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ pub struct NvCreateChatCompletionRequest {
5454
#[serde(skip_serializing_if = "Option::is_none")]
5555
pub nvext: Option<NvExt>,
5656

57-
/// Extra kwargs to pass to the chat template rendering context
57+
/// Extra args to pass to the chat template rendering context
5858
#[serde(default, skip_serializing_if = "Option::is_none")]
59-
pub chat_template_kwargs: Option<std::collections::HashMap<String, serde_json::Value>>,
59+
pub chat_template_args: Option<std::collections::HashMap<String, serde_json::Value>>,
6060
}
6161

6262
/// A response structure for unary chat completion responses, embedding OpenAI's

lib/llm/src/protocols/openai/responses.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl TryFrom<NvCreateResponse> for NvCreateChatCompletionRequest {
187187
},
188188
common: Default::default(),
189189
nvext: resp.nvext,
190-
chat_template_kwargs: None,
190+
chat_template_args: None,
191191
})
192192
}
193193
}

lib/llm/tests/http-service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ async fn test_nv_custom_client() {
768768
inner: inner_request,
769769
common: Default::default(),
770770
nvext: None,
771-
chat_template_kwargs: None,
771+
chat_template_args: None,
772772
};
773773

774774
let result = nv_custom_client.chat_stream(request).await;
@@ -808,7 +808,7 @@ async fn test_nv_custom_client() {
808808
inner: inner_request,
809809
common: Default::default(),
810810
nvext: None,
811-
chat_template_kwargs: None,
811+
chat_template_args: None,
812812
};
813813

814814
let result = nv_custom_client.chat_stream(request).await;
@@ -849,7 +849,7 @@ async fn test_nv_custom_client() {
849849
inner: inner_request,
850850
common: Default::default(),
851851
nvext: None,
852-
chat_template_kwargs: None,
852+
chat_template_args: None,
853853
};
854854

855855
let result = nv_custom_client

lib/llm/tests/preprocessor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl Request {
270270
inner,
271271
common: Default::default(),
272272
nvext: None,
273-
chat_template_kwargs: None,
273+
chat_template_args: None,
274274
}
275275
}
276276
}

0 commit comments

Comments
 (0)