mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
3449902b03
* added ChatClientBase with function calling * streaming update * fixed typing * test setup * small update * src setup * removed src, updated test naming * fixed test command * alolow args * updated test run * added unit test folder to azure * added init and unit test to azure * added other cross tests * restructured * reset test run * fix name * removed always * updated test * extend pytest.xml locations * run surface always * added decorators for FC and marked tests * fixed mypy settings and added tests * fix override import * removed import
26 lines
767 B
Python
26 lines
767 B
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
|
|
from typing import Generic, Protocol, TypeVar, runtime_checkable
|
|
|
|
TInput = TypeVar("TInput")
|
|
TResponse = TypeVar("TResponse")
|
|
|
|
|
|
@runtime_checkable
|
|
class InputGuardrail(Protocol, Generic[TInput]):
|
|
"""A protocol for input guardrails that can validate and transform input messages."""
|
|
|
|
def __call__(self, message: TInput) -> TInput:
|
|
"""Validate and possibly transform the input message."""
|
|
...
|
|
|
|
|
|
@runtime_checkable
|
|
class OutputGuardrail(Protocol, Generic[TResponse]):
|
|
"""A protocol for output guardrails that can validate and transform output messages."""
|
|
|
|
def __call__(self, message: TResponse) -> TResponse:
|
|
"""Validate and possibly transform the output message."""
|
|
...
|