@ever-works/openai-plugin 1.0.0 → 1.0.3
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/dist/index.cjs +5896 -0
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +5871 -0
- package/package.json +77 -67
- package/LICENSE +0 -661
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseAiProvider } from '@ever-works/plugin/abstract';
|
|
2
|
+
import { JsonSchema, PluginContext, ChatCompletionOptions, ChatCompletionResponse, ChatCompletionChunk, EmbeddingOptions, EmbeddingResponse, TranscriptionOptions, TranscriptionResponse, PluginSettings, AiModel, AiModelCapabilities, PluginHealthCheck, PluginManifest } from '@ever-works/plugin';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* OpenAI AI provider plugin
|
|
6
|
+
*
|
|
7
|
+
* Provides AI capabilities through OpenAI's API.
|
|
8
|
+
* Uses 'user-required' configuration mode - users MUST provide their own API key.
|
|
9
|
+
*/
|
|
10
|
+
declare class OpenAiPlugin extends BaseAiProvider {
|
|
11
|
+
readonly id = "openai";
|
|
12
|
+
readonly name = "OpenAI";
|
|
13
|
+
readonly version = "1.0.0";
|
|
14
|
+
readonly providerType = "openai";
|
|
15
|
+
readonly providerName = "OpenAI";
|
|
16
|
+
readonly configurationMode: 'admin-only' | 'user-required' | 'hybrid';
|
|
17
|
+
readonly settingsSchema: JsonSchema;
|
|
18
|
+
onLoad(context: PluginContext): Promise<void>;
|
|
19
|
+
onUnload(): Promise<void>;
|
|
20
|
+
createChatCompletion(options: ChatCompletionOptions): Promise<ChatCompletionResponse>;
|
|
21
|
+
createStreamingChatCompletion(options: ChatCompletionOptions): AsyncIterable<ChatCompletionChunk>;
|
|
22
|
+
createEmbedding(options: EmbeddingOptions): Promise<EmbeddingResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Whisper-backed speech-to-text. Wraps OpenAI's `/v1/audio/transcriptions`
|
|
25
|
+
* REST endpoint directly with `fetch` + `FormData` so the plugin avoids
|
|
26
|
+
* pulling the heavy `openai` SDK just for this code path (we already do
|
|
27
|
+
* everything else via LangChain).
|
|
28
|
+
*
|
|
29
|
+
* The handler accepts any of the three binary shapes the KB ingest task
|
|
30
|
+
* forwards — Web ReadableStream (from the upload route), Node Buffer (from
|
|
31
|
+
* the Trigger.dev local runner), or Uint8Array (from tests). We normalize
|
|
32
|
+
* to a Blob before constructing the multipart body so the OpenAI server's
|
|
33
|
+
* MIME sniffer sees a real file part with the original filename.
|
|
34
|
+
*
|
|
35
|
+
* Disabled-by-omission: when `apiKey` is unset the call throws — the
|
|
36
|
+
* facade catches and falls through to the next provider in the chain.
|
|
37
|
+
*/
|
|
38
|
+
transcribe(options: TranscriptionOptions): Promise<TranscriptionResponse>;
|
|
39
|
+
private normaliseAudioInput;
|
|
40
|
+
private detectMimeFromName;
|
|
41
|
+
listModels(settings?: PluginSettings): Promise<readonly AiModel[]>;
|
|
42
|
+
getCapabilities(): AiModelCapabilities;
|
|
43
|
+
protected getDefaultModelId(): string;
|
|
44
|
+
healthCheck(): Promise<PluginHealthCheck>;
|
|
45
|
+
getManifest(): PluginManifest;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { OpenAiPlugin, OpenAiPlugin as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseAiProvider } from '@ever-works/plugin/abstract';
|
|
2
|
+
import { JsonSchema, PluginContext, ChatCompletionOptions, ChatCompletionResponse, ChatCompletionChunk, EmbeddingOptions, EmbeddingResponse, TranscriptionOptions, TranscriptionResponse, PluginSettings, AiModel, AiModelCapabilities, PluginHealthCheck, PluginManifest } from '@ever-works/plugin';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* OpenAI AI provider plugin
|
|
6
|
+
*
|
|
7
|
+
* Provides AI capabilities through OpenAI's API.
|
|
8
|
+
* Uses 'user-required' configuration mode - users MUST provide their own API key.
|
|
9
|
+
*/
|
|
10
|
+
declare class OpenAiPlugin extends BaseAiProvider {
|
|
11
|
+
readonly id = "openai";
|
|
12
|
+
readonly name = "OpenAI";
|
|
13
|
+
readonly version = "1.0.0";
|
|
14
|
+
readonly providerType = "openai";
|
|
15
|
+
readonly providerName = "OpenAI";
|
|
16
|
+
readonly configurationMode: 'admin-only' | 'user-required' | 'hybrid';
|
|
17
|
+
readonly settingsSchema: JsonSchema;
|
|
18
|
+
onLoad(context: PluginContext): Promise<void>;
|
|
19
|
+
onUnload(): Promise<void>;
|
|
20
|
+
createChatCompletion(options: ChatCompletionOptions): Promise<ChatCompletionResponse>;
|
|
21
|
+
createStreamingChatCompletion(options: ChatCompletionOptions): AsyncIterable<ChatCompletionChunk>;
|
|
22
|
+
createEmbedding(options: EmbeddingOptions): Promise<EmbeddingResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Whisper-backed speech-to-text. Wraps OpenAI's `/v1/audio/transcriptions`
|
|
25
|
+
* REST endpoint directly with `fetch` + `FormData` so the plugin avoids
|
|
26
|
+
* pulling the heavy `openai` SDK just for this code path (we already do
|
|
27
|
+
* everything else via LangChain).
|
|
28
|
+
*
|
|
29
|
+
* The handler accepts any of the three binary shapes the KB ingest task
|
|
30
|
+
* forwards — Web ReadableStream (from the upload route), Node Buffer (from
|
|
31
|
+
* the Trigger.dev local runner), or Uint8Array (from tests). We normalize
|
|
32
|
+
* to a Blob before constructing the multipart body so the OpenAI server's
|
|
33
|
+
* MIME sniffer sees a real file part with the original filename.
|
|
34
|
+
*
|
|
35
|
+
* Disabled-by-omission: when `apiKey` is unset the call throws — the
|
|
36
|
+
* facade catches and falls through to the next provider in the chain.
|
|
37
|
+
*/
|
|
38
|
+
transcribe(options: TranscriptionOptions): Promise<TranscriptionResponse>;
|
|
39
|
+
private normaliseAudioInput;
|
|
40
|
+
private detectMimeFromName;
|
|
41
|
+
listModels(settings?: PluginSettings): Promise<readonly AiModel[]>;
|
|
42
|
+
getCapabilities(): AiModelCapabilities;
|
|
43
|
+
protected getDefaultModelId(): string;
|
|
44
|
+
healthCheck(): Promise<PluginHealthCheck>;
|
|
45
|
+
getManifest(): PluginManifest;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { OpenAiPlugin, OpenAiPlugin as default };
|