feat: add embedchain javascript package (#576)
This commit is contained in:
7
embedchain-js/embedchain/models/ChunkResult.ts
Normal file
7
embedchain-js/embedchain/models/ChunkResult.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Metadata } from './Metadata';
|
||||
|
||||
export type ChunkResult = {
|
||||
documents: string[];
|
||||
ids: string[];
|
||||
metadatas: Metadata[];
|
||||
};
|
||||
10
embedchain-js/embedchain/models/DataDict.ts
Normal file
10
embedchain-js/embedchain/models/DataDict.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { ChunkResult } from './ChunkResult';
|
||||
|
||||
type Data = {
|
||||
doc: ChunkResult['documents'][0];
|
||||
meta: ChunkResult['metadatas'][0];
|
||||
};
|
||||
|
||||
export type DataDict = {
|
||||
[id: string]: Data;
|
||||
};
|
||||
1
embedchain-js/embedchain/models/DataType.ts
Normal file
1
embedchain-js/embedchain/models/DataType.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type DataType = 'pdf_file' | 'web_page' | 'qna_pair';
|
||||
3
embedchain-js/embedchain/models/FormattedResult.ts
Normal file
3
embedchain-js/embedchain/models/FormattedResult.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Document } from 'langchain/document';
|
||||
|
||||
export type FormattedResult = [Document, number | null];
|
||||
7
embedchain-js/embedchain/models/Input.ts
Normal file
7
embedchain-js/embedchain/models/Input.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { QnaPair } from './QnAPair';
|
||||
|
||||
export type RemoteInput = string;
|
||||
|
||||
export type LocalInput = QnaPair;
|
||||
|
||||
export type Input = RemoteInput | LocalInput;
|
||||
3
embedchain-js/embedchain/models/LoaderResult.ts
Normal file
3
embedchain-js/embedchain/models/LoaderResult.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Metadata } from './Metadata';
|
||||
|
||||
export type LoaderResult = { content: any; metaData: Metadata }[];
|
||||
3
embedchain-js/embedchain/models/Metadata.ts
Normal file
3
embedchain-js/embedchain/models/Metadata.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export type Metadata = {
|
||||
url: string;
|
||||
};
|
||||
1
embedchain-js/embedchain/models/Method.ts
Normal file
1
embedchain-js/embedchain/models/Method.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type Method = 'init' | 'query' | 'add' | 'add_local';
|
||||
4
embedchain-js/embedchain/models/QnAPair.ts
Normal file
4
embedchain-js/embedchain/models/QnAPair.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
type Question = string;
|
||||
type Answer = string;
|
||||
|
||||
export type QnaPair = [Question, Answer];
|
||||
21
embedchain-js/embedchain/models/index.ts
Normal file
21
embedchain-js/embedchain/models/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { DataDict } from './DataDict';
|
||||
import { DataType } from './DataType';
|
||||
import { FormattedResult } from './FormattedResult';
|
||||
import { Input, LocalInput, RemoteInput } from './Input';
|
||||
import { LoaderResult } from './LoaderResult';
|
||||
import { Metadata } from './Metadata';
|
||||
import { Method } from './Method';
|
||||
import { QnaPair } from './QnAPair';
|
||||
|
||||
export {
|
||||
DataDict,
|
||||
DataType,
|
||||
FormattedResult,
|
||||
Input,
|
||||
LoaderResult,
|
||||
LocalInput,
|
||||
Metadata,
|
||||
Method,
|
||||
QnaPair,
|
||||
RemoteInput,
|
||||
};
|
||||
Reference in New Issue
Block a user