From 8a03836160194e4a3deb5993d7a888e70aacf0cf Mon Sep 17 00:00:00 2001 From: Zizhong Zhang Date: Wed, 23 Aug 2023 10:04:53 -0700 Subject: [PATCH] docs: fix PromptGuard docs (#9659) Fix PromptGuard docs. Noticed several trivial issues on the docs when integrating the new class. cc @baskaryan --- docs/extras/integrations/llms/promptguard.ipynb | 10 +++++----- libs/langchain/langchain/llms/promptguard.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/extras/integrations/llms/promptguard.ipynb b/docs/extras/integrations/llms/promptguard.ipynb index 7cc447bbf4..f93244ecad 100644 --- a/docs/extras/integrations/llms/promptguard.ipynb +++ b/docs/extras/integrations/llms/promptguard.ipynb @@ -39,7 +39,7 @@ "\n", "# Set API keys\n", "\n", - "os.environ['PROMPT_GUARD_API_KEY'] = \"\"\n", + "os.environ['PROMPTGUARD_API_KEY'] = \"\"\n", "os.environ['OPENAI_API_KEY'] = \"\"" ] }, @@ -47,9 +47,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Use PromptGuardLLMWrapper\n", + "# Use PromptGuard LLM Wrapper\n", "\n", - "Applying promptguard to your application could be as simple as wrapping your LLM using the PromptGuardLLMWrapper class by replace `llm=OpenAI()` with `llm=PromptGuardLLMWrapper(OpenAI())`." + "Applying promptguard to your application could be as simple as wrapping your LLM using the PromptGuard class by replace `llm=OpenAI()` with `llm=PromptGuard(base_llm=OpenAI())`." ] }, { @@ -64,7 +64,7 @@ "from langchain.llms import OpenAI\n", "from langchain.memory import ConversationBufferWindowMemory\n", "\n", - "from langchain.llms import PromptGuardLLMWrapper\n", + "from langchain.llms import PromptGuard\n", "\n", "langchain.verbose = True\n", "langchain.debug = True\n", @@ -106,7 +106,7 @@ "\n", "chain = LLMChain(\n", " prompt=PromptTemplate.from_template(prompt_template),\n", - " llm=PromptGuardLLMWrapper(llm=OpenAI()),\n", + " llm=PromptGuard(base_llm=OpenAI()),\n", " memory=ConversationBufferWindowMemory(k=2),\n", " verbose=True,\n", ")\n", diff --git a/libs/langchain/langchain/llms/promptguard.py b/libs/langchain/langchain/llms/promptguard.py index a6e8597465..9f99ff4019 100644 --- a/libs/langchain/langchain/llms/promptguard.py +++ b/libs/langchain/langchain/llms/promptguard.py @@ -23,10 +23,10 @@ class PromptGuard(LLM): Example: .. code-block:: python - from langchain.llms import PromptGuardLLM + from langchain.llms import PromptGuard from langchain.chat_models import ChatOpenAI - prompt_guard_llm = PromptGuardLLM(base_llm=ChatOpenAI()) + prompt_guard_llm = PromptGuard(base_llm=ChatOpenAI()) """ base_llm: BaseLanguageModel