mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 06:40:04 +00:00
stash
This commit is contained in:
parent
a408ed3ea3
commit
c09fe1dfdf
@ -26,6 +26,20 @@ def check_valid_template(
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise ValueError("Invalid prompt schema.")
|
raise ValueError("Invalid prompt schema.")
|
||||||
|
|
||||||
|
class OutputParser(ABC):
|
||||||
|
"""Class to parse the output of an LLM call."""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def parse(self, text: str) -> Union[str, List[str], Dict[str, str]]:
|
||||||
|
"""Parse the output of an LLM call."""
|
||||||
|
|
||||||
|
|
||||||
|
class DefaultParser(OutputParser):
|
||||||
|
"""Just return the text."""
|
||||||
|
|
||||||
|
def parse(self, text: str) -> Union[str, List[str], Dict[str, str]]:
|
||||||
|
"""Parse the output of an LLM call."""
|
||||||
|
return text
|
||||||
|
|
||||||
class BasePromptTemplate(ABC):
|
class BasePromptTemplate(ABC):
|
||||||
"""Base prompt should expose the format method, returning a prompt."""
|
"""Base prompt should expose the format method, returning a prompt."""
|
||||||
|
Loading…
Reference in New Issue
Block a user