Change template to private attribute and simplify imports (#101)

---------

Co-authored-by: ian <ian@cinnamon.is>
This commit is contained in:
Duc Nguyen (john)
2023-12-08 18:10:34 +07:00
committed by GitHub
parent 1f927d3391
commit da0ac1d69f
13 changed files with 31 additions and 39 deletions

View File

@@ -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"""