-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tools): migrate to TypeScript and enhance build configuration
- Converted project to TypeScript with `.ts` file extensions - Updated `tsconfig.json` with improved TypeScript configuration - Modified `rollup.config.mjs` to support TypeScript compilation - Added TypeScript and related dependencies in `package.json` - Updated package exports to include type definitions - Migrated tool story files to use TypeScript imports - Configured TypeScript compilation for individual tools and main package
- Loading branch information
1 parent
f495a7b
commit 32b883a
Showing
49 changed files
with
3,636 additions
and
140 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 10 additions & 5 deletions
15
...src/_utils/rag/loaders/textInputLoader.js → ...tils/rag/loaders/textInputLoader/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import { BaseDocumentLoader } from '@langchain/core/document_loaders/base'; | ||
import { Document as BaseDocument } from 'langchain/document'; | ||
|
||
class TextInputLoader extends BaseDocumentLoader { | ||
constructor(text, metadata = {}) { | ||
interface TextInputMetadata { | ||
[key: string]: any; | ||
} | ||
|
||
export class TextInputLoader extends BaseDocumentLoader { | ||
private text: string; | ||
private metadata: TextInputMetadata; | ||
|
||
constructor(text: string, metadata: TextInputMetadata = {}) { | ||
super(); | ||
this.text = text; | ||
this.metadata = metadata; | ||
} | ||
|
||
async load() { | ||
async load(): Promise<BaseDocument[]> { | ||
const document = new BaseDocument({ | ||
pageContent: this.text, | ||
metadata: this.metadata, | ||
}); | ||
return [document]; | ||
} | ||
} | ||
|
||
export { TextInputLoader }; |
Oops, something went wrong.