(
self, input_query: str, agent_scratchpad: str, is_final: bool
)
| 199 | return formatted_contexts |
| 200 | |
| 201 | async def join( |
| 202 | self, input_query: str, agent_scratchpad: str, is_final: bool |
| 203 | ) -> str: |
| 204 | if is_final: |
| 205 | joinner_prompt = self.joinner_prompt_final |
| 206 | else: |
| 207 | joinner_prompt = self.joinner_prompt |
| 208 | prompt = ( |
| 209 | f"{joinner_prompt}\n" # Instructions and examples |
| 210 | f"Question: {input_query}\n\n" # User input query |
| 211 | f"{agent_scratchpad}\n" # T-A-O |
| 212 | # "---\n" |
| 213 | ) |
| 214 | log("Joining prompt:\n", prompt, block=True) |
| 215 | response = await self.agent.arun( |
| 216 | prompt, callbacks=[self.executor_callback] if self.benchmark else None |
| 217 | ) |
| 218 | raw_answer = cast(str, response) |
| 219 | log("Question: \n", input_query, block=True) |
| 220 | log("Raw Answer: \n", raw_answer, block=True) |
| 221 | thought, answer, is_replan = self._parse_joinner_output(raw_answer) |
| 222 | if is_final: |
| 223 | # If final, we don't need to replan |
| 224 | is_replan = False |
| 225 | return thought, answer, is_replan |
| 226 | |
| 227 | def _call( |
| 228 | self, |
no test coverage detected