Correct the use of abstractmethod (#80)

* Correct abstractmethod usage

* Update interface

* Specify minimal llama-index version [ignore cache]

* Update examples
This commit is contained in:
Nguyen Trung Duc (john)
2023-11-20 11:18:53 +07:00
committed by GitHub
parent 98509f886c
commit 0a3fc4b228
12 changed files with 33 additions and 37 deletions

View File

@@ -2,7 +2,7 @@ from abc import abstractmethod
from typing import List, Optional
from langchain.schema.messages import AIMessage, SystemMessage
from theflow import Param, SessionCompose
from theflow import SessionFunction
from ..base import BaseComponent
from ..base.schema import LLMInterface
@@ -20,7 +20,7 @@ def session_chat_storage(obj):
return obj._store_result
class ChatConversation(SessionCompose):
class ChatConversation(SessionFunction):
"""Base implementation of a chat bot component
A chatbot component should:
@@ -31,7 +31,7 @@ class ChatConversation(SessionCompose):
class Config:
store_result = session_chat_storage
system_message: Param[str] = Param(default="")
system_message: str = ""
bot: BaseChatBot
def __init__(self, *args, **kwargs):

View File

@@ -1,5 +1,3 @@
from theflow import Node
from ..llms import ChatLLM
from .base import BaseChatBot
@@ -7,7 +5,7 @@ from .base import BaseChatBot
class SimpleRespondentChatbot(BaseChatBot):
"""Simple text respondent chatbot that essentially wraps around a chat LLM"""
llm: Node[ChatLLM]
llm: ChatLLM
def _get_message(self) -> str:
return self.llm(self.history).text