MCPcopy
hub / github.com/langroid/langroid / _response_async

Method _response_async

langroid/language_models/mock_lm.py:58–75  ·  view source on GitHub ↗
(self, msg: str)

Source from the content-addressed store, hash-verified

56 )
57
58 async def _response_async(self, msg: str) -> LLMResponse:
59 # response is based on this fallback order:
60 # - response_dict
61 # - response_fn_async
62 # - response_fn
63 # - default_response
64 if self.config.response_fn_async is not None:
65 response = await self.config.response_fn_async(msg)
66 else:
67 response = self.config.response_fn(msg)
68
69 mapped_response = self.config.response_dict.get(
70 msg, response or self.config.default_response
71 )
72 return lm.LLMResponse(
73 message=to_string(mapped_response),
74 cached=False,
75 )
76
77 def chat(
78 self,

Callers 2

achatMethod · 0.95
agenerateMethod · 0.95

Calls 2

to_stringFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected