mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-03 02:06:33 +00:00
bump version to 106 (#1562)
This commit is contained in:
parent
a094c49153
commit
bd335ffd64
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "df770c72",
|
"id": "df770c72",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -9,65 +8,9 @@
|
|||||||
"# YouTube\n",
|
"# YouTube\n",
|
||||||
"\n",
|
"\n",
|
||||||
"How to load documents from YouTube transcripts.\n",
|
"How to load documents from YouTube transcripts.\n",
|
||||||
"\n",
|
"\n"
|
||||||
"\n",
|
|
||||||
"## Prerequisites\n",
|
|
||||||
"\n",
|
|
||||||
"1. Create a Google Cloud project or use an existing project\n",
|
|
||||||
"1. Enable the [Youtube Api](https://console.cloud.google.com/apis/enableflow?apiid=youtube.googleapis.com&project=sixth-grammar-344520)\n",
|
|
||||||
"1. [Authorize credentials for desktop app](https://developers.google.com/drive/api/quickstart/python#authorize_credentials_for_a_desktop_application)\n",
|
|
||||||
"1. `pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib youtube-transcript-api`\n",
|
|
||||||
"\n",
|
|
||||||
"## 🧑 Instructions for ingesting your Google Docs data\n",
|
|
||||||
"By default, the `GoogleDriveLoader` expects the `credentials.json` file to be `~/.credentials/credentials.json`, but this is configurable using the `credentials_file` keyword argument. Same thing with `token.json`. Note that `token.json` will be created automatically the first time you use the loader.\n",
|
|
||||||
"\n",
|
|
||||||
"`GoogleApiYoutubeLoader` can load from a list of Google Docs document ids or a folder id. You can obtain your folder and document id from the URL:\n",
|
|
||||||
"Note depending on your set up, the `service_account_path` needs to be set up. See [here](https://developers.google.com/drive/api/v3/quickstart/python) for more details."
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "da4a867f",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"from langchain.document_loaders import GoogleApiClient, GoogleApiYoutubeLoader"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "3994986e",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"# Init the GoogleApiClient \n",
|
|
||||||
"from pathlib import Path\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"google_api_client = GoogleApiClient(credentials_path=Path(\"your_path_creds.json\"))\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"# Use a Channel\n",
|
|
||||||
"youtube_loader_channel = GoogleApiYoutubeLoader(google_api_client=google_api_client, channel_name=\"Reducible\",captions_language=\"en\")\n",
|
|
||||||
"\n",
|
|
||||||
"# Use Youtube Ids\n",
|
|
||||||
"\n",
|
|
||||||
"youtube_loader_ids = GoogleApiYoutubeLoader(google_api_client=google_api_client, video_ids=[\"TrdevFK_am4\"], add_video_info=True)\n",
|
|
||||||
"\n",
|
|
||||||
"# returns a list of Documents\n",
|
|
||||||
"youtube_loader_channel.load()\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "507506db",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@ -147,11 +90,59 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"loader.load()"
|
"loader.load()"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "65796cc5",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## YouTube loader from Google Cloud\n",
|
||||||
|
"\n",
|
||||||
|
"### Prerequisites\n",
|
||||||
|
"\n",
|
||||||
|
"1. Create a Google Cloud project or use an existing project\n",
|
||||||
|
"1. Enable the [Youtube Api](https://console.cloud.google.com/apis/enableflow?apiid=youtube.googleapis.com&project=sixth-grammar-344520)\n",
|
||||||
|
"1. [Authorize credentials for desktop app](https://developers.google.com/drive/api/quickstart/python#authorize_credentials_for_a_desktop_application)\n",
|
||||||
|
"1. `pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib youtube-transcript-api`\n",
|
||||||
|
"\n",
|
||||||
|
"### 🧑 Instructions for ingesting your Google Docs data\n",
|
||||||
|
"By default, the `GoogleDriveLoader` expects the `credentials.json` file to be `~/.credentials/credentials.json`, but this is configurable using the `credentials_file` keyword argument. Same thing with `token.json`. Note that `token.json` will be created automatically the first time you use the loader.\n",
|
||||||
|
"\n",
|
||||||
|
"`GoogleApiYoutubeLoader` can load from a list of Google Docs document ids or a folder id. You can obtain your folder and document id from the URL:\n",
|
||||||
|
"Note depending on your set up, the `service_account_path` needs to be set up. See [here](https://developers.google.com/drive/api/v3/quickstart/python) for more details."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c345bc43",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from langchain.document_loaders import GoogleApiClient, GoogleApiYoutubeLoader\n",
|
||||||
|
"\n",
|
||||||
|
"# Init the GoogleApiClient \n",
|
||||||
|
"from pathlib import Path\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"google_api_client = GoogleApiClient(credentials_path=Path(\"your_path_creds.json\"))\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"# Use a Channel\n",
|
||||||
|
"youtube_loader_channel = GoogleApiYoutubeLoader(google_api_client=google_api_client, channel_name=\"Reducible\",captions_language=\"en\")\n",
|
||||||
|
"\n",
|
||||||
|
"# Use Youtube Ids\n",
|
||||||
|
"\n",
|
||||||
|
"youtube_loader_ids = GoogleApiYoutubeLoader(google_api_client=google_api_client, video_ids=[\"TrdevFK_am4\"], add_video_info=True)\n",
|
||||||
|
"\n",
|
||||||
|
"# returns a list of Documents\n",
|
||||||
|
"youtube_loader_channel.load()"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": ".venv",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -165,7 +156,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.6"
|
"version": "3.9.1"
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "langchain"
|
name = "langchain"
|
||||||
version = "0.0.105"
|
version = "0.0.106"
|
||||||
description = "Building applications with LLMs through composability"
|
description = "Building applications with LLMs through composability"
|
||||||
authors = []
|
authors = []
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
Loading…
Reference in New Issue
Block a user