Package com.hw.langchain.schema
Class BaseOutputParser<T>
java.lang.Object
com.hw.langchain.schema.BaseLLMOutputParser<T>
com.hw.langchain.schema.BaseOutputParser<T>
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AgentOutputParser
,ListOutputParser
,NoOpOutputParser
,StructuredOutputParser
,StructuredQueryOutputParser
Class to parse the output of an LLM call.
Output parsers help structure language model responses.
- Author:
- HamaWhite
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionInstructions on how the LLM output should be formatted.abstract T
Parse the output of an LLM call.parseResult
(List<? extends Generation> result) Parse LLM Result.parseWithPrompt
(String completion, PromptValue prompt) Optional method to parse the output of an LLM call with a prompt.
-
Constructor Details
-
BaseOutputParser
public BaseOutputParser()
-
-
Method Details
-
parseResult
Description copied from class:BaseLLMOutputParser
Parse LLM Result.- Specified by:
parseResult
in classBaseLLMOutputParser<T>
-
parse
Parse the output of an LLM call. A method which takes in a string (assumed output of a language model) and parses it into some structure.- Parameters:
text
- output of language model- Returns:
- structured output
-
parseWithPrompt
Optional method to parse the output of an LLM call with a prompt. The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so.- Parameters:
completion
- output of language modelprompt
- prompt value- Returns:
- structured output
-
getFormatInstructions
Instructions on how the LLM output should be formatted.- Returns:
- format instructions
-