langchain/docs/modules
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
2023-01-22 14:49:25 -08:00
..
agents Harrison/load tools kwargs (#681) 2023-01-21 16:03:02 -08:00
chains Harrison/sql db chain (#641) 2023-01-17 22:32:28 -08:00
llms Fix the env variable for OpenAI Base Url (#639) 2023-01-17 22:30:29 -08:00
memory ConversationEntityMemory: Chain which uses an entity extraction & sum… (#678) 2023-01-22 10:10:02 -08:00
prompts Update examples to fix execution problems (#685) 2023-01-22 14:49:25 -08:00
utils Fix typo in hyde.ipynb (#688) 2023-01-22 08:21:31 -08:00
agents.rst Feature: linkcheck-action (#534) (#542) 2023-01-04 21:39:50 -08:00
chains.rst Feature: linkcheck-action (#534) (#542) 2023-01-04 21:39:50 -08:00
llms.rst Fix minor error in LLM documentation (#602) 2023-01-12 18:16:32 -08:00
memory.rst Feature: linkcheck-action (#534) (#542) 2023-01-04 21:39:50 -08:00
prompts.rst Feature: linkcheck-action (#534) (#542) 2023-01-04 21:39:50 -08:00
state_of_the_union.txt Docs refactor (#480) 2023-01-02 08:24:09 -08:00
utils.rst Feature: linkcheck-action (#534) (#542) 2023-01-04 21:39:50 -08:00