"examples/backends/vllm/launch/dep.sh" did not exist on "f3e3d94a6a293ffbab941008cc29abe213996b48"
mod.rs 663 Bytes
Newer Older
1
2
3
4
5
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod harmony_parser;

6
pub use super::config::JsonParserConfig;
7
pub use super::{config, response};
8
pub use harmony_parser::{detect_tool_call_start_harmony, parse_tool_calls_harmony_complete};
9
10
11
12
13
14
15
16
17
18
19
20

pub fn find_tool_call_end_position_harmony(chunk: &str, config: &JsonParserConfig) -> usize {
    let end_token = config
        .tool_call_end_tokens
        .first()
        .map_or("<|call|>", |v| v);
    if let Some(pos) = chunk.rfind(end_token) {
        pos + end_token.len()
    } else {
        chunk.len()
    }
}