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

Method warp_into_web

tests/advanced_tests/test_example.py:38–60  ·  view source on GitHub ↗
(self, module)

Source from the content-addressed store, hash-verified

36 cleanup()
37
38 def warp_into_web(self, module):
39 client = None
40 for _ in range(5):
41 try:
42 port = random.randint(10000, 30000)
43 web = lazyllm.WebModule(module, port=port)
44 web._work()
45 time.sleep(2)
46 except AssertionError as e:
47 # Port is occupied
48 if 'occupied' in e:
49 continue
50 else:
51 raise e
52 try:
53 client = Client(web.url, download_files=web.cach_path)
54 break
55 except httpx.ConnectError:
56 continue
57 assert client, 'Unable to create client'
58 self.webs.append(web)
59 self.clients.append(client)
60 return web, client
61
62 def test_chat(self):
63 from examples.chatbot import chat

Callers 4

test_chatMethod · 0.95
test_storyMethod · 0.95
test_ragMethod · 0.95
test_paintingMethod · 0.95

Calls 2

_workMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected