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

[Advanced RetrievalAgent]Add advanced retrieval agent #275

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from

Conversation

w5688414
Copy link
Collaborator

@w5688414 w5688414 commented Jan 9, 2024

Graph DFS方法(高级版)

@w5688414 w5688414 changed the title Add advanced retrieval agent [Advanced RetrievalAgent]Add advanced retrieval agent Jan 9, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (6fbc099) 69.37% compared to head (f286e6b) 69.17%.
Report is 1 commits behind head on develop.

Files Patch % Lines
...agent/src/erniebot_agent/agents/retrieval_agent.py 44.00% 14 Missing ⚠️
...ot-agent/src/erniebot_agent/tools/baizhong_tool.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #275      +/-   ##
===========================================
- Coverage    69.37%   69.17%   -0.20%     
===========================================
  Files           63       64       +1     
  Lines         3236     3264      +28     
===========================================
+ Hits          2245     2258      +13     
- Misses         991     1006      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@w5688414 w5688414 self-assigned this Jan 10, 2024
@w5688414 w5688414 marked this pull request as ready for review January 15, 2024 08:59
@w5688414 w5688414 requested a review from sijunhe January 15, 2024 10:32
print(results)
left_index = results.find("{")
right_index = results.rfind("}")
return json.loads(results[left_index : right_index + 1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

为了保证解析出来的结果肯定是符合预期的,我建议这边写一个 pydantic BaseModel 的类来解析,这样一方面做了验证,另一方面解析出来的是一个 pydantic 的类,代码阅读性和代码智能提示也会更好一点,你觉得呢?

@@ -15,3 +18,6 @@ def get_messages(self):

def clear_chat_history(self):
self._history.clear()

def set_system_message(self, message: SystemMessage):
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个没写单测,是不是可以删掉了?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

删除了system message

erniebot-agent/src/erniebot_agent/tools/baizhong_tool.py Outdated Show resolved Hide resolved
def _parse_results(self, results):
left_index = results.find("{")
right_index = results.rfind("}")
return json.loads(results[left_index : right_index + 1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上,感觉可以加上一个 pydantic 的类来做解析,同时验证结果是否正确。

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.

None yet

3 participants