mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
fix: dont check protocol compliance for experimental methods
This commit is contained in:
parent
ad86a68a32
commit
8b4158169f
3 changed files with 8 additions and 2 deletions
|
@ -726,7 +726,7 @@ class Inference(Protocol):
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@webmethod(route="/inference/batch-completion", method="POST")
|
@webmethod(route="/inference/batch-completion", method="POST", experimental=True)
|
||||||
async def batch_completion(
|
async def batch_completion(
|
||||||
self,
|
self,
|
||||||
model_id: str,
|
model_id: str,
|
||||||
|
@ -777,7 +777,7 @@ class Inference(Protocol):
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@webmethod(route="/inference/batch-chat-completion", method="POST")
|
@webmethod(route="/inference/batch-chat-completion", method="POST", experimental=True)
|
||||||
async def batch_chat_completion(
|
async def batch_chat_completion(
|
||||||
self,
|
self,
|
||||||
model_id: str,
|
model_id: str,
|
||||||
|
|
|
@ -400,6 +400,8 @@ def check_protocol_compliance(obj: Any, protocol: Any) -> None:
|
||||||
mro = type(obj).__mro__
|
mro = type(obj).__mro__
|
||||||
for name, value in inspect.getmembers(protocol):
|
for name, value in inspect.getmembers(protocol):
|
||||||
if inspect.isfunction(value) and hasattr(value, "__webmethod__"):
|
if inspect.isfunction(value) and hasattr(value, "__webmethod__"):
|
||||||
|
if value.__webmethod__.experimental:
|
||||||
|
continue
|
||||||
if not hasattr(obj, name):
|
if not hasattr(obj, name):
|
||||||
missing_methods.append((name, "missing"))
|
missing_methods.append((name, "missing"))
|
||||||
elif not callable(getattr(obj, name)):
|
elif not callable(getattr(obj, name)):
|
||||||
|
|
|
@ -20,6 +20,7 @@ class WebMethod:
|
||||||
raw_bytes_request_body: Optional[bool] = False
|
raw_bytes_request_body: Optional[bool] = False
|
||||||
# A descriptive name of the corresponding span created by tracing
|
# A descriptive name of the corresponding span created by tracing
|
||||||
descriptive_name: Optional[str] = None
|
descriptive_name: Optional[str] = None
|
||||||
|
experimental: Optional[bool] = False
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T", bound=Callable[..., Any])
|
T = TypeVar("T", bound=Callable[..., Any])
|
||||||
|
@ -33,6 +34,7 @@ def webmethod(
|
||||||
response_examples: Optional[List[Any]] = None,
|
response_examples: Optional[List[Any]] = None,
|
||||||
raw_bytes_request_body: Optional[bool] = False,
|
raw_bytes_request_body: Optional[bool] = False,
|
||||||
descriptive_name: Optional[str] = None,
|
descriptive_name: Optional[str] = None,
|
||||||
|
experimental: Optional[bool] = False,
|
||||||
) -> Callable[[T], T]:
|
) -> Callable[[T], T]:
|
||||||
"""
|
"""
|
||||||
Decorator that supplies additional metadata to an endpoint operation function.
|
Decorator that supplies additional metadata to an endpoint operation function.
|
||||||
|
@ -41,6 +43,7 @@ def webmethod(
|
||||||
:param public: True if the operation can be invoked without prior authentication.
|
:param public: True if the operation can be invoked without prior authentication.
|
||||||
:param request_examples: Sample requests that the operation might take. Pass a list of objects, not JSON.
|
:param request_examples: Sample requests that the operation might take. Pass a list of objects, not JSON.
|
||||||
:param response_examples: Sample responses that the operation might produce. Pass a list of objects, not JSON.
|
:param response_examples: Sample responses that the operation might produce. Pass a list of objects, not JSON.
|
||||||
|
:param experimental: True if the operation is experimental and subject to change.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def wrap(func: T) -> T:
|
def wrap(func: T) -> T:
|
||||||
|
@ -52,6 +55,7 @@ def webmethod(
|
||||||
response_examples=response_examples,
|
response_examples=response_examples,
|
||||||
raw_bytes_request_body=raw_bytes_request_body,
|
raw_bytes_request_body=raw_bytes_request_body,
|
||||||
descriptive_name=descriptive_name,
|
descriptive_name=descriptive_name,
|
||||||
|
experimental=experimental,
|
||||||
)
|
)
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue