mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 13:00:34 +00:00
Improve docs (#51)
This commit is contained in:
parent
e982cf4b2e
commit
d3c1872902
@ -115,8 +115,8 @@ class ReActChain(Chain, BaseModel):
|
|||||||
Final answer from thinking through the ReAct framework.
|
Final answer from thinking through the ReAct framework.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
question = "Were Scott Derrickson and Ed Wood of the same nationality?"
|
question = "Were Scott Derrickson and Ed Wood of the same nationality?"
|
||||||
answer = react.run(question)
|
answer = react.run(question)
|
||||||
"""
|
"""
|
||||||
|
@ -21,8 +21,8 @@ class HuggingFaceHub(BaseModel, LLM):
|
|||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain import HuggingFace
|
from langchain import HuggingFaceHub
|
||||||
hf = HuggingFace(model="text-davinci-002")
|
hf = HuggingFaceHub(repo_id="gpt2")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
client: Any #: :meta private:
|
client: Any #: :meta private:
|
||||||
|
@ -80,7 +80,24 @@ class Prompt(BaseModel):
|
|||||||
example_separator: str = "\n\n",
|
example_separator: str = "\n\n",
|
||||||
prefix: str = "",
|
prefix: str = "",
|
||||||
) -> "Prompt":
|
) -> "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)
|
example_str = example_separator.join(examples)
|
||||||
template = prefix + example_str + suffix
|
template = prefix + example_str + suffix
|
||||||
return cls(input_variables=input_variables, template=template)
|
return cls(input_variables=input_variables, template=template)
|
||||||
|
Loading…
Reference in New Issue
Block a user