MCPcopy
hub / github.com/LazyAGI/LazyLLM / test_rag

Method test_rag

tests/advanced_tests/test_example.py:100–121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

98 assert len(res) >= 1024
99
100 def test_rag(self):
101 from examples.rag import ppl
102 rag = lazyllm.ActionModule(ppl)
103 rag.start()
104 query = '何为天道?'
105 res = rag(query)
106 assert type(res) is str
107 assert '天道' in res
108 assert len(res) >= 16
109
110 # test rag warpped in web
111 _, client = self.warp_into_web(rag)
112 chat_history = [[query, None]]
113 ans = client.predict(self.use_context,
114 chat_history,
115 self.stream_output,
116 self.append_text,
117 api_name='/_respond_stream')
118 res = ans[0][-1][-1]
119 assert type(res) is str
120 assert '天道' in res
121 assert len(res) >= 16
122
123 def test_painting(self):
124 from examples.painting import ppl

Callers

nothing calls this directly

Calls 3

warp_into_webMethod · 0.95
ragFunction · 0.85
startMethod · 0.45

Tested by

no test coverage detected