Answer the user query based on the supporting documents. Args: original_user_query: The original user query. supporting_docs: The supporting documents. Returns: The answer to the user query.
(original_user_query: str, supporting_docs: str, **kwargs)
| 199 | @register_tool("answer_query") |
| 200 | @register_plugin_tool("answer_query") |
| 201 | def answer_query(original_user_query: str, supporting_docs: str, **kwargs) -> str: |
| 202 | """ |
| 203 | Answer the user query based on the supporting documents. |
| 204 | |
| 205 | Args: |
| 206 | original_user_query: The original user query. |
| 207 | supporting_docs: The supporting documents. |
| 208 | Returns: |
| 209 | The answer to the user query. |
| 210 | """ |
| 211 | system_prompt = \ |
| 212 | f""" |
| 213 | You are a helpful assistant. Answer the user query based on the supporting documents. |
| 214 | If you have not found the answer, say "Insufficient information." |
| 215 | """ |
| 216 | |
| 217 | user_prompt = f""" |
| 218 | |
| 219 | Here is the original user query and the supporting documents: |
| 220 | Original user query: {original_user_query} |
| 221 | Supporting documents: {supporting_docs} |
| 222 | Answer: |
| 223 | """ |
| 224 | create_params = { |
| 225 | "model": "gpt-4o-mini", |
| 226 | "messages": [ |
| 227 | {"role": "system", "content": system_prompt}, |
| 228 | {"role": "user", "content": user_prompt} |
| 229 | ], |
| 230 | "stream": False, |
| 231 | } |
| 232 | response = completion(**create_params) |
| 233 | answer = response.choices[0].message.content |
| 234 | |
| 235 | |
| 236 | return answer |
| 237 | |
| 238 | |
| 239 | @register_tool("can_answer") |
nothing calls this directly
no outgoing calls
no test coverage detected