Files
sglang/python/sglang/__init__.py

77 lines
1.6 KiB
Python
Raw Normal View History

2024-05-09 15:39:22 +08:00
# SGL API Components
2024-07-29 23:04:48 -07:00
2024-05-09 15:39:22 +08:00
from sglang.api import (
Runtime,
assistant,
assistant_begin,
assistant_end,
flush_cache,
function,
gen,
gen_int,
gen_string,
get_server_args,
image,
select,
set_default_backend,
system,
system_begin,
system_end,
2024-05-09 15:39:22 +08:00
user,
user_begin,
user_end,
2024-05-14 07:57:00 +08:00
video,
2024-05-09 15:39:22 +08:00
)
from sglang.lang.choices import (
greedy_token_selection,
token_length_normalized,
unconditional_likelihood_normalized,
)
2024-05-09 15:39:22 +08:00
2024-07-29 23:04:48 -07:00
# SGLang DSL APIs
2024-07-29 19:40:28 -07:00
__all__ = [
"Runtime",
2024-07-29 23:04:48 -07:00
"assistant",
"assistant_begin",
"assistant_end",
2024-07-29 19:40:28 -07:00
"flush_cache",
2024-07-29 23:04:48 -07:00
"function",
2024-07-29 19:40:28 -07:00
"gen",
"gen_int",
"gen_string",
2024-07-29 23:04:48 -07:00
"get_server_args",
2024-07-29 19:40:28 -07:00
"image",
"select",
2024-07-29 23:04:48 -07:00
"set_default_backend",
2024-07-29 19:40:28 -07:00
"system",
2024-07-29 23:04:48 -07:00
"system_begin",
"system_end",
2024-07-29 19:40:28 -07:00
"user",
"user_begin",
"user_end",
2024-07-29 23:04:48 -07:00
"video",
"greedy_token_selection",
"token_length_normalized",
"unconditional_likelihood_normalized",
2024-07-29 19:40:28 -07:00
]
2024-07-29 23:04:48 -07:00
# Global Configurations
from sglang.global_config import global_config
__all__ += ["global_config"]
from sglang.version import __version__
__all__ += ["__version__"]
# SGL Backends
from sglang.lang.backend.runtime_endpoint import RuntimeEndpoint
from sglang.utils import LazyImport
Anthropic = LazyImport("sglang.lang.backend.anthropic", "Anthropic")
LiteLLM = LazyImport("sglang.lang.backend.litellm", "LiteLLM")
OpenAI = LazyImport("sglang.lang.backend.openai", "OpenAI")
VertexAI = LazyImport("sglang.lang.backend.vertexai", "VertexAI")
__all__ += ["Anthropic", "LiteLLM", "OpenAI", "VertexAI", "RuntimeEndpoint"]