mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
refactor: llm decouple code executor module (#33400)
Co-authored-by: Byron.wang <byron@dify.ai>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Protocol
|
||||
|
||||
from core.model_manager import ModelInstance
|
||||
@ -19,3 +20,11 @@ class ModelFactory(Protocol):
|
||||
def init_model_instance(self, provider_name: str, model_name: str) -> ModelInstance:
|
||||
"""Create a model instance that is ready for schema lookup and invocation."""
|
||||
...
|
||||
|
||||
|
||||
class TemplateRenderer(Protocol):
|
||||
"""Port for rendering prompt templates used by LLM-compatible nodes."""
|
||||
|
||||
def render_jinja2(self, *, template: str, inputs: Mapping[str, Any]) -> str:
|
||||
"""Render the given Jinja2 template into plain text."""
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user