add sales test

This commit is contained in:
geekan 2023-12-25 22:13:36 +08:00
parent 9f653ea60b
commit bd1014e19a
5 changed files with 33 additions and 84 deletions

View file

@ -13,6 +13,7 @@ from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import FAISS
from langchain_core.embeddings import Embeddings
from metagpt.config import CONFIG
from metagpt.const import DATA_PATH
from metagpt.document import IndexableDocument
from metagpt.document_store.base_store import LocalStore
@ -25,7 +26,9 @@ class FaissStore(LocalStore):
):
self.meta_col = meta_col
self.content_col = content_col
self.embedding = embedding or OpenAIEmbeddings()
self.embedding = embedding or OpenAIEmbeddings(
openai_api_key=CONFIG.openai_api_key, openai_api_base=CONFIG.openai_base_url
)
super().__init__(raw_data, cache_dir)
def _load(self) -> Optional["FaissStore"]:

View file

@ -15,14 +15,15 @@ from metagpt.tools import SearchEngineType
class Sales(Role):
name: str = "Xiaomei"
profile: str = "Retail sales guide"
desc: str = "I am a sales guide in retail. My name is Xiaomei. I will answer some customer questions next, and I "
"will answer questions only based on the information in the knowledge base."
"If I feel that you can't get the answer from the reference material, then I will directly reply that"
" I don't know, and I won't tell you that this is from the knowledge base,"
"but pretend to be what I know. Note that each of my replies will be replied in the tone of a "
"professional guide"
name: str = "John Smith"
profile: str = "Retail Sales Guide"
desc: str = (
"As a Retail Sales Guide, my name is John Smith. I specialize in addressing customer inquiries with "
"expertise and precision. My responses are based solely on the information available in our knowledge"
" base. In instances where your query extends beyond this scope, I'll honestly indicate my inability "
"to provide an answer, rather than speculate or assume. Please note, each of my replies will be "
"delivered with the professionalism and courtesy expected of a seasoned sales guide."
)
store: Optional[BaseStore] = None