MCPcopy
hub / github.com/SqueezeAILab/LLMCompiler / predict_and_parse

Method predict_and_parse

src/chains/llm_chain.py:324–336  ·  view source on GitHub ↗

Call predict and then parse the results.

(
        self, callbacks: Callbacks = None, **kwargs: Any
    )

Source from the content-addressed store, hash-verified

322 return (await self.acall(kwargs, callbacks=callbacks))[self.output_key]
323
324 def predict_and_parse(
325 self, callbacks: Callbacks = None, **kwargs: Any
326 ) -> Union[str, List[str], Dict[str, Any]]:
327 """Call predict and then parse the results."""
328 warnings.warn(
329 "The predict_and_parse method is deprecated, "
330 "instead pass an output parser directly to LLMChain."
331 )
332 result = self.predict(callbacks=callbacks, **kwargs)
333 if self.prompt.output_parser is not None:
334 return self.prompt.output_parser.parse(result)
335 else:
336 return result
337
338 async def apredict_and_parse(
339 self, callbacks: Callbacks = None, **kwargs: Any

Callers

nothing calls this directly

Calls 2

predictMethod · 0.95
parseMethod · 0.45

Tested by

no test coverage detected