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