Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples to fix execution problems #685

Merged
merged 1 commit into from Jan 22, 2023

Conversation

amosjyng
Copy link
Contributor

On the Getting Started page for prompt templates, I believe the very last example

print(dynamic_prompt.format(adjective=long_string))

should actually be

print(dynamic_prompt.format(input=long_string))

The existing example produces KeyError: 'input' as expected


On the Create a custom prompt template page, I believe the line

Function Name: {kwargs["function_name"]}

should actually be

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 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

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

in the code to be copy-pasted

@hwchase17
Copy link
Contributor

thank you!

@hwchase17 hwchase17 merged commit 8baf6fb into langchain-ai:master Jan 22, 2023
@amosjyng amosjyng deleted the docs branch January 22, 2023 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants