Test directly using `llm_response` method of DocChatAgent.
(test_settings: Settings, agent, query: str, expected: str)
| 208 | ) |
| 209 | @pytest.mark.parametrize("query, expected", QUERY_EXPECTED_PAIRS) |
| 210 | def test_doc_chat_agent_llm(test_settings: Settings, agent, query: str, expected: str): |
| 211 | """ |
| 212 | Test directly using `llm_response` method of DocChatAgent. |
| 213 | """ |
| 214 | |
| 215 | # note that the (query, ans) pairs are accumulated into the |
| 216 | # internal dialog history of the agent. |
| 217 | set_global(test_settings) |
| 218 | agent.config.conversation_mode = False |
| 219 | result = agent.llm_response(query) |
| 220 | ans = result.content |
| 221 | refs = extract_markdown_references(ans) |
| 222 | sources = extract_markdown_references(result.metadata.source) |
| 223 | assert refs == sources |
| 224 | expected = [e.strip() for e in expected.split(",")] |
| 225 | assert all([e in ans for e in expected]) |
| 226 | |
| 227 | |
| 228 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected
searching dependent graphs…