docs: fix PromptGuard docs (#9659)

Fix PromptGuard docs. Noticed several trivial issues on the docs when
integrating the new class.
cc @baskaryan
This commit is contained in:
Zizhong Zhang 2023-08-23 10:04:53 -07:00 committed by GitHub
parent f0ae10a20e
commit 8a03836160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@
"\n", "\n",
"# Set API keys\n", "# Set API keys\n",
"\n", "\n",
"os.environ['PROMPT_GUARD_API_KEY'] = \"<PROMPT_GUARD_API_KEY>\"\n", "os.environ['PROMPTGUARD_API_KEY'] = \"<PROMPTGUARD_API_KEY>\"\n",
"os.environ['OPENAI_API_KEY'] = \"<OPENAI_API_KEY>\"" "os.environ['OPENAI_API_KEY'] = \"<OPENAI_API_KEY>\""
] ]
}, },
@ -47,9 +47,9 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Use PromptGuardLLMWrapper\n", "# Use PromptGuard LLM Wrapper\n",
"\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.llms import OpenAI\n",
"from langchain.memory import ConversationBufferWindowMemory\n", "from langchain.memory import ConversationBufferWindowMemory\n",
"\n", "\n",
"from langchain.llms import PromptGuardLLMWrapper\n", "from langchain.llms import PromptGuard\n",
"\n", "\n",
"langchain.verbose = True\n", "langchain.verbose = True\n",
"langchain.debug = True\n", "langchain.debug = True\n",
@ -106,7 +106,7 @@
"\n", "\n",
"chain = LLMChain(\n", "chain = LLMChain(\n",
" prompt=PromptTemplate.from_template(prompt_template),\n", " prompt=PromptTemplate.from_template(prompt_template),\n",
" llm=PromptGuardLLMWrapper(llm=OpenAI()),\n", " llm=PromptGuard(base_llm=OpenAI()),\n",
" memory=ConversationBufferWindowMemory(k=2),\n", " memory=ConversationBufferWindowMemory(k=2),\n",
" verbose=True,\n", " verbose=True,\n",
")\n", ")\n",

View File

@ -23,10 +23,10 @@ class PromptGuard(LLM):
Example: Example:
.. code-block:: python .. code-block:: python
from langchain.llms import PromptGuardLLM from langchain.llms import PromptGuard
from langchain.chat_models import ChatOpenAI from langchain.chat_models import ChatOpenAI
prompt_guard_llm = PromptGuardLLM(base_llm=ChatOpenAI()) prompt_guard_llm = PromptGuard(base_llm=ChatOpenAI())
""" """
base_llm: BaseLanguageModel base_llm: BaseLanguageModel