objectiveai 1.0.3 → 1.1.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/dist/index.cjs +93 -619
- package/dist/index.d.ts +130 -478
- package/dist/index.js +92 -618
- package/package.json +8 -7
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ScoreModel = exports.ScoreLlm = exports.Metadata = exports.Auth = exports.Models = exports.Score = exports.Chat = void 0;
|
|
4
4
|
var Chat;
|
|
5
5
|
(function (Chat) {
|
|
6
6
|
let Completions;
|
|
@@ -354,8 +354,8 @@ var Chat;
|
|
|
354
354
|
Completions.create = create;
|
|
355
355
|
})(Completions = Chat.Completions || (Chat.Completions = {}));
|
|
356
356
|
})(Chat || (exports.Chat = Chat = {}));
|
|
357
|
-
var
|
|
358
|
-
(function (
|
|
357
|
+
var Score;
|
|
358
|
+
(function (Score) {
|
|
359
359
|
let Completions;
|
|
360
360
|
(function (Completions) {
|
|
361
361
|
let Response;
|
|
@@ -370,25 +370,15 @@ var Query;
|
|
|
370
370
|
const created = a.created;
|
|
371
371
|
const model = a.model;
|
|
372
372
|
const object = a.object;
|
|
373
|
-
const [service_tier, service_tierChanged] = merge(a.service_tier, b.service_tier);
|
|
374
|
-
const [system_fingerprint, system_fingerprintChanged] = merge(a.system_fingerprint, b.system_fingerprint);
|
|
375
373
|
const [usage, usageChanged] = merge(a.usage, b.usage, Chat.Completions.Response.Usage.merged);
|
|
376
|
-
const [
|
|
377
|
-
if (choicesChanged ||
|
|
378
|
-
service_tierChanged ||
|
|
379
|
-
system_fingerprintChanged ||
|
|
380
|
-
usageChanged ||
|
|
381
|
-
training_table_dataChanged) {
|
|
374
|
+
const [weight_data, weight_dataChanged] = merge(a.weight_data, b.weight_data);
|
|
375
|
+
if (choicesChanged || usageChanged || weight_dataChanged) {
|
|
382
376
|
return [
|
|
383
|
-
Object.assign(Object.assign(
|
|
377
|
+
Object.assign(Object.assign({ id,
|
|
384
378
|
choices,
|
|
385
379
|
created,
|
|
386
380
|
model,
|
|
387
|
-
object }, (
|
|
388
|
-
? { system_fingerprint }
|
|
389
|
-
: {})), (usage !== undefined ? { usage } : {})), (training_table_data !== undefined
|
|
390
|
-
? { training_table_data }
|
|
391
|
-
: {})),
|
|
381
|
+
object }, (usage !== undefined ? { usage } : {})), (weight_data !== undefined ? { weight_data } : {})),
|
|
392
382
|
true,
|
|
393
383
|
];
|
|
394
384
|
}
|
|
@@ -401,37 +391,31 @@ var Query;
|
|
|
401
391
|
let Choice;
|
|
402
392
|
(function (Choice) {
|
|
403
393
|
function merged(a, b) {
|
|
404
|
-
const [delta, deltaChanged] = merge(a.delta, b.delta,
|
|
394
|
+
const [delta, deltaChanged] = merge(a.delta, b.delta, Delta.merged);
|
|
405
395
|
const [finish_reason, finish_reasonChanged] = merge(a.finish_reason, b.finish_reason);
|
|
406
396
|
const index = a.index;
|
|
407
397
|
const [logprobs, logprobsChanged] = merge(a.logprobs, b.logprobs, Chat.Completions.Response.Logprobs.merged);
|
|
408
|
-
const [
|
|
409
|
-
const [confidence_id, confidence_idChanged] = merge(a.confidence_id, b.confidence_id);
|
|
410
|
-
const [confidence_weight, confidence_weightChanged] = merge(a.confidence_weight, b.confidence_weight);
|
|
398
|
+
const [weight, weightChanged] = merge(a.weight, b.weight);
|
|
411
399
|
const [confidence, confidenceChanged] = merge(a.confidence, b.confidence);
|
|
412
|
-
const [embedding, embeddingChanged] = merge(a.embedding, b.embedding);
|
|
413
400
|
const [error, errorChanged] = merge(a.error, b.error);
|
|
414
|
-
const model = a.model;
|
|
415
|
-
const model_index = a.model_index;
|
|
416
|
-
const [completion_metadata, completion_metadataChanged] =
|
|
401
|
+
const [model, modelChanged] = merge(a.model, b.model);
|
|
402
|
+
const [model_index, model_indexChanged] = merge(a.model_index, b.model_index);
|
|
403
|
+
const [completion_metadata, completion_metadataChanged] = merge(a.completion_metadata, b.completion_metadata, CompletionMetadata.merged);
|
|
417
404
|
if (deltaChanged ||
|
|
418
405
|
finish_reasonChanged ||
|
|
419
406
|
logprobsChanged ||
|
|
420
|
-
|
|
421
|
-
confidence_idChanged ||
|
|
422
|
-
confidence_weightChanged ||
|
|
407
|
+
weightChanged ||
|
|
423
408
|
confidenceChanged ||
|
|
424
|
-
embeddingChanged ||
|
|
425
409
|
errorChanged ||
|
|
410
|
+
modelChanged ||
|
|
411
|
+
model_indexChanged ||
|
|
426
412
|
completion_metadataChanged) {
|
|
427
413
|
return [
|
|
428
|
-
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
414
|
+
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ delta,
|
|
429
415
|
finish_reason,
|
|
430
|
-
index }, (logprobs !== undefined ? { logprobs } : {})), (
|
|
431
|
-
? {
|
|
432
|
-
: {})),
|
|
433
|
-
model_index,
|
|
434
|
-
completion_metadata }),
|
|
416
|
+
index }, (logprobs !== undefined ? { logprobs } : {})), (weight !== undefined ? { weight } : {})), (confidence !== undefined ? { confidence } : {})), (error !== undefined ? { error } : {})), (model !== undefined ? { model } : {})), (model_index !== undefined ? { model_index } : {})), (completion_metadata !== undefined
|
|
417
|
+
? { completion_metadata }
|
|
418
|
+
: {})),
|
|
435
419
|
true,
|
|
436
420
|
];
|
|
437
421
|
}
|
|
@@ -466,6 +450,34 @@ var Query;
|
|
|
466
450
|
}
|
|
467
451
|
Choice.mergedList = mergedList;
|
|
468
452
|
})(Choice = Streaming.Choice || (Streaming.Choice = {}));
|
|
453
|
+
let Delta;
|
|
454
|
+
(function (Delta) {
|
|
455
|
+
function merged(a, b) {
|
|
456
|
+
const [content, contentChanged] = merge(a.content, b.content, mergedString);
|
|
457
|
+
const [refusal, refusalChanged] = merge(a.refusal, b.refusal, mergedString);
|
|
458
|
+
const [role, roleChanged] = merge(a.role, b.role);
|
|
459
|
+
const [tool_calls, tool_callsChanged] = merge(a.tool_calls, b.tool_calls, Chat.Completions.Response.Streaming.ToolCall.mergedList);
|
|
460
|
+
const [reasoning, reasoningChanged] = merge(a.reasoning, b.reasoning, mergedString);
|
|
461
|
+
const [images, imagesChanged] = merge(a.images, b.images, Chat.Completions.Response.Image.mergedList);
|
|
462
|
+
const [vote, voteChanged] = merge(a.vote, b.vote);
|
|
463
|
+
if (contentChanged ||
|
|
464
|
+
reasoningChanged ||
|
|
465
|
+
refusalChanged ||
|
|
466
|
+
roleChanged ||
|
|
467
|
+
tool_callsChanged ||
|
|
468
|
+
imagesChanged ||
|
|
469
|
+
voteChanged) {
|
|
470
|
+
return [
|
|
471
|
+
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (content !== undefined ? { content } : {})), (reasoning !== undefined ? { reasoning } : {})), (refusal !== undefined ? { refusal } : {})), (role !== undefined ? { role } : {})), (tool_calls !== undefined ? { tool_calls } : {})), (images !== undefined ? { images } : {})), (vote !== undefined ? { vote } : {})),
|
|
472
|
+
true,
|
|
473
|
+
];
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
return [a, false];
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
Delta.merged = merged;
|
|
480
|
+
})(Delta = Streaming.Delta || (Streaming.Delta = {}));
|
|
469
481
|
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
470
482
|
let CompletionMetadata;
|
|
471
483
|
(function (CompletionMetadata) {
|
|
@@ -496,583 +508,35 @@ var Query;
|
|
|
496
508
|
})(CompletionMetadata = Response.CompletionMetadata || (Response.CompletionMetadata = {}));
|
|
497
509
|
})(Response = Completions.Response || (Completions.Response = {}));
|
|
498
510
|
async function list(openai, listOptions, options) {
|
|
499
|
-
const response = await openai.get("/
|
|
511
|
+
const response = await openai.get("/score/completions", Object.assign({ query: listOptions }, options));
|
|
500
512
|
return response;
|
|
501
513
|
}
|
|
502
514
|
Completions.list = list;
|
|
503
515
|
async function publish(openai, id, options) {
|
|
504
|
-
await openai.post(`/
|
|
516
|
+
await openai.post(`/score/completions/${id}/publish`, options);
|
|
505
517
|
}
|
|
506
518
|
Completions.publish = publish;
|
|
507
519
|
async function retrieve(openai, id, options) {
|
|
508
|
-
const response = await openai.get(`/
|
|
520
|
+
const response = await openai.get(`/score/completions/${id}`, options);
|
|
509
521
|
return response;
|
|
510
522
|
}
|
|
511
523
|
Completions.retrieve = retrieve;
|
|
512
|
-
async function
|
|
513
|
-
await openai.post(`/
|
|
524
|
+
async function trainingTableAdd(openai, id, correctVote, options) {
|
|
525
|
+
await openai.post(`/score/completions/${id}/training_table`, Object.assign({ body: { correct_vote: correctVote } }, options));
|
|
514
526
|
}
|
|
515
|
-
Completions.
|
|
516
|
-
async function
|
|
517
|
-
await openai.delete(`/
|
|
527
|
+
Completions.trainingTableAdd = trainingTableAdd;
|
|
528
|
+
async function trainingTableDelete(openai, id, options) {
|
|
529
|
+
await openai.delete(`/score/completions/${id}/training_table`, options);
|
|
518
530
|
}
|
|
519
|
-
Completions.
|
|
531
|
+
Completions.trainingTableDelete = trainingTableDelete;
|
|
520
532
|
async function create(openai, body, options) {
|
|
521
533
|
var _a;
|
|
522
|
-
const response = await openai.post("/
|
|
534
|
+
const response = await openai.post("/score/completions", Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
|
|
523
535
|
return response;
|
|
524
536
|
}
|
|
525
537
|
Completions.create = create;
|
|
526
|
-
})(Completions =
|
|
527
|
-
})(
|
|
528
|
-
var QueryTool;
|
|
529
|
-
(function (QueryTool) {
|
|
530
|
-
let Completions;
|
|
531
|
-
(function (Completions) {
|
|
532
|
-
let Response;
|
|
533
|
-
(function (Response) {
|
|
534
|
-
let Streaming;
|
|
535
|
-
(function (Streaming) {
|
|
536
|
-
let ChatCompletionChunk;
|
|
537
|
-
(function (ChatCompletionChunk) {
|
|
538
|
-
function merged(a, b) {
|
|
539
|
-
const id = a.id;
|
|
540
|
-
const [choices, choicesChanged] = Choice.mergedList(a.choices, b.choices);
|
|
541
|
-
const created = a.created;
|
|
542
|
-
const model = a.model;
|
|
543
|
-
const object = a.object;
|
|
544
|
-
const [service_tier, service_tierChanged] = merge(a.service_tier, b.service_tier);
|
|
545
|
-
const [system_fingerprint, system_fingerprintChanged] = merge(a.system_fingerprint, b.system_fingerprint);
|
|
546
|
-
const [usage, usageChanged] = merge(a.usage, b.usage, Chat.Completions.Response.Usage.merged);
|
|
547
|
-
if (choicesChanged ||
|
|
548
|
-
service_tierChanged ||
|
|
549
|
-
system_fingerprintChanged ||
|
|
550
|
-
usageChanged) {
|
|
551
|
-
return [
|
|
552
|
-
Object.assign(Object.assign(Object.assign({ id,
|
|
553
|
-
choices,
|
|
554
|
-
created,
|
|
555
|
-
model,
|
|
556
|
-
object }, (service_tier !== undefined ? { service_tier } : {})), (system_fingerprint !== undefined
|
|
557
|
-
? { system_fingerprint }
|
|
558
|
-
: {})), (usage !== undefined ? { usage } : {})),
|
|
559
|
-
true,
|
|
560
|
-
];
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
return [a, false];
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
ChatCompletionChunk.merged = merged;
|
|
567
|
-
})(ChatCompletionChunk = Streaming.ChatCompletionChunk || (Streaming.ChatCompletionChunk = {}));
|
|
568
|
-
let Choice;
|
|
569
|
-
(function (Choice) {
|
|
570
|
-
function merged(a, b) {
|
|
571
|
-
const [delta, deltaChanged] = merge(a.delta, b.delta, Delta.merged);
|
|
572
|
-
const [finish_reason, finish_reasonChanged] = merge(a.finish_reason, b.finish_reason);
|
|
573
|
-
const index = a.index;
|
|
574
|
-
const [logprobs, logprobsChanged] = merge(a.logprobs, b.logprobs, Chat.Completions.Response.Logprobs.merged);
|
|
575
|
-
if (deltaChanged || finish_reasonChanged || logprobsChanged) {
|
|
576
|
-
return [
|
|
577
|
-
Object.assign({ delta,
|
|
578
|
-
finish_reason,
|
|
579
|
-
index }, (logprobs !== undefined ? { logprobs } : {})),
|
|
580
|
-
true,
|
|
581
|
-
];
|
|
582
|
-
}
|
|
583
|
-
else {
|
|
584
|
-
return [a, false];
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
Choice.merged = merged;
|
|
588
|
-
function mergedList(a, b) {
|
|
589
|
-
let merged = undefined;
|
|
590
|
-
for (const choice of b) {
|
|
591
|
-
const existingIndex = a.findIndex(({ index }) => index === choice.index);
|
|
592
|
-
if (existingIndex === -1) {
|
|
593
|
-
if (merged === undefined) {
|
|
594
|
-
merged = [...a, choice];
|
|
595
|
-
}
|
|
596
|
-
else {
|
|
597
|
-
merged.push(choice);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
const [mergedChoice, choiceChanged] = Choice.merged(a[existingIndex], choice);
|
|
602
|
-
if (choiceChanged) {
|
|
603
|
-
if (merged === undefined) {
|
|
604
|
-
merged = [...a];
|
|
605
|
-
}
|
|
606
|
-
merged[existingIndex] = mergedChoice;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
return merged ? [merged, true] : [a, false];
|
|
611
|
-
}
|
|
612
|
-
Choice.mergedList = mergedList;
|
|
613
|
-
})(Choice = Streaming.Choice || (Streaming.Choice = {}));
|
|
614
|
-
let Delta;
|
|
615
|
-
(function (Delta) {
|
|
616
|
-
function merged(a, b) {
|
|
617
|
-
const [content, contentChanged] = merge(a.content, b.content, mergedString);
|
|
618
|
-
const [reasoning, reasoningChanged] = merge(a.reasoning, b.reasoning, Reasoning.merged);
|
|
619
|
-
const [refusal, refusalChanged] = merge(a.refusal, b.refusal, mergedString);
|
|
620
|
-
const [role, roleChanged] = merge(a.role, b.role);
|
|
621
|
-
const [tool_calls, tool_callsChanged] = merge(a.tool_calls, b.tool_calls, Chat.Completions.Response.Streaming.ToolCall.mergedList);
|
|
622
|
-
if (contentChanged ||
|
|
623
|
-
reasoningChanged ||
|
|
624
|
-
refusalChanged ||
|
|
625
|
-
roleChanged ||
|
|
626
|
-
tool_callsChanged) {
|
|
627
|
-
return [
|
|
628
|
-
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (content !== undefined ? { content } : {})), (reasoning !== undefined ? { reasoning } : {})), (refusal !== undefined ? { refusal } : {})), (role !== undefined ? { role } : {})), (tool_calls !== undefined ? { tool_calls } : {})),
|
|
629
|
-
true,
|
|
630
|
-
];
|
|
631
|
-
}
|
|
632
|
-
else {
|
|
633
|
-
return [a, false];
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
Delta.merged = merged;
|
|
637
|
-
})(Delta = Streaming.Delta || (Streaming.Delta = {}));
|
|
638
|
-
let Reasoning;
|
|
639
|
-
(function (Reasoning) {
|
|
640
|
-
function merged(a, b) {
|
|
641
|
-
let merged = undefined;
|
|
642
|
-
if (Array.isArray(a)) {
|
|
643
|
-
if (Array.isArray(b)) {
|
|
644
|
-
for (const item of b) {
|
|
645
|
-
if (merged === undefined) {
|
|
646
|
-
const existingIndex = a.findIndex(({ index, type }) => index === item.index && type === item.type);
|
|
647
|
-
if (existingIndex === -1) {
|
|
648
|
-
merged = [...a, item];
|
|
649
|
-
}
|
|
650
|
-
else if (item.type === "query") {
|
|
651
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryCompletion.merged(a[existingIndex], item);
|
|
652
|
-
if (itemChanged) {
|
|
653
|
-
merged = [...a];
|
|
654
|
-
merged[existingIndex] = mergedItem;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
else if (item.type === "chat") {
|
|
658
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(a[existingIndex], item);
|
|
659
|
-
if (itemChanged) {
|
|
660
|
-
merged = [...a];
|
|
661
|
-
merged[existingIndex] = mergedItem;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
else if (Array.isArray(merged) /* always true */) {
|
|
666
|
-
const existingIndex = merged.findIndex(({ index, type }) => index === item.index && type === item.type);
|
|
667
|
-
if (existingIndex === -1) {
|
|
668
|
-
merged.push(item);
|
|
669
|
-
}
|
|
670
|
-
else if (item.type === "query") {
|
|
671
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryCompletion.merged(merged[existingIndex], item);
|
|
672
|
-
if (itemChanged) {
|
|
673
|
-
merged[existingIndex] = mergedItem;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
else if (item.type === "chat") {
|
|
677
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(merged[existingIndex], item);
|
|
678
|
-
if (itemChanged) {
|
|
679
|
-
merged[existingIndex] = mergedItem;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
else {
|
|
686
|
-
const existingIndex = a.findIndex(({ index, type }) => index === b.index && type === b.type);
|
|
687
|
-
if (existingIndex === -1) {
|
|
688
|
-
merged = [...a, b];
|
|
689
|
-
}
|
|
690
|
-
else if (b.type === "query") {
|
|
691
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryCompletion.merged(a[existingIndex], b);
|
|
692
|
-
if (itemChanged) {
|
|
693
|
-
merged = [...a];
|
|
694
|
-
merged[existingIndex] = mergedItem;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
else if (b.type === "chat") {
|
|
698
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(a[existingIndex], b);
|
|
699
|
-
if (itemChanged) {
|
|
700
|
-
merged = [...a];
|
|
701
|
-
merged[existingIndex] = mergedItem;
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
else {
|
|
707
|
-
if (Array.isArray(b)) {
|
|
708
|
-
merged = [a];
|
|
709
|
-
for (const item of b) {
|
|
710
|
-
const existingIndex = merged.findIndex(({ index, type }) => index === item.index && type === item.type);
|
|
711
|
-
if (existingIndex === -1) {
|
|
712
|
-
merged.push(item);
|
|
713
|
-
}
|
|
714
|
-
else if (item.type === "query") {
|
|
715
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryCompletion.merged(merged[existingIndex], item);
|
|
716
|
-
if (itemChanged) {
|
|
717
|
-
merged[existingIndex] = mergedItem;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
else if (item.type === "chat") {
|
|
721
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(merged[existingIndex], item);
|
|
722
|
-
if (itemChanged) {
|
|
723
|
-
merged[existingIndex] = mergedItem;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
else {
|
|
729
|
-
if (a.index === b.index && a.type === b.type) {
|
|
730
|
-
if (b.type === "query") {
|
|
731
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryCompletion.merged(a, b);
|
|
732
|
-
if (itemChanged) {
|
|
733
|
-
merged = mergedItem;
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
else if (b.type === "chat") {
|
|
737
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(a, b);
|
|
738
|
-
if (itemChanged) {
|
|
739
|
-
merged = mergedItem;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
else {
|
|
744
|
-
merged = [a, b];
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
return merged ? [merged, true] : [a, false];
|
|
749
|
-
}
|
|
750
|
-
Reasoning.merged = merged;
|
|
751
|
-
})(Reasoning = Streaming.Reasoning || (Streaming.Reasoning = {}));
|
|
752
|
-
let ReasoningCompletion;
|
|
753
|
-
(function (ReasoningCompletion) {
|
|
754
|
-
let QueryCompletion;
|
|
755
|
-
(function (QueryCompletion) {
|
|
756
|
-
function merged(a, b) {
|
|
757
|
-
const [merged, changed] = Query.Completions.Response.Streaming.ChatCompletionChunk.merged(a, b);
|
|
758
|
-
return changed
|
|
759
|
-
? [Object.assign({ type: a.type, index: a.index }, merged), true]
|
|
760
|
-
: [a, false];
|
|
761
|
-
}
|
|
762
|
-
QueryCompletion.merged = merged;
|
|
763
|
-
})(QueryCompletion = ReasoningCompletion.QueryCompletion || (ReasoningCompletion.QueryCompletion = {}));
|
|
764
|
-
let ChatCompletion;
|
|
765
|
-
(function (ChatCompletion) {
|
|
766
|
-
function merged(a, b) {
|
|
767
|
-
const [merged, changed] = Chat.Completions.Response.Streaming.ChatCompletionChunk.merged(a, b);
|
|
768
|
-
return changed
|
|
769
|
-
? [Object.assign({ type: a.type, index: a.index }, merged), true]
|
|
770
|
-
: [a, false];
|
|
771
|
-
}
|
|
772
|
-
ChatCompletion.merged = merged;
|
|
773
|
-
})(ChatCompletion = ReasoningCompletion.ChatCompletion || (ReasoningCompletion.ChatCompletion = {}));
|
|
774
|
-
})(ReasoningCompletion = Streaming.ReasoningCompletion || (Streaming.ReasoningCompletion = {}));
|
|
775
|
-
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
776
|
-
})(Response = Completions.Response || (Completions.Response = {}));
|
|
777
|
-
async function list(openai, listOptions, options) {
|
|
778
|
-
const response = await openai.get("/query_tool/completions", Object.assign({ query: listOptions }, options));
|
|
779
|
-
return response;
|
|
780
|
-
}
|
|
781
|
-
Completions.list = list;
|
|
782
|
-
async function publish(openai, id, options) {
|
|
783
|
-
await openai.post(`/query_tool/completions/${id}/publish`, options);
|
|
784
|
-
}
|
|
785
|
-
Completions.publish = publish;
|
|
786
|
-
async function retrieve(openai, id, options) {
|
|
787
|
-
const response = await openai.get(`/query_tool/completions/${id}`, options);
|
|
788
|
-
return response;
|
|
789
|
-
}
|
|
790
|
-
Completions.retrieve = retrieve;
|
|
791
|
-
async function create(openai, body, options) {
|
|
792
|
-
var _a;
|
|
793
|
-
const response = await openai.post("/query_tool/completions", Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
|
|
794
|
-
return response;
|
|
795
|
-
}
|
|
796
|
-
Completions.create = create;
|
|
797
|
-
})(Completions = QueryTool.Completions || (QueryTool.Completions = {}));
|
|
798
|
-
})(QueryTool || (exports.QueryTool = QueryTool = {}));
|
|
799
|
-
var QueryChat;
|
|
800
|
-
(function (QueryChat) {
|
|
801
|
-
let Completions;
|
|
802
|
-
(function (Completions) {
|
|
803
|
-
let Response;
|
|
804
|
-
(function (Response) {
|
|
805
|
-
let Streaming;
|
|
806
|
-
(function (Streaming) {
|
|
807
|
-
let ChatCompletionChunk;
|
|
808
|
-
(function (ChatCompletionChunk) {
|
|
809
|
-
function merged(a, b) {
|
|
810
|
-
const id = a.id;
|
|
811
|
-
const [choices, choicesChanged] = Choice.mergedList(a.choices, b.choices);
|
|
812
|
-
const created = a.created;
|
|
813
|
-
const model = a.model;
|
|
814
|
-
const object = a.object;
|
|
815
|
-
const [service_tier, service_tierChanged] = merge(a.service_tier, b.service_tier);
|
|
816
|
-
const [system_fingerprint, system_fingerprintChanged] = merge(a.system_fingerprint, b.system_fingerprint);
|
|
817
|
-
const [usage, usageChanged] = merge(a.usage, b.usage, Chat.Completions.Response.Usage.merged);
|
|
818
|
-
if (choicesChanged ||
|
|
819
|
-
service_tierChanged ||
|
|
820
|
-
system_fingerprintChanged ||
|
|
821
|
-
usageChanged) {
|
|
822
|
-
return [
|
|
823
|
-
Object.assign(Object.assign(Object.assign({ id,
|
|
824
|
-
choices,
|
|
825
|
-
created,
|
|
826
|
-
model,
|
|
827
|
-
object }, (service_tier !== undefined ? { service_tier } : {})), (system_fingerprint !== undefined
|
|
828
|
-
? { system_fingerprint }
|
|
829
|
-
: {})), (usage !== undefined ? { usage } : {})),
|
|
830
|
-
true,
|
|
831
|
-
];
|
|
832
|
-
}
|
|
833
|
-
else {
|
|
834
|
-
return [a, false];
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
ChatCompletionChunk.merged = merged;
|
|
838
|
-
})(ChatCompletionChunk = Streaming.ChatCompletionChunk || (Streaming.ChatCompletionChunk = {}));
|
|
839
|
-
let Choice;
|
|
840
|
-
(function (Choice) {
|
|
841
|
-
function merged(a, b) {
|
|
842
|
-
const [delta, deltaChanged] = merge(a.delta, b.delta, Delta.merged);
|
|
843
|
-
const [finish_reason, finish_reasonChanged] = merge(a.finish_reason, b.finish_reason);
|
|
844
|
-
const index = a.index;
|
|
845
|
-
const [logprobs, logprobsChanged] = merge(a.logprobs, b.logprobs, Chat.Completions.Response.Logprobs.merged);
|
|
846
|
-
if (deltaChanged || finish_reasonChanged || logprobsChanged) {
|
|
847
|
-
return [
|
|
848
|
-
Object.assign({ delta,
|
|
849
|
-
finish_reason,
|
|
850
|
-
index }, (logprobs !== undefined ? { logprobs } : {})),
|
|
851
|
-
true,
|
|
852
|
-
];
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
return [a, false];
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
Choice.merged = merged;
|
|
859
|
-
function mergedList(a, b) {
|
|
860
|
-
let merged = undefined;
|
|
861
|
-
for (const choice of b) {
|
|
862
|
-
const existingIndex = a.findIndex(({ index }) => index === choice.index);
|
|
863
|
-
if (existingIndex === -1) {
|
|
864
|
-
if (merged === undefined) {
|
|
865
|
-
merged = [...a, choice];
|
|
866
|
-
}
|
|
867
|
-
else {
|
|
868
|
-
merged.push(choice);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
else {
|
|
872
|
-
const [mergedChoice, choiceChanged] = Choice.merged(a[existingIndex], choice);
|
|
873
|
-
if (choiceChanged) {
|
|
874
|
-
if (merged === undefined) {
|
|
875
|
-
merged = [...a];
|
|
876
|
-
}
|
|
877
|
-
merged[existingIndex] = mergedChoice;
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
return merged ? [merged, true] : [a, false];
|
|
882
|
-
}
|
|
883
|
-
Choice.mergedList = mergedList;
|
|
884
|
-
})(Choice = Streaming.Choice || (Streaming.Choice = {}));
|
|
885
|
-
let Delta;
|
|
886
|
-
(function (Delta) {
|
|
887
|
-
function merged(a, b) {
|
|
888
|
-
const [content, contentChanged] = merge(a.content, b.content, mergedString);
|
|
889
|
-
const [refusal, refusalChanged] = merge(a.refusal, b.refusal, mergedString);
|
|
890
|
-
const [role, roleChanged] = merge(a.role, b.role);
|
|
891
|
-
const [tool_calls, tool_callsChanged] = merge(a.tool_calls, b.tool_calls, Chat.Completions.Response.Streaming.ToolCall.mergedList);
|
|
892
|
-
const [images, imagesChanged] = merge(a.images, b.images, Chat.Completions.Response.Image.mergedList);
|
|
893
|
-
const [reasoning, reasoningChanged] = merge(a.reasoning, b.reasoning, Reasoning.merged);
|
|
894
|
-
if (contentChanged ||
|
|
895
|
-
reasoningChanged ||
|
|
896
|
-
refusalChanged ||
|
|
897
|
-
roleChanged ||
|
|
898
|
-
tool_callsChanged) {
|
|
899
|
-
return [
|
|
900
|
-
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (content !== undefined ? { content } : {})), (refusal !== undefined ? { refusal } : {})), (role !== undefined ? { role } : {})), (tool_calls !== undefined ? { tool_calls } : {})), (images !== undefined ? { images } : {})), (reasoning !== undefined ? { reasoning } : {})),
|
|
901
|
-
true,
|
|
902
|
-
];
|
|
903
|
-
}
|
|
904
|
-
else {
|
|
905
|
-
return [a, false];
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
Delta.merged = merged;
|
|
909
|
-
})(Delta = Streaming.Delta || (Streaming.Delta = {}));
|
|
910
|
-
let Reasoning;
|
|
911
|
-
(function (Reasoning) {
|
|
912
|
-
function merged(a, b) {
|
|
913
|
-
let merged = undefined;
|
|
914
|
-
if (Array.isArray(a)) {
|
|
915
|
-
if (Array.isArray(b)) {
|
|
916
|
-
for (const item of b) {
|
|
917
|
-
if (merged === undefined) {
|
|
918
|
-
const existingIndex = a.findIndex(({ index, type }) => index === item.index && type === item.type);
|
|
919
|
-
if (existingIndex === -1) {
|
|
920
|
-
merged = [...a, item];
|
|
921
|
-
}
|
|
922
|
-
else if (item.type === "query_tool") {
|
|
923
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryToolCompletion.merged(a[existingIndex], item);
|
|
924
|
-
if (itemChanged) {
|
|
925
|
-
merged = [...a];
|
|
926
|
-
merged[existingIndex] = mergedItem;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
else if (item.type === "chat") {
|
|
930
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(a[existingIndex], item);
|
|
931
|
-
if (itemChanged) {
|
|
932
|
-
merged = [...a];
|
|
933
|
-
merged[existingIndex] = mergedItem;
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
else if (Array.isArray(merged) /* always true */) {
|
|
938
|
-
const existingIndex = merged.findIndex(({ index, type }) => index === item.index && type === item.type);
|
|
939
|
-
if (existingIndex === -1) {
|
|
940
|
-
merged.push(item);
|
|
941
|
-
}
|
|
942
|
-
else if (item.type === "query_tool") {
|
|
943
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryToolCompletion.merged(merged[existingIndex], item);
|
|
944
|
-
if (itemChanged) {
|
|
945
|
-
merged[existingIndex] = mergedItem;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
else if (item.type === "chat") {
|
|
949
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(merged[existingIndex], item);
|
|
950
|
-
if (itemChanged) {
|
|
951
|
-
merged[existingIndex] = mergedItem;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
else {
|
|
958
|
-
const existingIndex = a.findIndex(({ index, type }) => index === b.index && type === b.type);
|
|
959
|
-
if (existingIndex === -1) {
|
|
960
|
-
merged = [...a, b];
|
|
961
|
-
}
|
|
962
|
-
else if (b.type === "query_tool") {
|
|
963
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryToolCompletion.merged(a[existingIndex], b);
|
|
964
|
-
if (itemChanged) {
|
|
965
|
-
merged = [...a];
|
|
966
|
-
merged[existingIndex] = mergedItem;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
else if (b.type === "chat") {
|
|
970
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(a[existingIndex], b);
|
|
971
|
-
if (itemChanged) {
|
|
972
|
-
merged = [...a];
|
|
973
|
-
merged[existingIndex] = mergedItem;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
else {
|
|
979
|
-
if (Array.isArray(b)) {
|
|
980
|
-
merged = [a];
|
|
981
|
-
for (const item of b) {
|
|
982
|
-
const existingIndex = merged.findIndex(({ index, type }) => index === item.index && type === item.type);
|
|
983
|
-
if (existingIndex === -1) {
|
|
984
|
-
merged.push(item);
|
|
985
|
-
}
|
|
986
|
-
else if (item.type === "query_tool") {
|
|
987
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryToolCompletion.merged(merged[existingIndex], item);
|
|
988
|
-
if (itemChanged) {
|
|
989
|
-
merged[existingIndex] = mergedItem;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
else if (item.type === "chat") {
|
|
993
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(merged[existingIndex], item);
|
|
994
|
-
if (itemChanged) {
|
|
995
|
-
merged[existingIndex] = mergedItem;
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
else {
|
|
1001
|
-
if (a.index === b.index && a.type === b.type) {
|
|
1002
|
-
if (b.type === "query_tool") {
|
|
1003
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.QueryToolCompletion.merged(a, b);
|
|
1004
|
-
if (itemChanged) {
|
|
1005
|
-
merged = mergedItem;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
else if (b.type === "chat") {
|
|
1009
|
-
const [mergedItem, itemChanged] = ReasoningCompletion.ChatCompletion.merged(a, b);
|
|
1010
|
-
if (itemChanged) {
|
|
1011
|
-
merged = mergedItem;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
else {
|
|
1016
|
-
merged = [a, b];
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
return merged ? [merged, true] : [a, false];
|
|
1021
|
-
}
|
|
1022
|
-
Reasoning.merged = merged;
|
|
1023
|
-
})(Reasoning = Streaming.Reasoning || (Streaming.Reasoning = {}));
|
|
1024
|
-
let ReasoningCompletion;
|
|
1025
|
-
(function (ReasoningCompletion) {
|
|
1026
|
-
let QueryToolCompletion;
|
|
1027
|
-
(function (QueryToolCompletion) {
|
|
1028
|
-
function merged(a, b) {
|
|
1029
|
-
const [merged, changed] = QueryTool.Completions.Response.Streaming.ChatCompletionChunk.merged(a, b);
|
|
1030
|
-
const [error, errorChanged] = merge(a.error, b.error);
|
|
1031
|
-
return changed || errorChanged
|
|
1032
|
-
? [
|
|
1033
|
-
Object.assign(Object.assign({ index: a.index, type: a.type, tool_call_id: a.tool_call_id }, merged), { error }),
|
|
1034
|
-
true,
|
|
1035
|
-
]
|
|
1036
|
-
: [a, false];
|
|
1037
|
-
}
|
|
1038
|
-
QueryToolCompletion.merged = merged;
|
|
1039
|
-
})(QueryToolCompletion = ReasoningCompletion.QueryToolCompletion || (ReasoningCompletion.QueryToolCompletion = {}));
|
|
1040
|
-
let ChatCompletion;
|
|
1041
|
-
(function (ChatCompletion) {
|
|
1042
|
-
function merged(a, b) {
|
|
1043
|
-
const [merged, changed] = Chat.Completions.Response.Streaming.ChatCompletionChunk.merged(a, b);
|
|
1044
|
-
const [error, errorChanged] = merge(a.error, b.error);
|
|
1045
|
-
return changed || errorChanged
|
|
1046
|
-
? [Object.assign(Object.assign({ index: a.index, type: a.type }, merged), { error }), true]
|
|
1047
|
-
: [a, false];
|
|
1048
|
-
}
|
|
1049
|
-
ChatCompletion.merged = merged;
|
|
1050
|
-
})(ChatCompletion = ReasoningCompletion.ChatCompletion || (ReasoningCompletion.ChatCompletion = {}));
|
|
1051
|
-
})(ReasoningCompletion = Streaming.ReasoningCompletion || (Streaming.ReasoningCompletion = {}));
|
|
1052
|
-
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
1053
|
-
})(Response = Completions.Response || (Completions.Response = {}));
|
|
1054
|
-
async function list(openai, listOptions, options) {
|
|
1055
|
-
const response = await openai.get("/query_chat/completions", Object.assign({ query: listOptions }, options));
|
|
1056
|
-
return response;
|
|
1057
|
-
}
|
|
1058
|
-
Completions.list = list;
|
|
1059
|
-
async function publish(openai, id, options) {
|
|
1060
|
-
await openai.post(`/query_chat/completions/${id}/publish`, options);
|
|
1061
|
-
}
|
|
1062
|
-
Completions.publish = publish;
|
|
1063
|
-
async function retrieve(openai, id, options) {
|
|
1064
|
-
const response = await openai.get(`/query_chat/completions/${id}`, options);
|
|
1065
|
-
return response;
|
|
1066
|
-
}
|
|
1067
|
-
Completions.retrieve = retrieve;
|
|
1068
|
-
async function create(openai, body, options) {
|
|
1069
|
-
var _a;
|
|
1070
|
-
const response = await openai.post("/query_chat/completions", Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
|
|
1071
|
-
return response;
|
|
1072
|
-
}
|
|
1073
|
-
Completions.create = create;
|
|
1074
|
-
})(Completions = QueryChat.Completions || (QueryChat.Completions = {}));
|
|
1075
|
-
})(QueryChat || (exports.QueryChat = QueryChat = {}));
|
|
538
|
+
})(Completions = Score.Completions || (Score.Completions = {}));
|
|
539
|
+
})(Score || (exports.Score = Score = {}));
|
|
1076
540
|
var Models;
|
|
1077
541
|
(function (Models) {
|
|
1078
542
|
async function list(openai, listOptions, options) {
|
|
@@ -1149,42 +613,52 @@ var Metadata;
|
|
|
1149
613
|
}
|
|
1150
614
|
Metadata.get = get;
|
|
1151
615
|
})(Metadata || (exports.Metadata = Metadata = {}));
|
|
1152
|
-
var
|
|
1153
|
-
(function (
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
616
|
+
var ScoreLlm;
|
|
617
|
+
(function (ScoreLlm) {
|
|
618
|
+
async function list(openai, listOptions, options) {
|
|
619
|
+
const response = await openai.get("/score/llms", Object.assign({ query: listOptions }, options));
|
|
620
|
+
return response;
|
|
621
|
+
}
|
|
622
|
+
ScoreLlm.list = list;
|
|
623
|
+
async function count(openai, options) {
|
|
624
|
+
const response = await openai.get("/score/llms/count", options);
|
|
625
|
+
return response;
|
|
626
|
+
}
|
|
627
|
+
ScoreLlm.count = count;
|
|
628
|
+
async function retrieve(openai, model, retrieveOptions, options) {
|
|
629
|
+
const response = await openai.get(`/score/llms/${model}`, Object.assign({ query: retrieveOptions }, options));
|
|
630
|
+
return response;
|
|
631
|
+
}
|
|
632
|
+
ScoreLlm.retrieve = retrieve;
|
|
633
|
+
async function retrieveValidate(openai, model, retrieveOptions, options) {
|
|
634
|
+
const response = await openai.post("/score/llms", Object.assign({ query: retrieveOptions, body: model }, options));
|
|
635
|
+
return response;
|
|
636
|
+
}
|
|
637
|
+
ScoreLlm.retrieveValidate = retrieveValidate;
|
|
638
|
+
})(ScoreLlm || (exports.ScoreLlm = ScoreLlm = {}));
|
|
639
|
+
var ScoreModel;
|
|
640
|
+
(function (ScoreModel) {
|
|
1167
641
|
async function list(openai, listOptions, options) {
|
|
1168
|
-
const response = await openai.get("/
|
|
642
|
+
const response = await openai.get("/score/models", Object.assign({ query: listOptions }, options));
|
|
1169
643
|
return response;
|
|
1170
644
|
}
|
|
1171
|
-
|
|
645
|
+
ScoreModel.list = list;
|
|
1172
646
|
async function count(openai, options) {
|
|
1173
|
-
const response = await openai.get("/
|
|
647
|
+
const response = await openai.get("/score/models/count", options);
|
|
1174
648
|
return response;
|
|
1175
649
|
}
|
|
1176
|
-
|
|
650
|
+
ScoreModel.count = count;
|
|
1177
651
|
async function retrieve(openai, model, retrieveOptions, options) {
|
|
1178
|
-
const response = await openai.get(`/
|
|
652
|
+
const response = await openai.get(`/score/models/${model}`, Object.assign({ query: retrieveOptions }, options));
|
|
1179
653
|
return response;
|
|
1180
654
|
}
|
|
1181
|
-
|
|
655
|
+
ScoreModel.retrieve = retrieve;
|
|
1182
656
|
async function retrieveValidate(openai, model, retrieveOptions, options) {
|
|
1183
|
-
const response = await openai.post("/
|
|
657
|
+
const response = await openai.post("/score/models", Object.assign({ query: retrieveOptions, body: model }, options));
|
|
1184
658
|
return response;
|
|
1185
659
|
}
|
|
1186
|
-
|
|
1187
|
-
})(
|
|
660
|
+
ScoreModel.retrieveValidate = retrieveValidate;
|
|
661
|
+
})(ScoreModel || (exports.ScoreModel = ScoreModel = {}));
|
|
1188
662
|
function merge(a, b, combine) {
|
|
1189
663
|
if (a !== null && a !== undefined && b !== null && b !== undefined) {
|
|
1190
664
|
return combine ? combine(a, b) : [a, false];
|