diff --git a/langchain/chains/react/base.py b/langchain/chains/react/base.py index e4fb3a64..5292f87e 100644 --- a/langchain/chains/react/base.py +++ b/langchain/chains/react/base.py @@ -115,8 +115,8 @@ class ReActChain(Chain, BaseModel): Final answer from thinking through the ReAct framework. Example: - .. code-block:: python + question = "Were Scott Derrickson and Ed Wood of the same nationality?" answer = react.run(question) """ diff --git a/langchain/llms/huggingface_hub.py b/langchain/llms/huggingface_hub.py index 0f73e61e..37e5a53c 100644 --- a/langchain/llms/huggingface_hub.py +++ b/langchain/llms/huggingface_hub.py @@ -21,8 +21,8 @@ class HuggingFaceHub(BaseModel, LLM): Example: .. code-block:: python - from langchain import HuggingFace - hf = HuggingFace(model="text-davinci-002") + from langchain import HuggingFaceHub + hf = HuggingFaceHub(repo_id="gpt2") """ client: Any #: :meta private: diff --git a/langchain/prompt.py b/langchain/prompt.py index 8ad5a493..a3512ed8 100644 --- a/langchain/prompt.py +++ b/langchain/prompt.py @@ -80,7 +80,24 @@ class Prompt(BaseModel): example_separator: str = "\n\n", prefix: str = "", ) -> "Prompt": - """Take examples in list format with prefix and suffix to create a prompt.""" + """Take examples in list format with prefix and suffix to create a prompt. + + Intended be used as a way to dynamically create a prompt from examples. + + Args: + examples: List of examples to use in the prompt. + suffix: String to go after the list of examples. Should generally + set up the user's input. + input_variables: A list of variable names the final prompt template + will expect. + example_separator: The seperator to use in between examples. Defaults + to two new line characters. + prefix: String that should go before any examples. Generally includes + examples. Default to an empty string. + + Returns: + The final prompt generated. + """ example_str = example_separator.join(examples) template = prefix + example_str + suffix return cls(input_variables=input_variables, template=template)