MCPcopy Create free account
hub / github.com/HKUDS/AutoAgent / rerank

Method rerank

autoagent/memory/code_memory.py:90–174  ·  view source on GitHub ↗
(self, query_text: str, query_results: List[Dict])

Source from the content-addressed store, hash-verified

88
89 return unique_lines
90 def rerank(self, query_text: str, query_results: List[Dict]) -> List[Dict]:
91 system_prompt = \
92 """
93 You are a helpful assistant that reranks the given code files (containing the path of files and Overview of the content of files) based on the query.
94 You should rerank the code files based on the query, and the most relevant code files should be ranked on the top.
95 You should select the top 5 code files to answer the query, by giving the file path of the code files.
96
97 Example:
98 [Query]: "The definition of 'BaseAgent'"
99 [Code files]:
100 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agents/__init__.py
101 Content: from .ABCAgent import ABCAgent
102 from .BaseAgent import BaseAgent
103 from .ManagerAgent import ManagerAge...
104 ---
105 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agents/__init__.py
106 Content: from .ABCAgent import ABCAgent
107 from .BaseAgent import BaseAgent
108 from .ManagerAgent import ManagerAge...
109 ---
110 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agents/__init__.py
111 Content: from .ABCAgent import ABCAgent
112 from .BaseAgent import BaseAgent
113 from .ManagerAgent import ManagerAge...
114 ---
115 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agents/__init__.py
116 Content: from .ABCAgent import ABCAgent
117 from .BaseAgent import BaseAgent
118 from .ManagerAgent import ManagerAge...
119 ---
120 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agent_prompts/__init__.py
121 Content: from .BasePrompt import BasePromptGen, ManagerPromptGen, PromptGen
122 ...
123 ---
124 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agent_prompts/__init__.py
125 Content: from .BasePrompt import BasePromptGen, ManagerPromptGen, PromptGen
126 ...
127 ---
128 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agent_prompts/__init__.py
129 Content: from .BasePrompt import BasePromptGen, ManagerPromptGen, PromptGen
130 ...
131 ---
132 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agent_prompts/__init__.py
133 Content: from .BasePrompt import BasePromptGen, ManagerPromptGen, PromptGen
134 ...
135 ---
136 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agents/BaseAgent.py
137 Content: from typing import List
138
139 from sa.actions import BaseAction, FinishAct, ThinkAct, PlanAct
140 from sa.age...
141 ---
142 File: /Users/tangjiabin/Documents/reasoning/SelfAgent/sa/agents/BaseAgent.py
143 Content: from typing import List
144
145 from sa.actions import BaseAction, FinishAct, ThinkAct, PlanAct
146 from sa.age...
147 ---

Callers 1

code_ragFunction · 0.95

Calls 3

wrap_query_resultsMethod · 0.95
parse_resultsMethod · 0.95
wrap_reranked_resultsMethod · 0.95

Tested by

no test coverage detected