This commit is contained in:
Christian Mantha
2026-03-02 19:10:52 -05:00
commit 2ca0b9ef7c
28907 changed files with 5233713 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
from typing import Any, Optional
from mlflow.pyfunc.loaders.chat_agent import _ChatAgentPyfuncWrapper
from mlflow.pyfunc.loaders.chat_model import _ChatModelPyfuncWrapper
from mlflow.pyfunc.model import (
ChatAgent,
ChatModel,
_load_context_model_and_signature,
_PythonModelPyfuncWrapper,
)
try:
from mlflow.pyfunc.model import ResponsesAgent
IS_RESPONSES_AGENT_AVAILABLE = True
except ImportError:
IS_RESPONSES_AGENT_AVAILABLE = False
def _load_pyfunc(local_path: str, model_config: Optional[dict[str, Any]] = None):
context, model, signature = _load_context_model_and_signature(local_path, model_config)
if isinstance(model, ChatModel):
return _ChatModelPyfuncWrapper(model, context, signature)
elif isinstance(model, ChatAgent):
return _ChatAgentPyfuncWrapper(model)
elif IS_RESPONSES_AGENT_AVAILABLE and isinstance(model, ResponsesAgent):
from mlflow.pyfunc.loaders.responses_agent import _ResponsesAgentPyfuncWrapper
return _ResponsesAgentPyfuncWrapper(model)
else:
return _PythonModelPyfuncWrapper(model, context, signature)