Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 25/create chat with repo compoent #38

Conversation

innovation64
Copy link
Collaborator

  • refactor: refactor the code
  • style: change the gradio UI
  • fix: remove useless files
  • fix: add config.yml

@Umpire2018 Umpire2018 requested a review from LOGIC-10 January 13, 2024 08:57
self.logger.debug(f"Results: {results}")
chunkrecall = self.extract_and_format_documents(result)
retrieved_documents = results['documents'][0]
response = self.rag(prompt,retrieved_documents)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有因为没有切块,所以每个索引的块内容都很长,不适合多个结果一块送入,会超过4096token,大概召回3个左右就 24900个左右了,所以把相关的都放进embedding recall里面了,没有再经过LLM做最后的输出。

所以目前的做法是只将 Top 1 的 rag 结果,即 md 文档中的内容给到大模型吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前是这样的

assistant = RepoAssistant(api_key, api_base, db_path,log_file)
md_contents = assistant.json_data.extract_md_contents()
assistant.chroma_data.create_vector_store(md_contents)
GradioInterface(assistant.respond)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个写法我持保留意见,我觉得当前 main 的目的是清晰地表达调用过程,但这行将以下过程进行了封装 1. 类实例化 2. 传递 RepoAssistant 类方法名 3. 将 assistant.respond 方法交由 GradioInterface 类执行,即与清晰的目的不一致。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这四部指的是1,传入相关配置,2.获取md内容3,放到向量数据库,4启动查询UI,主要rag已经封装了,上次说的能单例化的我基本都单例开了个类

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是针对 GradioInterface(assistant.respond) 这一行感觉 too heavy, 但只是个人意见,Git 默认是显示前四行。

chroma_data = ChromaManager(api_key, api_base)
self.textanslys = textanslys
self.json_data = json_data
self.chroma_data = chroma_data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果我的话应该会这么写:self.chroma_data = ChromaManager(api_key, api_base)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,我简化一下

@Umpire2018 Umpire2018 merged commit c684dac into OpenBMB:chat_with_repo Jan 15, 2024
file_handler.setLevel(log_level)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(formatter)
self.logger.addHandler(file_handler)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在下个版本中使用 from loguru import logger 吧,是一个简化了 Logging 配置的库

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在下个版本中使用 from loguru import logger 吧,是一个简化了 Logging 配置的库

好的,下次更新就换掉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants