MCPcopy
hub / github.com/langroid/langroid / test_doc_chat_agent_llm

Function test_doc_chat_agent_llm

tests/main/test_doc_chat_agent.py:210–225  ·  view source on GitHub ↗

Test directly using `llm_response` method of DocChatAgent.

(test_settings: Settings, agent, query: str, expected: str)

Source from the content-addressed store, hash-verified

208)
209@pytest.mark.parametrize("query, expected", QUERY_EXPECTED_PAIRS)
210def 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(

Callers

nothing calls this directly

Calls 4

set_globalFunction · 0.90
llm_responseMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…