You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/docs
Amos Ng 8baf6fb920
Update examples to fix execution problems (#685)
On the [Getting Started
page](https://langchain.readthedocs.io/en/latest/modules/prompts/getting_started.html)
for prompt templates, I believe the very last example

```python
print(dynamic_prompt.format(adjective=long_string))
```

should actually be

```python
print(dynamic_prompt.format(input=long_string))
```

The existing example produces `KeyError: 'input'` as expected

***

On the [Create a custom prompt
template](https://langchain.readthedocs.io/en/latest/modules/prompts/examples/custom_prompt_template.html#id1)
page, I believe the line

```python
Function Name: {kwargs["function_name"]}
```

should actually be

```python
Function Name: {kwargs["function_name"].__name__}
```

The existing example produces the prompt:

```
        Given the function name and source code, generate an English language explanation of the function.
        Function Name: <function get_source_code at 0x7f907bc0e0e0>
        Source Code:
        def get_source_code(function_name):
    # Get the source code of the function
    return inspect.getsource(function_name)

        Explanation:
```

***

On the [Example
Selectors](https://langchain.readthedocs.io/en/latest/modules/prompts/examples/example_selectors.html)
page, the first example does not define `example_prompt`, which is also
subtly different from previous example prompts used. For user
convenience, I suggest including

```python
example_prompt = PromptTemplate(
    input_variables=["input", "output"],
    template="Input: {input}\nOutput: {output}",
)
```

in the code to be copy-pasted
2 years ago
..
_static/css improve css (#615) 2 years ago
ecosystem docs: small typo on serpapi.md (#693) 2 years ago
getting_started Docs refactor (#480) 2 years ago
modules Update examples to fix execution problems (#685) 2 years ago
reference Harrison/wolfram alpha (#579) 2 years ago
use_cases feat: add custom prompt for QAEvalChain chain (#610) 2 years ago
Makefile Feature: linkcheck-action (#534) (#542) 2 years ago
conf.py improve css (#615) 2 years ago
deployments.md Harrison/deployments (#572) 2 years ago
ecosystem.rst Docs refactor (#480) 2 years ago
gallery.rst Add subsection for colab notebooks (#599) 2 years ago
glossary.md Feature: linkcheck-action (#534) (#542) 2 years ago
index.rst Harrison/deployments (#572) 2 years ago
make.bat initial commit 2 years ago
reference.rst Feature: linkcheck-action (#534) (#542) 2 years ago
requirements.txt Docs refactor (#480) 2 years ago