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