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
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
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. |
print(results) | ||
left_index = results.find("{") | ||
right_index = results.rfind("}") | ||
return json.loads(results[left_index : right_index + 1]) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个没写单测,是不是可以删掉了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删除了system message
def _parse_results(self, results): | ||
left_index = results.find("{") | ||
right_index = results.rfind("}") | ||
return json.loads(results[left_index : right_index + 1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上,感觉可以加上一个 pydantic 的类来做解析,同时验证结果是否正确。
Graph DFS方法(高级版)