@christianriedl/utils 1.0.137 → 1.0.138
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/iOpenAI.d.ts +45 -2
- package/package.json +1 -1
- package/src/components/OpenAI.vue +2 -3
package/dist/iOpenAI.d.ts
CHANGED
|
@@ -2,8 +2,30 @@ import { InjectionKey } from 'vue';
|
|
|
2
2
|
import { ILogger } from './iLogger';
|
|
3
3
|
import { Dictionary } from './types';
|
|
4
4
|
export declare const getOpenAISymbol: InjectionKey<() => IOpenAIService>;
|
|
5
|
+
export interface IResultAnnotation {
|
|
6
|
+
file_id?: string;
|
|
7
|
+
filename?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
index?: number;
|
|
10
|
+
type: 'file_citation' | 'url_citation';
|
|
11
|
+
}
|
|
12
|
+
export interface IResultContent {
|
|
13
|
+
annotations?: IResultAnnotation[];
|
|
14
|
+
text: string;
|
|
15
|
+
type: 'output_text';
|
|
16
|
+
}
|
|
17
|
+
export interface IResultOutput {
|
|
18
|
+
id: string;
|
|
19
|
+
queries?: string[];
|
|
20
|
+
results?: any[];
|
|
21
|
+
role?: 'assistant';
|
|
22
|
+
status?: 'in_progress' | 'completed' | 'incomplete';
|
|
23
|
+
type: 'message' | 'file_search_call' | 'mcp_call' | 'function_call';
|
|
24
|
+
content?: IResultContent[];
|
|
25
|
+
}
|
|
5
26
|
export interface IResponseResult {
|
|
6
27
|
id?: string;
|
|
28
|
+
output?: IResultOutput[];
|
|
7
29
|
text?: string;
|
|
8
30
|
error?: string;
|
|
9
31
|
json?: any;
|
|
@@ -32,7 +54,7 @@ export interface IMcpTool extends ITool {
|
|
|
32
54
|
export interface IFileSearchTool extends ITool {
|
|
33
55
|
type: 'file_search';
|
|
34
56
|
vector_store_ids: string[];
|
|
35
|
-
filters?:
|
|
57
|
+
filters?: IComparisonFilter | ICompoundFilter;
|
|
36
58
|
max_num_results?: number;
|
|
37
59
|
}
|
|
38
60
|
export interface IWebSearchLocation {
|
|
@@ -53,6 +75,15 @@ export interface IFunctionTool extends ITool {
|
|
|
53
75
|
strict: boolean | null;
|
|
54
76
|
description?: string | null;
|
|
55
77
|
}
|
|
78
|
+
export interface IComparisonFilter {
|
|
79
|
+
key: string;
|
|
80
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
81
|
+
value: string | number | boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface ICompoundFilter {
|
|
84
|
+
filters: IComparisonFilter[] | unknown;
|
|
85
|
+
type: 'and' | 'or';
|
|
86
|
+
}
|
|
56
87
|
export interface IOpenAIOptions {
|
|
57
88
|
model: string;
|
|
58
89
|
instructions?: string | null;
|
|
@@ -68,7 +99,7 @@ export interface IOpenAIService {
|
|
|
68
99
|
options: IOpenAIOptions;
|
|
69
100
|
modelNames: string[];
|
|
70
101
|
initialize(): Promise<boolean>;
|
|
71
|
-
response(prompt: string | string[], tools?: string[], imageUrl?: string, json?: ISchema): Promise<IResponseResult>;
|
|
102
|
+
response(prompt: string | string[], tools?: string[], imageUrl?: string, json?: ISchema, fileSearchFilter?: ICompoundFilter | IComparisonFilter): Promise<IResponseResult>;
|
|
72
103
|
clearContext(): void;
|
|
73
104
|
getModels(): Promise<string[]>;
|
|
74
105
|
}
|
|
@@ -86,6 +117,17 @@ export interface IVectorStore {
|
|
|
86
117
|
name: string;
|
|
87
118
|
files: Dictionary<string>;
|
|
88
119
|
}
|
|
120
|
+
export interface IVectorSearchContent {
|
|
121
|
+
type: 'text';
|
|
122
|
+
text: string;
|
|
123
|
+
}
|
|
124
|
+
export interface IVectorSearchResult {
|
|
125
|
+
attributes: Dictionary<string | number | boolean> | null;
|
|
126
|
+
content: IVectorSearchContent[];
|
|
127
|
+
file_id: string;
|
|
128
|
+
filename: string;
|
|
129
|
+
score: number;
|
|
130
|
+
}
|
|
89
131
|
export interface IOpenAIServiceWithVectorStore extends IOpenAIServiceWithTools {
|
|
90
132
|
vectorStore?: Dictionary<IVectorStore>;
|
|
91
133
|
initializeVectorStore(): Promise<boolean>;
|
|
@@ -94,6 +136,7 @@ export interface IOpenAIServiceWithVectorStore extends IOpenAIServiceWithTools {
|
|
|
94
136
|
addFile(fileUrl: string | File, vectorStoreName: string, wait?: boolean): Promise<boolean>;
|
|
95
137
|
deleteFile(fileId: string): Promise<boolean>;
|
|
96
138
|
deleteVectorStore(vectorStoreId: string): Promise<boolean>;
|
|
139
|
+
searchVectoreStore(vectorStoreName: string, query: string | string[], rewriteQuery?: boolean, maxNumResults?: number, filters?: ICompoundFilter | IComparisonFilter): Promise<IVectorSearchResult[]>;
|
|
97
140
|
getFileId(fileUrl: string): string | undefined;
|
|
98
141
|
}
|
|
99
142
|
export interface IOpenAIAppConfig {
|
package/package.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
async function onComplete() {
|
|
39
|
-
|
|
39
|
+
htmlText.value = "<h4>WAITING ...</h4>";
|
|
40
40
|
files.value = [];
|
|
41
41
|
isUpload.value = false;
|
|
42
42
|
let answer: IResponseResult;
|
|
@@ -91,10 +91,9 @@
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
htmlText.value = '';
|
|
95
94
|
const text = "KEINE KORREKTE ANTWORT : " + answer.error;
|
|
96
95
|
emits('result', text);
|
|
97
|
-
|
|
96
|
+
htmlText.value = `<h4>${text}</h4>`;
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
async function onResult(result: SpeechRecognitionResult) {
|