Source code for langchain.schema.prompt

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import List

from langchain.load.serializable import Serializable
from langchain.schema.messages import BaseMessage


[docs]class PromptValue(Serializable, ABC): """Base abstract class for inputs to any language model. PromptValues can be converted to both LLM (pure text-generation) inputs and ChatModel inputs. """
[docs] @abstractmethod def to_string(self) -> str: """Return prompt value as string."""
[docs] @abstractmethod def to_messages(self) -> List[BaseMessage]: """Return prompt as a list of Messages."""