From 2ffc643086960420a9e502d5678e9168e687edce Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Tue, 21 Mar 2023 09:29:34 -0700 Subject: [PATCH] add listen api docs (#1855) --- docs/modules/chains/examples/api.ipynb | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/modules/chains/examples/api.ipynb b/docs/modules/chains/examples/api.ipynb index 4f141b8fdc..0dd006262b 100644 --- a/docs/modules/chains/examples/api.ipynb +++ b/docs/modules/chains/examples/api.ipynb @@ -149,6 +149,33 @@ "chain.run(\"Search for 'Avatar'\")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Listen API Example" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from langchain.llms import OpenAI\n", + "from langchain.chains.api import podcast_docs\n", + "from langchain.chains import APIChain\n", + "\n", + "# Get api key here: https://www.listennotes.com/api/pricing/\n", + "listen_api_key = 'xxx'\n", + "\n", + "llm = OpenAI(temperature=0)\n", + "headers = {\"X-ListenAPI-Key\": listen_api_key}\n", + "chain = APIChain.from_llm_and_api_docs(llm, podcast_docs.PODCAST_DOCS, headers=headers, verbose=True)\n", + "chain.run(\"Search for 'silicon valley bank' podcast episodes, audio length is more than 30 minutes, return only 1 results\")\n" + ] + }, { "cell_type": "code", "execution_count": null, @@ -173,7 +200,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.9.1" } }, "nbformat": 4,