Skip to content

Commit d870a41

Browse files
authored
errata
1 parent d0f473d commit d870a41

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,39 @@ This repo is a companion to the [Build AI-Powered Apps with OpenAI and Node.js][
1010
## Materials
1111

1212
- [Course Notes](https://scottmoss.notion.site/AI-App-Node-js-f9a372a138ef4241943b4fbb44bdc970?pvs=4)
13+
14+
15+
## Errata
16+
17+
**Document QA Query Function Lesson**
18+
19+
A few of the Langchain methods used in this course have been deprecated. Here's an alternative approach:
20+
21+
Install the Langchain community module
22+
23+
```bash
24+
npm i @langchain/community
25+
````
26+
27+
Import the loaders
28+
29+
```javascript
30+
import { PDFLoader } from '@langchain/community/document_loaders/fs/pdf'
31+
import { YoutubeLoader } from '@langchain/community/document_loaders/web/youtube'
32+
```
33+
34+
Create the loaders using the community methods:
35+
36+
In `docsFromYTVideo`:
37+
38+
```javascript
39+
const loader = YoutubeLoader.createFromUrl(video, { language: 'en', addVideoInfo: true, })
40+
return loader.load( new CharacterTextSplitter({ separator: ' ', chunkSize: 2500, chunkOverlap: 200, }) )
41+
```
42+
43+
In `docsFromPDF`:
44+
45+
```javascript
46+
const docsFromPDF = async () => { const loader = new PDFLoader('./xbox.pdf')
47+
return loader.load( new CharacterTextSplitter({ separator: ' ', chunkSize: 2500, chunkOverlap: 200, }) ) }
48+
```

0 commit comments

Comments
 (0)