-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from jujimeizuo/main
add zhipuai_embeddings and new knowledges
- Loading branch information
Showing
9 changed files
with
248 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import tianji.utils.knowledge_tool as knowledgetool | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
KNOWLEDGE_PATH = r"D:\1-wsl\TIANJI\Tianji\tianji\knowledges\04-Wishes\knowledges.txt" | ||
SAVE_PATH = r"D:\1-wsl\TIANJI\Tianji\temp" | ||
# KNOWLEDGE_PATH = r"D:\1-wsl\TIANJI\Tianji\tianji\knowledges\04-Wishes\knowledges.txt" | ||
# SAVE_PATH = r"D:\1-wsl\TIANJI\Tianji\temp" | ||
|
||
KNOWLEDGE_PATH = r"/Users/fengzetao/Workspace/Github/SocialAI/Tianji/tianji/knowledges/04-Wishes/knowledges.txt" | ||
SAVE_PATH = r"/Users/fengzetao/Workspace/Github/SocialAI/Tianji/temp" | ||
|
||
# doclist = knowledgetool.get_docs_list_query_zhipu(query_str="春节",loader_file_path=KNOWLEDGE_PATH, \ | ||
# doclist = knowledgetool.get_docs_list_query_openai(query_str="春节",loader_file_path=KNOWLEDGE_PATH, \ | ||
# persist_directory = SAVE_PATH,k_num=5) | ||
|
||
doclist = knowledgetool.get_docs_list_query_openai(query_str="春节",loader_file_path=KNOWLEDGE_PATH, \ | ||
persist_directory = SAVE_PATH,k_num=5) | ||
doclist = knowledgetool.get_docs_list_query_zhipuai( | ||
query_str="春节", | ||
loader_file_path=KNOWLEDGE_PATH, | ||
persist_directory=SAVE_PATH, | ||
k_num=5, | ||
) | ||
|
||
if doclist is not []: | ||
print(doclist) | ||
else: | ||
print("doclist is [] !") | ||
print("doclist is [] !") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
from .action import * | ||
from metagpt.actions import Action | ||
from metagpt.roles import Role | ||
from metagpt.schema import Message | ||
from metagpt.logs import logger | ||
from .action import writeMD | ||
|
||
|
||
class ruyi(Role): | ||
name: str = "ruyi" | ||
profile: str = "stylize" | ||
|
||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
self._init_actions([writeMD]) | ||
self._set_react_mode(react_mode="by_order") | ||
|
||
async def _act(self) -> Message: | ||
logger.info(f"{self._setting}: to do {self.rc.todo}({self.rc.todo.name})") | ||
|
||
todo = self.rc.todo | ||
|
||
msg = self.get_memories(k=1)[0] # find the most k recent messagesA | ||
msg = self.get_memories(k=1)[0] # find the most k recent messagesA | ||
result = await todo.run(msg.content) | ||
|
||
msg = Message(content=result, role=self.profile, cause_by=type(todo)) | ||
self.rc.memory.add(msg) | ||
return msg | ||
return msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.