promptlayer 1.1.0 → 1.2.0
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 +22 -0
- package/dist/claude-agents.d.mts +20 -0
- package/dist/claude-agents.d.ts +20 -0
- package/dist/claude-agents.js +2 -0
- package/dist/claude-agents.js.map +1 -0
- package/dist/esm/{chunk-SWBNW72U.js → chunk-DFBRFJOL.js} +2 -2
- package/dist/esm/{chunk-SWBNW72U.js.map → chunk-DFBRFJOL.js.map} +1 -1
- package/dist/esm/claude-agents.js +2 -0
- package/dist/esm/claude-agents.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/openai-agents.js +2 -2
- package/dist/esm/openai-agents.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/openai-agents.js +2 -2
- package/dist/openai-agents.js.map +1 -1
- package/package.json +18 -1
- package/vendor/claude-agents/trace/.claude-plugin/plugin.json +8 -0
- package/vendor/claude-agents/trace/hooks/hook_utils.py +38 -0
- package/vendor/claude-agents/trace/hooks/hooks.json +60 -0
- package/vendor/claude-agents/trace/hooks/lib.sh +577 -0
- package/vendor/claude-agents/trace/hooks/parse_stop_transcript.py +375 -0
- package/vendor/claude-agents/trace/hooks/post_tool_use.sh +41 -0
- package/vendor/claude-agents/trace/hooks/session_end.sh +37 -0
- package/vendor/claude-agents/trace/hooks/session_start.sh +57 -0
- package/vendor/claude-agents/trace/hooks/stop_hook.sh +123 -0
- package/vendor/claude-agents/trace/hooks/user_prompt_submit.sh +25 -0
- package/vendor/claude-agents/vendor_metadata.json +5 -0
- package/.github/CODEOWNERS +0 -1
- package/.github/workflows/node.js.yml +0 -30
- package/.github/workflows/npm-publish.yml +0 -35
- package/src/groups.ts +0 -16
- package/src/index.ts +0 -383
- package/src/integrations/openai-agents/helpers.test.ts +0 -254
- package/src/integrations/openai-agents/ids.ts +0 -27
- package/src/integrations/openai-agents/index.ts +0 -8
- package/src/integrations/openai-agents/instrumentation.test.ts +0 -46
- package/src/integrations/openai-agents/instrumentation.ts +0 -47
- package/src/integrations/openai-agents/mapping.ts +0 -714
- package/src/integrations/openai-agents/otlp-json.ts +0 -120
- package/src/integrations/openai-agents/processor.test.ts +0 -509
- package/src/integrations/openai-agents/processor.ts +0 -388
- package/src/integrations/openai-agents/time.ts +0 -56
- package/src/integrations/openai-agents/types.ts +0 -49
- package/src/integrations/openai-agents/url.ts +0 -9
- package/src/openai-agents.ts +0 -1
- package/src/promptlayer.ts +0 -125
- package/src/run-error-tracking.test.ts +0 -146
- package/src/span-exporter.ts +0 -120
- package/src/span-wrapper.ts +0 -51
- package/src/templates.ts +0 -37
- package/src/tracing.ts +0 -20
- package/src/track.ts +0 -84
- package/src/types.ts +0 -689
- package/src/utils/blueprint-builder.test.ts +0 -727
- package/src/utils/blueprint-builder.ts +0 -1453
- package/src/utils/errors.test.ts +0 -68
- package/src/utils/errors.ts +0 -62
- package/src/utils/streaming.test.ts +0 -498
- package/src/utils/streaming.ts +0 -1402
- package/src/utils/utils.ts +0 -1228
- package/tsconfig.json +0 -115
- package/tsup.config.ts +0 -20
- package/vitest.config.ts +0 -9
package/src/types.ts
DELETED
|
@@ -1,689 +0,0 @@
|
|
|
1
|
-
export interface GetPromptTemplate {
|
|
2
|
-
prompt_name: string;
|
|
3
|
-
version?: number;
|
|
4
|
-
label?: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface LegacyPromptTemplate {
|
|
8
|
-
prompt_template: any;
|
|
9
|
-
metadata: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface LegacyPublishPromptTemplate {
|
|
13
|
-
prompt_name: string;
|
|
14
|
-
prompt_template: any;
|
|
15
|
-
commit_message?: string;
|
|
16
|
-
tags?: string[];
|
|
17
|
-
metadata?: any;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface TrackRequest {
|
|
21
|
-
api_key: string;
|
|
22
|
-
provider_type?: string;
|
|
23
|
-
function_name: string;
|
|
24
|
-
args?: unknown[];
|
|
25
|
-
kwargs?: Record<string, unknown>;
|
|
26
|
-
request_end_time: string;
|
|
27
|
-
request_start_time: string;
|
|
28
|
-
prompt_id?: number;
|
|
29
|
-
prompt_version?: number;
|
|
30
|
-
metadata?: Record<string, string>;
|
|
31
|
-
tags?: string[];
|
|
32
|
-
request_response?: Record<string, unknown>;
|
|
33
|
-
prompt_input_variables?: Record<string, unknown> | string[];
|
|
34
|
-
return_data?: boolean;
|
|
35
|
-
group_id?: number;
|
|
36
|
-
span_id?: string;
|
|
37
|
-
status?: "SUCCESS" | "WARNING" | "ERROR";
|
|
38
|
-
error_type?: string;
|
|
39
|
-
error_message?: string;
|
|
40
|
-
[k: string]: unknown;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface TrackMetadata {
|
|
44
|
-
request_id: number;
|
|
45
|
-
metadata: Record<string, string>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TrackScore {
|
|
49
|
-
request_id: number;
|
|
50
|
-
score: number;
|
|
51
|
-
name?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface TrackPrompt {
|
|
55
|
-
request_id: number;
|
|
56
|
-
prompt_name: string;
|
|
57
|
-
prompt_input_variables: Record<string, unknown>;
|
|
58
|
-
version?: number;
|
|
59
|
-
label?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface TrackGroup {
|
|
63
|
-
request_id: number;
|
|
64
|
-
group_id: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface Pagination {
|
|
68
|
-
page?: number;
|
|
69
|
-
per_page?: number;
|
|
70
|
-
label?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface CustomProvider {
|
|
74
|
-
id: number;
|
|
75
|
-
name: string;
|
|
76
|
-
client: string;
|
|
77
|
-
base_url: string;
|
|
78
|
-
workspace_id: number;
|
|
79
|
-
api_key: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface GetPromptTemplateParams {
|
|
83
|
-
version?: number;
|
|
84
|
-
label?: string;
|
|
85
|
-
provider?: string;
|
|
86
|
-
input_variables?: Record<string, unknown>;
|
|
87
|
-
metadata_filters?: Record<string, string>;
|
|
88
|
-
model?: string;
|
|
89
|
-
model_parameter_overrides?: Record<string, unknown>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const templateFormat = ["f-string", "jinja2"] as const;
|
|
93
|
-
|
|
94
|
-
export type TemplateFormat = (typeof templateFormat)[number];
|
|
95
|
-
|
|
96
|
-
export type FileAnnotation = {
|
|
97
|
-
type: "file_citation";
|
|
98
|
-
index: number;
|
|
99
|
-
file_id: string;
|
|
100
|
-
filename: string;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export type WebAnnotation = {
|
|
104
|
-
type: "url_citation";
|
|
105
|
-
title: string;
|
|
106
|
-
url: string;
|
|
107
|
-
start_index: number;
|
|
108
|
-
end_index: number;
|
|
109
|
-
cited_text?: string;
|
|
110
|
-
encrypted_index?: string;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export type MapAnnotation = {
|
|
114
|
-
type: "map_citation";
|
|
115
|
-
title: string;
|
|
116
|
-
url: string;
|
|
117
|
-
place_id?: string;
|
|
118
|
-
start_index: number;
|
|
119
|
-
end_index: number;
|
|
120
|
-
cited_text?: string;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export type ContainerFileAnnotation = {
|
|
124
|
-
type: "container_file_citation";
|
|
125
|
-
container_id: string;
|
|
126
|
-
start_index?: number;
|
|
127
|
-
end_index?: number;
|
|
128
|
-
filename?: string;
|
|
129
|
-
file_id?: string;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export type Annotation =
|
|
133
|
-
| WebAnnotation
|
|
134
|
-
| FileAnnotation
|
|
135
|
-
| MapAnnotation
|
|
136
|
-
| ContainerFileAnnotation;
|
|
137
|
-
|
|
138
|
-
export type ImageUrl = {
|
|
139
|
-
url: string;
|
|
140
|
-
detail?: string;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export type TextContent = {
|
|
144
|
-
id?: string;
|
|
145
|
-
type: "text";
|
|
146
|
-
text: string;
|
|
147
|
-
annotations?: Annotation[];
|
|
148
|
-
thought_signature?: string;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export type ThinkingContent = {
|
|
152
|
-
id?: string;
|
|
153
|
-
signature?: string;
|
|
154
|
-
type: "thinking";
|
|
155
|
-
thinking: string;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export type CodeContent = {
|
|
159
|
-
id?: string;
|
|
160
|
-
container_id?: string;
|
|
161
|
-
type: "code";
|
|
162
|
-
code: string;
|
|
163
|
-
language?: string;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export type ImageContent = {
|
|
167
|
-
type: "image_url";
|
|
168
|
-
image_url: ImageUrl;
|
|
169
|
-
image_variable?: string;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export type Media = {
|
|
173
|
-
title: string;
|
|
174
|
-
type: string;
|
|
175
|
-
url?: string;
|
|
176
|
-
format?: "base64" | "url" | "neither";
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export type MediaContent = {
|
|
180
|
-
type: "media";
|
|
181
|
-
media: Media;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export type MediaVariable = {
|
|
185
|
-
type: "media_variable";
|
|
186
|
-
name: string;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export type OutputMediaContent = {
|
|
190
|
-
type: "output_media";
|
|
191
|
-
id?: string;
|
|
192
|
-
url: string;
|
|
193
|
-
mime_type?: string;
|
|
194
|
-
media_type?: "image" | "video" | "audio";
|
|
195
|
-
provider_metadata?: Record<string, unknown>;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export type ServerToolUseContent = {
|
|
199
|
-
type: "server_tool_use";
|
|
200
|
-
id: string;
|
|
201
|
-
name: string;
|
|
202
|
-
input?: Record<string, unknown>;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export type WebSearchResult = {
|
|
206
|
-
type: "web_search_result";
|
|
207
|
-
url?: string;
|
|
208
|
-
title?: string;
|
|
209
|
-
encrypted_content?: string;
|
|
210
|
-
page_age?: string;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export type WebSearchToolResultContent = {
|
|
214
|
-
type: "web_search_tool_result";
|
|
215
|
-
tool_use_id: string;
|
|
216
|
-
content?: WebSearchResult[];
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
export type CodeExecutionResultContent = {
|
|
220
|
-
type: "code_execution_result";
|
|
221
|
-
output: string;
|
|
222
|
-
outcome?: string;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export type McpListToolsContent = {
|
|
226
|
-
type: "mcp_list_tools";
|
|
227
|
-
id?: string;
|
|
228
|
-
server_label?: string;
|
|
229
|
-
tools?: Record<string, unknown>[];
|
|
230
|
-
error?: string | Record<string, unknown>;
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export type McpCallContent = {
|
|
234
|
-
type: "mcp_call";
|
|
235
|
-
id?: string;
|
|
236
|
-
name?: string;
|
|
237
|
-
server_label?: string;
|
|
238
|
-
arguments?: string;
|
|
239
|
-
output?: string;
|
|
240
|
-
error?: string | Record<string, unknown>;
|
|
241
|
-
approval_request_id?: string;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
export type McpApprovalRequestContent = {
|
|
245
|
-
type: "mcp_approval_request";
|
|
246
|
-
id?: string;
|
|
247
|
-
name?: string;
|
|
248
|
-
arguments?: string;
|
|
249
|
-
server_label?: string;
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export type McpApprovalResponseContent = {
|
|
253
|
-
type: "mcp_approval_response";
|
|
254
|
-
approval_request_id: string;
|
|
255
|
-
approve: boolean;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
export type BashCodeExecutionToolResultContent = {
|
|
259
|
-
type: "bash_code_execution_tool_result";
|
|
260
|
-
tool_use_id: string;
|
|
261
|
-
content?: Record<string, unknown>;
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
export type TextEditorCodeExecutionToolResultContent = {
|
|
265
|
-
type: "text_editor_code_execution_tool_result";
|
|
266
|
-
tool_use_id: string;
|
|
267
|
-
content?: Record<string, unknown>;
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
export type ShellCallContent = {
|
|
271
|
-
type: "shell_call";
|
|
272
|
-
id?: string;
|
|
273
|
-
call_id?: string;
|
|
274
|
-
action?: Record<string, unknown>;
|
|
275
|
-
status?: string;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export type ShellCallOutputContent = {
|
|
279
|
-
type: "shell_call_output";
|
|
280
|
-
id?: string;
|
|
281
|
-
call_id?: string;
|
|
282
|
-
output?: Record<string, unknown>[];
|
|
283
|
-
status?: string;
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
export type ApplyPatchCallContent = {
|
|
287
|
-
type: "apply_patch_call";
|
|
288
|
-
id?: string;
|
|
289
|
-
call_id?: string;
|
|
290
|
-
operation?: Record<string, unknown>;
|
|
291
|
-
status?: string;
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export type ApplyPatchCallOutputContent = {
|
|
295
|
-
type: "apply_patch_call_output";
|
|
296
|
-
id?: string;
|
|
297
|
-
call_id?: string;
|
|
298
|
-
output?: string;
|
|
299
|
-
status?: string;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
export type Content =
|
|
303
|
-
| TextContent
|
|
304
|
-
| ThinkingContent
|
|
305
|
-
| CodeContent
|
|
306
|
-
| ImageContent
|
|
307
|
-
| MediaContent
|
|
308
|
-
| MediaVariable
|
|
309
|
-
| OutputMediaContent
|
|
310
|
-
| ServerToolUseContent
|
|
311
|
-
| WebSearchToolResultContent
|
|
312
|
-
| CodeExecutionResultContent
|
|
313
|
-
| McpListToolsContent
|
|
314
|
-
| McpCallContent
|
|
315
|
-
| McpApprovalRequestContent
|
|
316
|
-
| McpApprovalResponseContent
|
|
317
|
-
| BashCodeExecutionToolResultContent
|
|
318
|
-
| TextEditorCodeExecutionToolResultContent
|
|
319
|
-
| ShellCallContent
|
|
320
|
-
| ShellCallOutputContent
|
|
321
|
-
| ApplyPatchCallContent
|
|
322
|
-
| ApplyPatchCallOutputContent;
|
|
323
|
-
|
|
324
|
-
export type Function_ = {
|
|
325
|
-
name: string;
|
|
326
|
-
description: string;
|
|
327
|
-
strict?: boolean;
|
|
328
|
-
parameters: Record<string, unknown>;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
export type FunctionCall = {
|
|
332
|
-
name: string;
|
|
333
|
-
arguments: string;
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
export type WebSearchToolFilters = {
|
|
337
|
-
allowed_domains?: string[];
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
export type WebSearchToolUserLocation = {
|
|
341
|
-
city?: string;
|
|
342
|
-
country?: string;
|
|
343
|
-
region?: string;
|
|
344
|
-
timezone?: string;
|
|
345
|
-
type: "approximate";
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
export type OpenAIWebSearchToolConfig = {
|
|
349
|
-
type: "web_search" | "web_search_2025_08_26";
|
|
350
|
-
filters?: WebSearchToolFilters;
|
|
351
|
-
search_context_size?: "low" | "medium" | "high";
|
|
352
|
-
user_location?: WebSearchToolUserLocation;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
export type ComparisonFilter = {
|
|
356
|
-
key: string;
|
|
357
|
-
value: string | number | boolean;
|
|
358
|
-
operation: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
export type CompoundFilter = {
|
|
362
|
-
operator: "and" | "or";
|
|
363
|
-
operands: (ComparisonFilter | CompoundFilter)[];
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
export type RankingOptions = {
|
|
367
|
-
ranker?: "auto" | "default-2024-11-15";
|
|
368
|
-
score_threshold?: number;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
export type FileSearchToolConfig = {
|
|
372
|
-
type: "file_search";
|
|
373
|
-
vector_store_ids: string[];
|
|
374
|
-
filters?: ComparisonFilter | CompoundFilter;
|
|
375
|
-
max_num_results?: number;
|
|
376
|
-
ranking_options?: RankingOptions;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
export type CodeInterpreterToolConfig = {
|
|
380
|
-
type: "code_interpreter";
|
|
381
|
-
container?: Record<string, unknown>;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
export type ImageGenerationToolConfig = {
|
|
385
|
-
type: "image_generation";
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
export type ShellToolConfig = {
|
|
389
|
-
type: "shell";
|
|
390
|
-
environment?: Record<string, unknown>;
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
export type ApplyPatchToolConfig = {
|
|
394
|
-
type: "apply_patch";
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
export type McpToolApprovalFilter = {
|
|
398
|
-
tool_names?: string[];
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
export type McpToolApproval = {
|
|
402
|
-
never?: McpToolApprovalFilter;
|
|
403
|
-
always?: McpToolApprovalFilter;
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
export type McpToolConfig = {
|
|
407
|
-
type: "mcp";
|
|
408
|
-
server_label: string;
|
|
409
|
-
server_url?: string;
|
|
410
|
-
server_description?: string;
|
|
411
|
-
connector_id?: string;
|
|
412
|
-
authorization?: string;
|
|
413
|
-
allowed_tools?: string[];
|
|
414
|
-
require_approval?: string | McpToolApproval;
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
export type BuiltInToolConfig =
|
|
418
|
-
| OpenAIWebSearchToolConfig
|
|
419
|
-
| FileSearchToolConfig
|
|
420
|
-
| CodeInterpreterToolConfig
|
|
421
|
-
| ImageGenerationToolConfig
|
|
422
|
-
| McpToolConfig
|
|
423
|
-
| ShellToolConfig
|
|
424
|
-
| ApplyPatchToolConfig;
|
|
425
|
-
|
|
426
|
-
export type FunctionTool = {
|
|
427
|
-
type: "function";
|
|
428
|
-
function: Function_;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
export type BuiltInTool = {
|
|
432
|
-
id: string;
|
|
433
|
-
name: string;
|
|
434
|
-
description: string;
|
|
435
|
-
provider: string;
|
|
436
|
-
type:
|
|
437
|
-
| "web_search"
|
|
438
|
-
| "file_search"
|
|
439
|
-
| "code_interpreter"
|
|
440
|
-
| "image_generation"
|
|
441
|
-
| "google_maps"
|
|
442
|
-
| "url_context"
|
|
443
|
-
| "mcp"
|
|
444
|
-
| "bash"
|
|
445
|
-
| "shell"
|
|
446
|
-
| "apply_patch"
|
|
447
|
-
| "text_editor";
|
|
448
|
-
config: BuiltInToolConfig;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
export type Tool = FunctionTool | BuiltInTool;
|
|
452
|
-
|
|
453
|
-
export type SystemMessage = {
|
|
454
|
-
role: "system";
|
|
455
|
-
input_variables?: string[];
|
|
456
|
-
template_format?: TemplateFormat;
|
|
457
|
-
content: Content[];
|
|
458
|
-
name?: string;
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
export type UserMessage = {
|
|
462
|
-
role: "user";
|
|
463
|
-
input_variables?: string[];
|
|
464
|
-
template_format?: TemplateFormat;
|
|
465
|
-
content: Content[];
|
|
466
|
-
name?: string;
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
export type ToolCall = {
|
|
470
|
-
id: string;
|
|
471
|
-
tool_id?: string;
|
|
472
|
-
type: "function";
|
|
473
|
-
function: FunctionCall;
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
export type AssistantMessage = {
|
|
477
|
-
role: "assistant";
|
|
478
|
-
input_variables?: string[];
|
|
479
|
-
template_format?: TemplateFormat;
|
|
480
|
-
content?: Content[];
|
|
481
|
-
function_call?: FunctionCall;
|
|
482
|
-
name?: string;
|
|
483
|
-
tool_calls?: ToolCall[];
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
export type FunctionMessage = {
|
|
487
|
-
role: "function";
|
|
488
|
-
input_variables?: string[];
|
|
489
|
-
template_format?: TemplateFormat;
|
|
490
|
-
content?: Content[];
|
|
491
|
-
name: string;
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
export type ToolMessage = {
|
|
495
|
-
role: "tool";
|
|
496
|
-
input_variables?: string[];
|
|
497
|
-
template_format?: TemplateFormat;
|
|
498
|
-
content?: Content[];
|
|
499
|
-
tool_call_id: string;
|
|
500
|
-
name?: string;
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
export type PlaceholderMessage = {
|
|
504
|
-
role: "placeholder";
|
|
505
|
-
name: string;
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
export type DeveloperMessage = {
|
|
509
|
-
role: "developer";
|
|
510
|
-
input_variables?: string[];
|
|
511
|
-
template_format?: TemplateFormat;
|
|
512
|
-
content: Content[];
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
export type Message =
|
|
516
|
-
| SystemMessage
|
|
517
|
-
| UserMessage
|
|
518
|
-
| AssistantMessage
|
|
519
|
-
| FunctionMessage
|
|
520
|
-
| ToolMessage
|
|
521
|
-
| PlaceholderMessage
|
|
522
|
-
| DeveloperMessage;
|
|
523
|
-
|
|
524
|
-
export type ChatFunctionCall = {
|
|
525
|
-
name: string;
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
export type CompletionPromptTemplate = {
|
|
529
|
-
type: "completion";
|
|
530
|
-
template_format?: TemplateFormat;
|
|
531
|
-
content: Content[];
|
|
532
|
-
input_variables?: string[];
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
export type ChatToolChoice = {
|
|
536
|
-
type: "function";
|
|
537
|
-
function: ChatFunctionCall;
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
export type ToolChoice = string | ChatToolChoice;
|
|
541
|
-
|
|
542
|
-
export type ChatPromptTemplate = {
|
|
543
|
-
type: "chat";
|
|
544
|
-
messages: Message[];
|
|
545
|
-
functions?: Function_[];
|
|
546
|
-
function_call?: "auto" | "none" | ChatFunctionCall;
|
|
547
|
-
input_variables?: string[];
|
|
548
|
-
tools?: Tool[];
|
|
549
|
-
tool_choice?: ToolChoice;
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
export type PromptTemplate = CompletionPromptTemplate | ChatPromptTemplate;
|
|
553
|
-
|
|
554
|
-
export type Model = {
|
|
555
|
-
api_type?: string;
|
|
556
|
-
provider: string;
|
|
557
|
-
model_config_display_name?: string;
|
|
558
|
-
base_model?: string;
|
|
559
|
-
name: string;
|
|
560
|
-
parameters: Record<string, unknown>;
|
|
561
|
-
display_params?: Record<string, string | boolean | null>;
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
export type Metadata = {
|
|
565
|
-
model?: Model;
|
|
566
|
-
};
|
|
567
|
-
|
|
568
|
-
export type BasePromptTemplate = {
|
|
569
|
-
prompt_name: string;
|
|
570
|
-
tags?: string[];
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
export type PromptBlueprint = {
|
|
574
|
-
prompt_template: PromptTemplate;
|
|
575
|
-
commit_message?: string;
|
|
576
|
-
metadata?: Metadata;
|
|
577
|
-
provider_base_url_name?: string;
|
|
578
|
-
report_id?: number;
|
|
579
|
-
inference_client_name?: string;
|
|
580
|
-
provider_id?: number;
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
export type PublishPromptTemplate = BasePromptTemplate &
|
|
584
|
-
PromptBlueprint & { release_labels?: string[] };
|
|
585
|
-
|
|
586
|
-
export interface ProviderBaseURL {
|
|
587
|
-
id: number;
|
|
588
|
-
name: string;
|
|
589
|
-
provider: string;
|
|
590
|
-
url: string;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
export interface BasePromptTemplateResponse {
|
|
594
|
-
id: number;
|
|
595
|
-
prompt_name: string;
|
|
596
|
-
tags: string[];
|
|
597
|
-
prompt_template: PromptTemplate;
|
|
598
|
-
commit_message?: string;
|
|
599
|
-
metadata?: Metadata;
|
|
600
|
-
provider_base_url?: ProviderBaseURL;
|
|
601
|
-
custom_provider?: CustomProvider;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
export interface PublishPromptTemplateResponse
|
|
605
|
-
extends BasePromptTemplateResponse {}
|
|
606
|
-
|
|
607
|
-
export interface GetPromptTemplateResponse extends BasePromptTemplateResponse {
|
|
608
|
-
version: number;
|
|
609
|
-
llm_kwargs: Record<string, unknown> | null;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
export interface ListPromptTemplatesResponse
|
|
613
|
-
extends BasePromptTemplateResponse {
|
|
614
|
-
version: number;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
export interface RunRequest {
|
|
618
|
-
promptName: string;
|
|
619
|
-
tags?: string[];
|
|
620
|
-
metadata?: Record<string, string>;
|
|
621
|
-
groupId?: number;
|
|
622
|
-
stream?: boolean;
|
|
623
|
-
promptVersion?: number;
|
|
624
|
-
promptReleaseLabel?: string;
|
|
625
|
-
inputVariables?: Record<string, unknown>;
|
|
626
|
-
modelParameterOverrides?: Record<string, unknown>;
|
|
627
|
-
provider?: string;
|
|
628
|
-
model?: string;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
export interface LogRequest {
|
|
632
|
-
provider: string;
|
|
633
|
-
model: string;
|
|
634
|
-
input: PromptTemplate;
|
|
635
|
-
output: PromptTemplate;
|
|
636
|
-
request_start_time: number;
|
|
637
|
-
request_end_time: number;
|
|
638
|
-
parameters?: Record<string, unknown>;
|
|
639
|
-
tags?: string[];
|
|
640
|
-
metadata?: Record<string, string>;
|
|
641
|
-
prompt_name?: string;
|
|
642
|
-
prompt_version_number?: number;
|
|
643
|
-
prompt_input_variables?: Record<string, unknown>;
|
|
644
|
-
input_tokens?: number;
|
|
645
|
-
output_tokens?: number;
|
|
646
|
-
price?: number;
|
|
647
|
-
function_name?: string;
|
|
648
|
-
score?: number;
|
|
649
|
-
prompt_id?: number;
|
|
650
|
-
score_name?: string;
|
|
651
|
-
api_type?: string;
|
|
652
|
-
status?: "SUCCESS" | "WARNING" | "ERROR";
|
|
653
|
-
error_type?: string;
|
|
654
|
-
error_message?: string;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
export interface RequestLog {
|
|
658
|
-
id: number;
|
|
659
|
-
prompt_version: PromptBlueprint;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
export interface WorkflowRequest {
|
|
663
|
-
workflowName: string;
|
|
664
|
-
inputVariables?: Record<string, any>;
|
|
665
|
-
metadata?: Record<string, string>;
|
|
666
|
-
workflowLabelName?: string | null;
|
|
667
|
-
workflowVersion?: number | null;
|
|
668
|
-
returnAllOutputs?: boolean;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
export interface RunWorkflowRequestParams {
|
|
672
|
-
workflow_name: string;
|
|
673
|
-
input_variables: Record<string, any>;
|
|
674
|
-
metadata?: Record<string, string>;
|
|
675
|
-
workflow_label_name?: string | null;
|
|
676
|
-
workflow_version_number?: number | null;
|
|
677
|
-
return_all_outputs?: boolean;
|
|
678
|
-
api_key: string;
|
|
679
|
-
timeout?: number;
|
|
680
|
-
baseURL: string;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
export interface WorkflowResponse {
|
|
684
|
-
success?: boolean;
|
|
685
|
-
message?: string;
|
|
686
|
-
error?: string;
|
|
687
|
-
status?: string;
|
|
688
|
-
value?: string;
|
|
689
|
-
}
|