epist 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -15
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +12 -6
- package/dist/esm/index.js +12 -6
- package/package.json +1 -1
- package/src/index.ts +13 -6
package/README.md
CHANGED
|
@@ -1,33 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Epist JavaScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The official JavaScript/TypeScript client library for the [Epist.ai](https://epist.ai) Audio RAG Platform.
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
5
|
+
## 📦 Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install epist
|
|
9
|
+
# or
|
|
10
|
+
yarn add epist
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## 🚀 Quick Start
|
|
12
14
|
|
|
13
15
|
```typescript
|
|
14
16
|
import { Epist } from 'epist';
|
|
15
17
|
|
|
16
18
|
const client = new Epist({
|
|
17
|
-
|
|
18
|
-
// Optional: baseUrl: 'https://api.epist.ai/v1'
|
|
19
|
+
apiKey: process.env.EPIST_API_KEY,
|
|
19
20
|
});
|
|
20
21
|
|
|
21
|
-
// 1. Upload
|
|
22
|
-
const
|
|
23
|
-
console.log(
|
|
22
|
+
// 1. Upload and Transcribe
|
|
23
|
+
const audio = await client.uploadFile(file);
|
|
24
|
+
console.log(`Processing: ${audio.id}`);
|
|
24
25
|
|
|
25
|
-
// 2.
|
|
26
|
-
const
|
|
26
|
+
// 2. Semantic Search
|
|
27
|
+
const results = await client.search('What were the key takeaways?');
|
|
28
|
+
results.forEach(res => {
|
|
29
|
+
console.log(`[${res.timestamp}] ${res.text}`);
|
|
30
|
+
});
|
|
27
31
|
|
|
28
|
-
// 3.
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
console.log(`[${r.score}] ${r.text}`);
|
|
32
|
+
// 3. RAG Chat
|
|
33
|
+
const chat = await client.chat.completions.create({
|
|
34
|
+
messages: [{ role: 'user', content: 'Summarize the audio' }],
|
|
32
35
|
});
|
|
36
|
+
console.log(chat.choices[0].message.content);
|
|
33
37
|
```
|
|
38
|
+
|
|
39
|
+
## 📖 Documentation
|
|
40
|
+
|
|
41
|
+
For full API documentation and guides, visit [epist.ai/docs](https://epist.ai/docs).
|
|
42
|
+
|
|
43
|
+
## 🛡️ License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare class Epist {
|
|
|
46
46
|
/**
|
|
47
47
|
* Transcribe audio from a URL
|
|
48
48
|
*/
|
|
49
|
-
transcribeUrl(url: string, ragEnabled?: boolean, language?: string, preset?: string, chunkingConfig?: any): Promise<AudioStatus>;
|
|
49
|
+
transcribeUrl(url: string, ragEnabled?: boolean, language?: string, preset?: string, chunkingConfig?: any, webhookUrl?: string): Promise<AudioStatus>;
|
|
50
50
|
/**
|
|
51
51
|
* Get status of an audio task
|
|
52
52
|
*/
|
|
@@ -58,5 +58,5 @@ export declare class Epist {
|
|
|
58
58
|
/**
|
|
59
59
|
* Search the knowledge base
|
|
60
60
|
*/
|
|
61
|
-
search(query: string, limit?: number): Promise<SearchResult[]>;
|
|
61
|
+
search(query: string, limit?: number, options?: Record<string, any>): Promise<SearchResult[]>;
|
|
62
62
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -57,15 +57,19 @@ class Epist {
|
|
|
57
57
|
/**
|
|
58
58
|
* Transcribe audio from a URL
|
|
59
59
|
*/
|
|
60
|
-
async transcribeUrl(url, ragEnabled = true, language = 'en', preset = 'general', chunkingConfig = null) {
|
|
60
|
+
async transcribeUrl(url, ragEnabled = true, language = 'en', preset = 'general', chunkingConfig = null, webhookUrl) {
|
|
61
61
|
try {
|
|
62
|
-
const
|
|
62
|
+
const payload = {
|
|
63
63
|
audio_url: url,
|
|
64
64
|
rag_enabled: ragEnabled,
|
|
65
65
|
language,
|
|
66
66
|
preset,
|
|
67
67
|
chunking_config: chunkingConfig
|
|
68
|
-
}
|
|
68
|
+
};
|
|
69
|
+
if (webhookUrl) {
|
|
70
|
+
payload.webhook_url = webhookUrl;
|
|
71
|
+
}
|
|
72
|
+
const response = await this.client.post('/audio/transcribe_url', payload);
|
|
69
73
|
return response.data;
|
|
70
74
|
}
|
|
71
75
|
catch (error) {
|
|
@@ -102,12 +106,14 @@ class Epist {
|
|
|
102
106
|
/**
|
|
103
107
|
* Search the knowledge base
|
|
104
108
|
*/
|
|
105
|
-
async search(query, limit = 10) {
|
|
109
|
+
async search(query, limit = 10, options) {
|
|
106
110
|
try {
|
|
107
|
-
const
|
|
111
|
+
const payload = {
|
|
108
112
|
query,
|
|
109
113
|
limit,
|
|
110
|
-
|
|
114
|
+
...options
|
|
115
|
+
};
|
|
116
|
+
const response = await this.client.post('/search', payload);
|
|
111
117
|
return response.data;
|
|
112
118
|
}
|
|
113
119
|
catch (error) {
|
package/dist/esm/index.js
CHANGED
|
@@ -50,15 +50,19 @@ export class Epist {
|
|
|
50
50
|
/**
|
|
51
51
|
* Transcribe audio from a URL
|
|
52
52
|
*/
|
|
53
|
-
async transcribeUrl(url, ragEnabled = true, language = 'en', preset = 'general', chunkingConfig = null) {
|
|
53
|
+
async transcribeUrl(url, ragEnabled = true, language = 'en', preset = 'general', chunkingConfig = null, webhookUrl) {
|
|
54
54
|
try {
|
|
55
|
-
const
|
|
55
|
+
const payload = {
|
|
56
56
|
audio_url: url,
|
|
57
57
|
rag_enabled: ragEnabled,
|
|
58
58
|
language,
|
|
59
59
|
preset,
|
|
60
60
|
chunking_config: chunkingConfig
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
|
+
if (webhookUrl) {
|
|
63
|
+
payload.webhook_url = webhookUrl;
|
|
64
|
+
}
|
|
65
|
+
const response = await this.client.post('/audio/transcribe_url', payload);
|
|
62
66
|
return response.data;
|
|
63
67
|
}
|
|
64
68
|
catch (error) {
|
|
@@ -95,12 +99,14 @@ export class Epist {
|
|
|
95
99
|
/**
|
|
96
100
|
* Search the knowledge base
|
|
97
101
|
*/
|
|
98
|
-
async search(query, limit = 10) {
|
|
102
|
+
async search(query, limit = 10, options) {
|
|
99
103
|
try {
|
|
100
|
-
const
|
|
104
|
+
const payload = {
|
|
101
105
|
query,
|
|
102
106
|
limit,
|
|
103
|
-
|
|
107
|
+
...options
|
|
108
|
+
};
|
|
109
|
+
const response = await this.client.post('/search', payload);
|
|
104
110
|
return response.data;
|
|
105
111
|
}
|
|
106
112
|
catch (error) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -95,16 +95,21 @@ export class Epist {
|
|
|
95
95
|
ragEnabled: boolean = true,
|
|
96
96
|
language: string = 'en',
|
|
97
97
|
preset: string = 'general',
|
|
98
|
-
chunkingConfig: any = null
|
|
98
|
+
chunkingConfig: any = null,
|
|
99
|
+
webhookUrl?: string
|
|
99
100
|
): Promise<AudioStatus> {
|
|
100
101
|
try {
|
|
101
|
-
const
|
|
102
|
+
const payload: any = {
|
|
102
103
|
audio_url: url,
|
|
103
104
|
rag_enabled: ragEnabled,
|
|
104
105
|
language,
|
|
105
106
|
preset,
|
|
106
107
|
chunking_config: chunkingConfig
|
|
107
|
-
}
|
|
108
|
+
};
|
|
109
|
+
if (webhookUrl) {
|
|
110
|
+
payload.webhook_url = webhookUrl;
|
|
111
|
+
}
|
|
112
|
+
const response = await this.client.post('/audio/transcribe_url', payload);
|
|
108
113
|
return response.data;
|
|
109
114
|
} catch (error) {
|
|
110
115
|
this.handleError(error);
|
|
@@ -141,12 +146,14 @@ export class Epist {
|
|
|
141
146
|
/**
|
|
142
147
|
* Search the knowledge base
|
|
143
148
|
*/
|
|
144
|
-
async search(query: string, limit: number = 10): Promise<SearchResult[]> {
|
|
149
|
+
async search(query: string, limit: number = 10, options?: Record<string, any>): Promise<SearchResult[]> {
|
|
145
150
|
try {
|
|
146
|
-
const
|
|
151
|
+
const payload = {
|
|
147
152
|
query,
|
|
148
153
|
limit,
|
|
149
|
-
|
|
154
|
+
...options
|
|
155
|
+
};
|
|
156
|
+
const response = await this.client.post('/search', payload);
|
|
150
157
|
return response.data;
|
|
151
158
|
} catch (error) {
|
|
152
159
|
this.handleError(error);
|