[Frontend] Add site-packages support for reasoning/tool parser plugins (#45241)
Signed-off-by: odashi <yusuke.oda@predicate.jp> Co-authored-by: Chauncey <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
from collections.abc import Callable, Sequence
|
||||
from functools import cached_property
|
||||
from typing import Any
|
||||
@@ -33,7 +32,7 @@ from vllm.sampling_params import (
|
||||
from vllm.tokenizers import TokenizerLike
|
||||
from vllm.tool_parsers.utils import Tool, get_json_schema_from_tools
|
||||
from vllm.utils.collection_utils import is_list_of
|
||||
from vllm.utils.import_utils import import_from_path
|
||||
from vllm.utils.import_utils import import_plugin
|
||||
|
||||
__all__ = ["Tool"]
|
||||
|
||||
@@ -367,12 +366,5 @@ class ToolParserManager:
|
||||
|
||||
@classmethod
|
||||
def import_tool_parser(cls, plugin_path: str) -> None:
|
||||
"""Import a user-defined parser file from arbitrary path."""
|
||||
|
||||
module_name = os.path.splitext(os.path.basename(plugin_path))[0]
|
||||
try:
|
||||
import_from_path(module_name, plugin_path)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Failed to load module '%s' from %s.", module_name, plugin_path
|
||||
)
|
||||
"""Import a user-defined tool parser."""
|
||||
import_plugin(plugin_path)
|
||||
|
||||
Reference in New Issue
Block a user