Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
23e79552
Unverified
Commit
23e79552
authored
Oct 01, 2025
by
Ayush Agarwal
Committed by
GitHub
Oct 01, 2025
Browse files
fix: null tools processing via minijinja (#3340)
Signed-off-by:
ayushag
<
ayushag@nvidia.com
>
parent
fcc42624
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
lib/llm/src/preprocessor/prompt/template/oai.rs
lib/llm/src/preprocessor/prompt/template/oai.rs
+7
-2
No files found.
lib/llm/src/preprocessor/prompt/template/oai.rs
View file @
23e79552
...
@@ -145,7 +145,11 @@ impl OAIChatLikeRequest for NvCreateChatCompletionRequest {
...
@@ -145,7 +145,11 @@ impl OAIChatLikeRequest for NvCreateChatCompletionRequest {
fn
tools
(
&
self
)
->
Option
<
Value
>
{
fn
tools
(
&
self
)
->
Option
<
Value
>
{
if
self
.inner.tools
.is_none
()
{
if
self
.inner.tools
.is_none
()
{
None
// ISSUE: {%- if tools is iterable and tools | length > 0 %}
// For cases like above, minijinja will not error out in calculating the length of tools
// as it evaluates both the sides an don't do short circuiting.
// Safe to return an empty array here. This will work even if tools are not present as length = 0
Some
(
Value
::
from_serialize
(
Vec
::
<
serde_json
::
Value
>
::
new
()))
}
else
{
}
else
{
// Try to fix the tool schema if it is missing type and properties
// Try to fix the tool schema if it is missing type and properties
Some
(
may_be_fix_tool_schema
(
Some
(
may_be_fix_tool_schema
(
...
@@ -254,7 +258,8 @@ impl OAIPromptFormatter for HfTokenizerConfigJsonFormatter {
...
@@ -254,7 +258,8 @@ impl OAIPromptFormatter for HfTokenizerConfigJsonFormatter {
let
mixins
=
Value
::
from_dyn_object
(
self
.mixins
.clone
());
let
mixins
=
Value
::
from_dyn_object
(
self
.mixins
.clone
());
let
tools
=
req
.tools
();
let
tools
=
req
.tools
();
let
has_tools
=
tools
.is_some
();
// has_tools should be true if tools is a non-empty array
let
has_tools
=
tools
.as_ref
()
.and_then
(|
v
|
v
.len
())
.is_some_and
(|
l
|
l
>
0
);
let
add_generation_prompt
=
req
.should_add_generation_prompt
();
let
add_generation_prompt
=
req
.should_add_generation_prompt
();
tracing
::
trace!
(
tracing
::
trace!
(
...
...
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