The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Update examples to fix execution problems (#685)
Amos Ng8baf6fb9207d
diff --git a/docs/modules/prompts/examples/custom_prompt_template.md b/docs/modules/prompts/examples/custom_prompt_template.mdindex f50786c341..c3358eb004 100644--- a/docs/modules/prompts/examples/custom_prompt_template.md+++ b/docs/modules/prompts/examples/custom_prompt_template.md@@ -54,7 +54,7 @@ class FunctionExplainerPromptTemplate(BasePromptTemplate, BaseModel):# Generate the prompt to be sent to the language modelprompt = f"""Given the function name and source code, generate an English language explanation of the function.- Function Name: {kwargs["function_name"]}+ Function Name: {kwargs["function_name"].__name__}Source Code:{source_code}Explanation:diff --git a/docs/modules/prompts/examples/example_selectors.ipynb b/docs/modules/prompts/examples/example_selectors.ipynbindex 401bfb5340..f755920d0c 100644--- a/docs/modules/prompts/examples/example_selectors.ipynb+++ b/docs/modules/prompts/examples/example_selectors.ipynb@@ -48,6 +48,7 @@"metadata": {},"outputs": [],"source": [+ "from langchain.prompts import PromptTemplate\n","from langchain.prompts.example_selector import LengthBasedExampleSelector"]},@@ -75,6 +76,10 @@"metadata": {},"outputs": [],"source": [+ "example_prompt = PromptTemplate(\n",+ " input_variables=[\"input\", \"output\"],\n",+ " template=\"Input: {input}\\nOutput: {output}\",\n",+ ")\n","example_selector = LengthBasedExampleSelector(\n"," # These are the examples is has available to choose from.\n"," examples=examples, \n",diff --git a/docs/modules/prompts/getting_started.md b/docs/modules/prompts/getting_started.mdindex c9bbd118ea..0330e7c89b 100644--- a/docs/modules/prompts/getting_started.md+++ b/docs/modules/prompts/getting_started.md@@ -211,7 +211,7 @@ In contrast, if we provide a very long input, the `LengthBasedExampleSelector` w```pythonlong_string = "big and huge and massive and large and gigantic and tall and much much much much much bigger than everything else"-print(dynamic_prompt.format(adjective=long_string))+print(dynamic_prompt.format(input=long_string))# -> Give the antonym of every input# -> Word: happy