Comparing version 0.5.2 to 0.6.0
16
index.js
@@ -46,3 +46,3 @@ var __defProp = Object.defineProperty; | ||
if (base === null) { | ||
return mergeChunks({ ...chunk, choices: [] }, chunk); | ||
return mergeChunks({ ...chunk, object: "chat.completion", choices: [] }, chunk); | ||
} | ||
@@ -158,3 +158,2 @@ const choices = [...base.choices]; | ||
const onResolve = (value) => { | ||
var _a; | ||
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { | ||
@@ -164,6 +163,6 @@ return; | ||
__privateSet(this, _isResolved, true); | ||
(_a = __privateGet(this, _resolve)) == null ? void 0 : _a.call(this, value); | ||
if (__privateGet(this, _resolve)) | ||
__privateGet(this, _resolve).call(this, value); | ||
}; | ||
const onReject = (reason) => { | ||
var _a; | ||
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { | ||
@@ -173,3 +172,4 @@ return; | ||
__privateSet(this, _isRejected, true); | ||
(_a = __privateGet(this, _reject)) == null ? void 0 : _a.call(this, reason); | ||
if (__privateGet(this, _reject)) | ||
__privateGet(this, _reject).call(this, reason); | ||
}; | ||
@@ -207,3 +207,2 @@ const onCancel = (cancelHandler) => { | ||
cancel() { | ||
var _a; | ||
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { | ||
@@ -224,3 +223,4 @@ return; | ||
__privateGet(this, _cancelHandlers).length = 0; | ||
(_a = __privateGet(this, _reject)) == null ? void 0 : _a.call(this, new CancelError("Request aborted")); | ||
if (__privateGet(this, _reject)) | ||
__privateGet(this, _reject).call(this, new CancelError("Request aborted")); | ||
} | ||
@@ -575,3 +575,3 @@ get isCancelled() { | ||
name: "openpipe-dev", | ||
version: "0.5.2", | ||
version: "0.6.0", | ||
type: "module", | ||
@@ -578,0 +578,0 @@ description: "LLM metrics and inference", |
@@ -100,5 +100,20 @@ import * as openai$1 from 'openai'; | ||
model: string; | ||
messages: Array<{ | ||
role: ('user' | 'assistant' | 'system' | 'function'); | ||
messages: Array<({ | ||
role: 'system'; | ||
content: (string | 'null' | null); | ||
} | { | ||
role: 'user'; | ||
content: (string | Array<({ | ||
type: 'image_url'; | ||
image_url: { | ||
detail?: ('auto' | 'low' | 'high'); | ||
url?: string; | ||
}; | ||
} | { | ||
type: 'text'; | ||
text: string; | ||
})> | 'null' | null); | ||
} | { | ||
role: 'assistant'; | ||
content: (string | 'null' | null); | ||
function_call?: { | ||
@@ -108,3 +123,19 @@ name: string; | ||
}; | ||
}>; | ||
tool_calls?: Array<{ | ||
id: string; | ||
function: { | ||
name: string; | ||
arguments: string; | ||
}; | ||
type: 'function'; | ||
}>; | ||
} | { | ||
role: 'tool'; | ||
content: (string | 'null' | null); | ||
tool_call_id: string; | ||
} | { | ||
role: 'function'; | ||
name: string; | ||
content: (string | 'null' | null); | ||
})>; | ||
function_call?: ('none' | 'auto' | { | ||
@@ -119,3 +150,3 @@ name: string; | ||
'n'?: number; | ||
max_tokens?: number; | ||
max_tokens?: number | null; | ||
temperature?: number; | ||
@@ -125,5 +156,20 @@ stream?: boolean; | ||
model?: string; | ||
messages?: Array<{ | ||
role: ('user' | 'assistant' | 'system' | 'function'); | ||
messages?: Array<({ | ||
role: 'system'; | ||
content: (string | 'null' | null); | ||
} | { | ||
role: 'user'; | ||
content: (string | Array<({ | ||
type: 'image_url'; | ||
image_url: { | ||
detail?: ('auto' | 'low' | 'high'); | ||
url?: string; | ||
}; | ||
} | { | ||
type: 'text'; | ||
text: string; | ||
})> | 'null' | null); | ||
} | { | ||
role: 'assistant'; | ||
content: (string | 'null' | null); | ||
function_call?: { | ||
@@ -133,3 +179,19 @@ name: string; | ||
}; | ||
}>; | ||
tool_calls?: Array<{ | ||
id: string; | ||
function: { | ||
name: string; | ||
arguments: string; | ||
}; | ||
type: 'function'; | ||
}>; | ||
} | { | ||
role: 'tool'; | ||
content: (string | 'null' | null); | ||
tool_call_id: string; | ||
} | { | ||
role: 'function'; | ||
name: string; | ||
content: (string | 'null' | null); | ||
})>; | ||
function_call?: ('none' | 'auto' | { | ||
@@ -144,3 +206,3 @@ name: string; | ||
'n'?: number | null; | ||
max_tokens?: number; | ||
max_tokens?: number | null; | ||
temperature?: number | null; | ||
@@ -150,10 +212,10 @@ stream?: boolean | null; | ||
id: string; | ||
object: string; | ||
object: 'chat.completion'; | ||
created: number; | ||
model: string; | ||
choices: Array<{ | ||
finish_reason: ('stop' | 'length' | 'function_call'); | ||
finish_reason: ('length' | 'function_call' | 'tool_calls' | 'stop' | 'content_filter'); | ||
index: number; | ||
message: { | ||
role: ('user' | 'assistant' | 'system' | 'function'); | ||
role: 'assistant'; | ||
content: (string | 'null' | null); | ||
@@ -164,2 +226,10 @@ function_call?: { | ||
}; | ||
tool_calls?: Array<{ | ||
id: string; | ||
function: { | ||
name: string; | ||
arguments: string; | ||
}; | ||
type: 'function'; | ||
}>; | ||
}; | ||
@@ -166,0 +236,0 @@ }>; |
@@ -37,3 +37,3 @@ var __accessCheck = (obj, member, msg) => { | ||
if (base === null) { | ||
return mergeChunks({ ...chunk, choices: [] }, chunk); | ||
return mergeChunks({ ...chunk, object: "chat.completion", choices: [] }, chunk); | ||
} | ||
@@ -149,3 +149,2 @@ const choices = [...base.choices]; | ||
const onResolve = (value) => { | ||
var _a; | ||
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { | ||
@@ -155,6 +154,6 @@ return; | ||
__privateSet(this, _isResolved, true); | ||
(_a = __privateGet(this, _resolve)) == null ? void 0 : _a.call(this, value); | ||
if (__privateGet(this, _resolve)) | ||
__privateGet(this, _resolve).call(this, value); | ||
}; | ||
const onReject = (reason) => { | ||
var _a; | ||
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { | ||
@@ -164,3 +163,4 @@ return; | ||
__privateSet(this, _isRejected, true); | ||
(_a = __privateGet(this, _reject)) == null ? void 0 : _a.call(this, reason); | ||
if (__privateGet(this, _reject)) | ||
__privateGet(this, _reject).call(this, reason); | ||
}; | ||
@@ -198,3 +198,2 @@ const onCancel = (cancelHandler) => { | ||
cancel() { | ||
var _a; | ||
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { | ||
@@ -215,3 +214,4 @@ return; | ||
__privateGet(this, _cancelHandlers).length = 0; | ||
(_a = __privateGet(this, _reject)) == null ? void 0 : _a.call(this, new CancelError("Request aborted")); | ||
if (__privateGet(this, _reject)) | ||
__privateGet(this, _reject).call(this, new CancelError("Request aborted")); | ||
} | ||
@@ -566,3 +566,3 @@ get isCancelled() { | ||
name: "openpipe-dev", | ||
version: "0.5.2", | ||
version: "0.6.0", | ||
type: "module", | ||
@@ -569,0 +569,0 @@ description: "LLM metrics and inference", |
@@ -11,3 +11,3 @@ // src/openai/mergeChunks.ts | ||
if (base === null) { | ||
return mergeChunks({ ...chunk, choices: [] }, chunk); | ||
return mergeChunks({ ...chunk, object: "chat.completion", choices: [] }, chunk); | ||
} | ||
@@ -14,0 +14,0 @@ const choices = [...base.choices]; |
@@ -14,3 +14,3 @@ // src/openai/streaming.ts | ||
if (base === null) { | ||
return mergeChunks({ ...chunk, choices: [] }, chunk); | ||
return mergeChunks({ ...chunk, object: "chat.completion", choices: [] }, chunk); | ||
} | ||
@@ -17,0 +17,0 @@ const choices = [...base.choices]; |
{ | ||
"name": "openpipe", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "LLM metrics and inference", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
388884
3838