mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-01 00:49:25 +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.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
question = "Were Scott Derrickson and Ed Wood of the same nationality?"
|
||||
answer = react.run(question)
|
||||
"""
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user