https://github.com/frontendmasters/ai-nodejs
https://github.com/frontendmasters/ai-nodejs
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/frontendmasters/ai-nodejs
- Owner: FrontendMasters
- Created: 2023-10-24T01:15:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-18T14:46:35.000Z (6 months ago)
- Last Synced: 2025-03-29T16:03:37.371Z (3 months ago)
- Language: JavaScript
- Size: 216 KB
- Stars: 93
- Watchers: 9
- Forks: 40
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Build AI-Powered Apps with OpenAI and Node.js
This repo is a companion to the [Build AI-Powered Apps with OpenAI and Node.js][course] course on Frontend Masters.
[][course]
[fem]: https://www.frontendmasters.com
[course]: https://frontendmasters.com/courses/openai-node/## Materials
- [Course Notes](https://scottmoss.notion.site/AI-App-Node-js-f9a372a138ef4241943b4fbb44bdc970?pvs=4)
## Errata
**Document QA Query Function Lesson**
A few of the Langchain methods used in this course have been deprecated. Here's an alternative approach:
Install the Langchain community module
```bash
npm i @langchain/community
````Import the loaders
```javascript
import { PDFLoader } from '@langchain/community/document_loaders/fs/pdf'
import { YoutubeLoader } from '@langchain/community/document_loaders/web/youtube'
import { CharacterTextSplitter } from 'langchain/text_splitter'
```Create the loaders using the community methods:
In `docsFromYTVideo`:
```javascript
const loader = YoutubeLoader.createFromUrl(video, { language: 'en', addVideoInfo: true, })
const loadedDoc = await loader.load()
const splitter = new CharacterTextSplitter({
separator: ' ',
chunkSize: 2500,
chunkOverlap: 200,
})
return await splitter.splitDocuments(loadedDoc)
```In `docsFromPDF`:
```javascript
const docsFromPDF = async () => { const loader = new PDFLoader('./xbox.pdf')
const loadedDoc = await loader.load()
const splitter = new CharacterTextSplitter({
separator: '. ',
chunkSize: 2500,
chunkOverlap: 200,
})
return await splitter.splitDocuments(loadedDoc)
```