Change template to private attribute and simplify imports (#101)
--------- Co-authored-by: ian <ian@cinnamon.is>
This commit is contained in:
committed by
GitHub
parent
1f927d3391
commit
da0ac1d69f
@@ -1,8 +1,7 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from theflow import Param
|
||||
from kotaemon.base import BaseComponent, Document, Param
|
||||
|
||||
from ..base import BaseComponent, Document
|
||||
from .linear import GatedLinearPipeline
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from copy import deepcopy
|
||||
from typing import Callable, List
|
||||
|
||||
from theflow import Function, Node, Param
|
||||
|
||||
from kotaemon.base import BaseComponent, Document
|
||||
from kotaemon.base import BaseComponent, Document, Node, Param
|
||||
|
||||
from .chats import AzureChatOpenAI
|
||||
from .completions import LLM
|
||||
@@ -74,7 +72,7 @@ class Thought(BaseComponent):
|
||||
)
|
||||
)
|
||||
llm: LLM = Node(AzureChatOpenAI, help="The LLM model to execute the input prompt")
|
||||
post_process: Function = Node(
|
||||
post_process: BaseComponent = Node(
|
||||
help=(
|
||||
"The function post-processor that post-processes LLM output prediction ."
|
||||
"It should take a string as input (this is the LLM output text) and return "
|
||||
@@ -85,7 +83,7 @@ class Thought(BaseComponent):
|
||||
@Node.auto(depends_on="prompt")
|
||||
def prompt_template(self):
|
||||
"""Automatically wrap around param prompt. Can ignore"""
|
||||
return BasePromptComponent(self.prompt)
|
||||
return BasePromptComponent(template=self.prompt)
|
||||
|
||||
def run(self, **kwargs) -> Document:
|
||||
"""Run the chain of thought"""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Callable, Union
|
||||
|
||||
from ...base import BaseComponent, Document
|
||||
from kotaemon.base import BaseComponent, Document
|
||||
|
||||
from .template import PromptTemplate
|
||||
|
||||
|
||||
@@ -16,6 +17,7 @@ class BasePromptComponent(BaseComponent):
|
||||
|
||||
class Config:
|
||||
middleware_switches = {"theflow.middleware.CachingMiddleware": False}
|
||||
allow_extra = True
|
||||
|
||||
def __init__(self, template: Union[str, PromptTemplate], **kwargs):
|
||||
super().__init__()
|
||||
|
||||
Reference in New Issue
Block a user