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.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare namespace Chat {
61
61
  }
62
62
  }
63
63
  }
64
- type ReasoningEffort = "low" | "medium" | "high";
64
+ type ReasoningEffort = "minimal" | "low" | "medium" | "high";
65
65
  type ResponseFormat = ResponseFormat.Text | ResponseFormat.JsonObject | ResponseFormat.JsonSchema;
66
66
  namespace ResponseFormat {
67
67
  interface Text {
@@ -132,108 +132,85 @@ export declare namespace Chat {
132
132
  }
133
133
  }
134
134
  }
135
- type Message = Message.Developer | Message.System | Message.User | Message.Assistant | Message.Tool;
135
+ type Message = Message.Developer | Message.System | Message.User | Message.Assistant | Message.Tool | Message.ChatCompletion | Message.ScoreCompletion;
136
136
  namespace Message {
137
- interface Developer {
138
- role: "developer";
139
- content: Developer.Content;
140
- name?: string;
137
+ type SimpleContent = string | SimpleContentPart[];
138
+ interface SimpleContentPart {
139
+ text: string;
140
+ type: "text";
141
141
  }
142
- namespace Developer {
143
- type Content = string | Content.Part[];
144
- namespace Content {
145
- interface Part {
146
- text: string;
147
- type: "text";
142
+ type RichContent = string | RichContentPart[];
143
+ type RichContentPart = RichContentPart.Text | RichContentPart.ImageUrl | RichContentPart.InputAudio | RichContentPart.InputVideo | RichContentPart.File;
144
+ namespace RichContentPart {
145
+ interface Text {
146
+ text: string;
147
+ type: "text";
148
+ }
149
+ interface ImageUrl {
150
+ image_url: ImageUrl.Definition;
151
+ type: "image_url";
152
+ }
153
+ namespace ImageUrl {
154
+ interface Definition {
155
+ url: string;
156
+ detail?: ImageUrl.Detail | null;
148
157
  }
158
+ type Detail = "auto" | "low" | "high";
159
+ }
160
+ interface InputAudio {
161
+ input_audio: InputAudio.Definition;
162
+ type: "input_audio";
149
163
  }
164
+ namespace InputAudio {
165
+ interface Definition {
166
+ data: string;
167
+ format: Format;
168
+ }
169
+ type Format = "wav" | "mp3";
170
+ }
171
+ interface InputVideo {
172
+ video_url: InputVideo.Definition;
173
+ }
174
+ namespace InputVideo {
175
+ interface Definition {
176
+ url: string;
177
+ }
178
+ }
179
+ interface File {
180
+ file: File.Definition;
181
+ type: "file";
182
+ }
183
+ namespace File {
184
+ interface Definition {
185
+ file_data?: string | null;
186
+ file_id?: string | null;
187
+ filename?: string | null;
188
+ }
189
+ }
190
+ }
191
+ interface Developer {
192
+ role: "developer";
193
+ content: SimpleContent;
194
+ name?: string;
150
195
  }
151
196
  interface System {
152
197
  role: "system";
153
- content: System.Content;
198
+ content: SimpleContent;
154
199
  name?: string;
155
200
  }
156
- namespace System {
157
- type Content = string | Content.Part[];
158
- namespace Content {
159
- interface Part {
160
- text: string;
161
- type: "text";
162
- }
163
- }
164
- }
165
201
  interface User {
166
202
  role: "user";
167
- content: User.Content;
203
+ content: RichContent;
168
204
  name?: string;
169
205
  }
170
- namespace User {
171
- type Content = string | Content.Part[];
172
- namespace Content {
173
- type Part = Part.Text | Part.ImageUrl | Part.InputAudio | Part.File;
174
- namespace Part {
175
- interface Text {
176
- text: string;
177
- type: "text";
178
- }
179
- interface ImageUrl {
180
- image_url: ImageUrl.Definition;
181
- type: "image_url";
182
- }
183
- namespace ImageUrl {
184
- interface Definition {
185
- url: string;
186
- detail?: ImageUrl.Detail | null;
187
- }
188
- type Detail = "auto" | "low" | "high";
189
- }
190
- interface InputAudio {
191
- input_audio: InputAudio.Definition;
192
- type: "input_audio";
193
- }
194
- namespace InputAudio {
195
- interface Definition {
196
- data: string;
197
- format: Format;
198
- }
199
- type Format = "wav" | "mp3";
200
- }
201
- interface File {
202
- file: File.Definition;
203
- type: "file";
204
- }
205
- namespace File {
206
- interface Definition {
207
- file_data?: string | null;
208
- file_id?: string | null;
209
- filename?: string | null;
210
- }
211
- }
212
- }
213
- }
214
- }
215
206
  interface Assistant {
216
207
  role: "assistant";
217
- content?: Assistant.Content | null;
208
+ content?: RichContent | null;
218
209
  name?: string | null;
219
210
  refusal?: string | null;
220
211
  tool_calls?: Assistant.ToolCall[] | null;
221
212
  }
222
213
  namespace Assistant {
223
- type Content = string | Content.Part[];
224
- namespace Content {
225
- type Part = Part.Text | Part.Refusal;
226
- namespace Part {
227
- interface Text {
228
- text: string;
229
- type: "text";
230
- }
231
- interface Refusal {
232
- refusal: string;
233
- type: "refusal";
234
- }
235
- }
236
- }
237
214
  type ToolCall = ToolCall.Function;
238
215
  namespace ToolCall {
239
216
  interface Function {
@@ -251,17 +228,20 @@ export declare namespace Chat {
251
228
  }
252
229
  interface Tool {
253
230
  role: "tool";
254
- content?: Tool.Content | null;
231
+ content?: RichContent | null;
255
232
  tool_call_id: string;
256
233
  }
257
- namespace Tool {
258
- type Content = string | Content.Part[];
259
- namespace Content {
260
- interface Part {
261
- text: string;
262
- type: "text";
263
- }
264
- }
234
+ interface ChatCompletion {
235
+ role: "chat_completion";
236
+ id: string;
237
+ choice_index: number;
238
+ name?: string | null;
239
+ }
240
+ interface ScoreCompletion {
241
+ role: "score_completion";
242
+ id: string;
243
+ choice_index: number;
244
+ name?: string | null;
265
245
  }
266
246
  }
267
247
  interface ProviderPreferences {
@@ -503,24 +483,18 @@ export declare namespace Chat {
503
483
  function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
504
484
  }
505
485
  }
506
- export declare namespace Query {
486
+ export declare namespace Score {
507
487
  namespace Completions {
508
488
  namespace Request {
509
489
  interface ChatCompletionCreateParamsBase {
510
490
  messages: Chat.Completions.Request.Message[];
511
491
  model: Model;
512
- logprobs?: boolean | null;
513
- n?: number | null;
514
- prediction?: Chat.Completions.Request.Prediction | null;
515
- response_format?: Chat.Completions.Request.ResponseFormat | null;
516
492
  seed?: number | null;
517
493
  service_tier?: Chat.Completions.Request.ServiceTier | null;
518
494
  stream_options?: Chat.Completions.Request.StreamOptions | null;
519
495
  tools?: Chat.Completions.Request.Tool[] | null;
520
- top_logprobs?: number | null;
521
496
  usage?: Chat.Completions.Request.Usage | null;
522
- embeddings?: string | null;
523
- select_deterministic?: boolean | null;
497
+ choices: Choice[];
524
498
  }
525
499
  interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
526
500
  stream: true;
@@ -529,7 +503,20 @@ export declare namespace Query {
529
503
  stream?: false | null;
530
504
  }
531
505
  type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
532
- type Model = string | QueryModelBase;
506
+ type Model = string | ScoreModelBase;
507
+ type Choice = string | Choice.ChatCompletion | Choice.ScoreCompletion;
508
+ namespace Choice {
509
+ interface ChatCompletion {
510
+ type: "chat_completion";
511
+ id: string;
512
+ choice_index: number;
513
+ }
514
+ interface ScoreCompletion {
515
+ type: "score_completion";
516
+ id: string;
517
+ choice_index: number;
518
+ }
519
+ }
533
520
  }
534
521
  namespace Response {
535
522
  namespace Streaming {
@@ -539,33 +526,34 @@ export declare namespace Query {
539
526
  created: number;
540
527
  model: string;
541
528
  object: "chat.completion.chunk";
542
- service_tier?: Chat.Completions.Response.ServiceTier;
543
- system_fingerprint?: string;
544
529
  usage?: Chat.Completions.Response.Usage;
545
- training_table_data?: TrainingTableData;
530
+ weight_data?: WeightData;
546
531
  }
547
532
  namespace ChatCompletionChunk {
548
533
  function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
549
534
  }
550
535
  interface Choice {
551
- delta: Chat.Completions.Response.Streaming.Delta;
536
+ delta: Delta;
552
537
  finish_reason: Chat.Completions.Response.FinishReason | null;
553
538
  index: number;
554
539
  logprobs?: Chat.Completions.Response.Logprobs;
555
- generate_id?: string;
556
- confidence_id?: ConfidenceId;
557
- confidence_weight?: number;
540
+ weight?: number;
558
541
  confidence?: number;
559
- embedding?: EmbeddingsResponse | ObjectiveAIError;
560
542
  error?: ObjectiveAIError;
561
- model: string;
562
- model_index: number | null;
563
- completion_metadata: CompletionMetadata;
543
+ model?: string;
544
+ model_index?: number | null;
545
+ completion_metadata?: CompletionMetadata;
564
546
  }
565
547
  namespace Choice {
566
548
  function merged(a: Choice, b: Choice): [Choice, boolean];
567
549
  function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
568
550
  }
551
+ interface Delta extends Chat.Completions.Response.Streaming.Delta {
552
+ vote?: number[];
553
+ }
554
+ namespace Delta {
555
+ function merged(a: Delta, b: Delta): [Delta, boolean];
556
+ }
569
557
  }
570
558
  namespace Unary {
571
559
  interface ChatCompletion {
@@ -574,30 +562,34 @@ export declare namespace Query {
574
562
  created: number;
575
563
  model: string;
576
564
  object: "chat.completion";
577
- service_tier?: Chat.Completions.Response.ServiceTier;
578
- system_fingerprint?: string;
579
565
  usage?: Chat.Completions.Response.Usage;
580
- training_table_data?: TrainingTableData;
566
+ weight_data?: WeightData | null;
581
567
  }
582
568
  interface Choice {
583
- message: Chat.Completions.Response.Unary.Message;
569
+ message: Message;
584
570
  finish_reason: Chat.Completions.Response.FinishReason;
585
571
  index: number;
586
572
  logprobs: Chat.Completions.Response.Logprobs | null;
587
- generate_id: string | null;
588
- confidence_id: ConfidenceId | null;
589
- confidence_weight: number | null;
573
+ weight: number | null;
590
574
  confidence: number | null;
591
- embedding?: EmbeddingsResponse | ObjectiveAIError;
592
- error?: ObjectiveAIError;
593
- model: string;
575
+ error: ObjectiveAIError | null;
576
+ model: string | null;
594
577
  model_index: number | null;
595
- completion_metadata: CompletionMetadata;
578
+ completion_metadata: CompletionMetadata | null;
579
+ }
580
+ interface Message extends Chat.Completions.Response.Unary.Message {
581
+ vote: number[] | null;
596
582
  }
597
583
  }
598
- interface TrainingTableData {
599
- response_format_hash: string;
600
- embeddings_response: EmbeddingsResponse;
584
+ type WeightData = WeightData.Static | WeightData.TrainingTable;
585
+ namespace WeightData {
586
+ interface Static {
587
+ type: "static";
588
+ }
589
+ interface TrainingTable {
590
+ type: "training_table";
591
+ embeddings_response: EmbeddingsResponse;
592
+ }
601
593
  }
602
594
  interface EmbeddingsResponse {
603
595
  data: EmbeddingsResponse.Embedding[];
@@ -624,357 +616,6 @@ export declare namespace Query {
624
616
  namespace CompletionMetadata {
625
617
  function merged(a: CompletionMetadata, b: CompletionMetadata): [CompletionMetadata, boolean];
626
618
  }
627
- type ConfidenceId = string | Record<string, number>;
628
- }
629
- function list(openai: OpenAI, listOptions?: Chat.Completions.ListOptions, options?: OpenAI.RequestOptions): Promise<{
630
- data: Chat.Completions.ListItem[];
631
- }>;
632
- function publish(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
633
- function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
634
- request: Request.ChatCompletionCreateParams;
635
- response: Response.Unary.ChatCompletion;
636
- correct_confidence_id?: string;
637
- }>;
638
- function trainingTableMark(openai: OpenAI, id: string, correctConfidenceId: string, options?: OpenAI.RequestOptions): Promise<void>;
639
- function trainingTableUnmark(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
640
- function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
641
- function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
642
- }
643
- }
644
- export declare namespace QueryTool {
645
- namespace Completions {
646
- namespace Request {
647
- interface ChatCompletionCreateParamsBase {
648
- messages: Chat.Completions.Request.Message[];
649
- model: Query.Completions.Request.Model;
650
- logprobs?: boolean | null;
651
- n?: number | null;
652
- prediction?: Chat.Completions.Request.Prediction | null;
653
- response_format: ResponseFormat;
654
- seed?: number | null;
655
- service_tier?: Chat.Completions.Request.ServiceTier | null;
656
- stream_options?: Chat.Completions.Request.StreamOptions | null;
657
- tools?: Chat.Completions.Request.Tool[] | null;
658
- top_logprobs?: number | null;
659
- usage?: Chat.Completions.Request.Usage | null;
660
- embeddings?: string | null;
661
- }
662
- interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
663
- stream: true;
664
- }
665
- interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
666
- stream?: false | null;
667
- }
668
- type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
669
- type ResponseFormat = ResponseFormat.Simple | ResponseFormat.NumberQuery | ResponseFormat.MultipleChoiceQuery | ResponseFormat.MultipleChoiceOptionsQuery | ResponseFormat.WeightedAverageChoiceQuery;
670
- namespace ResponseFormat {
671
- type Simple = {
672
- tool: "simple_query";
673
- top?: number | null;
674
- select_deterministic?: boolean | null;
675
- } | ({
676
- tool: "simple_query";
677
- top?: number | null;
678
- select_deterministic?: boolean | null;
679
- } & Chat.Completions.Request.ResponseFormat);
680
- interface NumberQuery {
681
- tool: "number_query";
682
- }
683
- interface MultipleChoiceQuery {
684
- tool: "multiple_choice_query";
685
- choices: string[];
686
- }
687
- interface MultipleChoiceOptionsQuery {
688
- tool: "multiple_choice_options_query";
689
- min_items: number;
690
- max_items: number;
691
- }
692
- type WeightedAverageChoiceQuery = {
693
- tool: "weighted_average_choice_query";
694
- embeddings_model: string;
695
- select_deterministic?: boolean | null;
696
- } | ({
697
- tool: "weighted_average_choice_query";
698
- embeddings_model: string;
699
- select_deterministic?: boolean | null;
700
- } & Chat.Completions.Request.ResponseFormat);
701
- }
702
- }
703
- namespace Response {
704
- namespace Streaming {
705
- interface ChatCompletionChunk {
706
- id: string;
707
- choices: Choice[];
708
- created: number;
709
- model: Model;
710
- object: "chat.completion.chunk";
711
- service_tier?: Chat.Completions.Response.ServiceTier;
712
- system_fingerprint?: string;
713
- usage?: Chat.Completions.Response.Usage;
714
- }
715
- namespace ChatCompletionChunk {
716
- function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
717
- }
718
- interface Choice {
719
- delta: Delta;
720
- finish_reason: Chat.Completions.Response.FinishReason | null;
721
- index: number;
722
- logprobs?: Chat.Completions.Response.Logprobs;
723
- }
724
- namespace Choice {
725
- function merged(a: Choice, b: Choice): [Choice, boolean];
726
- function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
727
- }
728
- interface Delta {
729
- content?: string;
730
- refusal?: string;
731
- role?: Chat.Completions.Response.Role;
732
- tool_calls?: Chat.Completions.Response.Streaming.ToolCall[];
733
- reasoning?: Reasoning;
734
- }
735
- namespace Delta {
736
- function merged(a: Delta, b: Delta): [Delta, boolean];
737
- }
738
- type Reasoning = ReasoningCompletion | ReasoningCompletion[];
739
- namespace Reasoning {
740
- function merged(a: Reasoning, b: Reasoning): [Reasoning, boolean];
741
- }
742
- type ReasoningCompletion = ReasoningCompletion.QueryCompletion | ReasoningCompletion.ChatCompletion;
743
- namespace ReasoningCompletion {
744
- type QueryCompletion = {
745
- index: number;
746
- type: "query";
747
- error?: ObjectiveAIError;
748
- } & Query.Completions.Response.Streaming.ChatCompletionChunk;
749
- namespace QueryCompletion {
750
- function merged(a: QueryCompletion, b: QueryCompletion): [QueryCompletion, boolean];
751
- }
752
- type ChatCompletion = {
753
- index: number;
754
- type: "chat";
755
- error?: ObjectiveAIError;
756
- } & Chat.Completions.Response.Streaming.ChatCompletionChunk;
757
- namespace ChatCompletion {
758
- function merged(a: ChatCompletion, b: ChatCompletion): [ChatCompletion, boolean];
759
- }
760
- }
761
- }
762
- namespace Unary {
763
- interface ChatCompletion {
764
- id: string;
765
- choices: Choice[];
766
- created: number;
767
- model: Model;
768
- object: "chat.completion";
769
- service_tier?: Chat.Completions.Response.ServiceTier;
770
- system_fingerprint?: string;
771
- usage?: Chat.Completions.Response.Usage;
772
- }
773
- interface Choice {
774
- message: Message;
775
- finish_reason: Chat.Completions.Response.FinishReason;
776
- index: number;
777
- logprobs: Chat.Completions.Response.Logprobs | null;
778
- }
779
- interface Message {
780
- content: string | null;
781
- refusal: string | null;
782
- role: Chat.Completions.Response.Role;
783
- annotations?: Chat.Completions.Response.Unary.Annotation[];
784
- audio?: Chat.Completions.Response.Unary.Audio;
785
- tool_calls?: Chat.Completions.Response.Unary.ToolCall[];
786
- reasoning?: Reasoning;
787
- }
788
- type Reasoning = ReasoningCompletion | ReasoningCompletion[];
789
- type ReasoningCompletion = ReasoningCompletion.QueryCompletion | ReasoningCompletion.ChatCompletion;
790
- namespace ReasoningCompletion {
791
- type QueryCompletion = {
792
- index: number;
793
- type: "query";
794
- error?: ObjectiveAIError;
795
- } & Query.Completions.Response.Unary.ChatCompletion;
796
- type ChatCompletion = {
797
- index: number;
798
- type: "chat";
799
- error?: ObjectiveAIError;
800
- } & Chat.Completions.Response.Unary.ChatCompletion;
801
- }
802
- }
803
- type Model = "simple_query" | "number_query" | "multiple_choice_query" | "multiple_choice_options_query" | "weighted_average_choice_query";
804
- }
805
- function list(openai: OpenAI, listOptions?: Chat.Completions.ListOptions, options?: OpenAI.RequestOptions): Promise<{
806
- data: Chat.Completions.ListItem[];
807
- }>;
808
- function publish(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
809
- function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
810
- request: Request.ChatCompletionCreateParams;
811
- response: Response.Unary.ChatCompletion;
812
- }>;
813
- function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
814
- function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
815
- }
816
- }
817
- export declare namespace QueryChat {
818
- namespace Completions {
819
- namespace Request {
820
- interface ChatCompletionCreateParamsBase {
821
- messages: Chat.Completions.Request.Message[];
822
- model: string;
823
- frequency_penalty?: number | null;
824
- logit_bias?: Record<string, number> | null;
825
- logprobs?: boolean | null;
826
- max_completion_tokens?: number | null;
827
- modalities?: string[] | null;
828
- parallel_tool_calls?: boolean | null;
829
- prediction?: Chat.Completions.Request.Prediction | null;
830
- presence_penalty?: number | null;
831
- reasoning_effort?: Chat.Completions.Request.ReasoningEffort | null;
832
- response_format?: Chat.Completions.Request.ResponseFormat | null;
833
- seed?: number | null;
834
- service_tier?: Chat.Completions.Request.ServiceTier | null;
835
- stop?: Chat.Completions.Request.Stop | null;
836
- stream_options?: Chat.Completions.Request.StreamOptions | null;
837
- temperature?: number | null;
838
- top_logprobs?: number | null;
839
- top_p?: number | null;
840
- max_tokens?: number | null;
841
- min_p?: number | null;
842
- provider?: Chat.Completions.Request.ProviderPreferences | null;
843
- reasoning?: Chat.Completions.Request.Reasoning | null;
844
- repetition_penalty?: number | null;
845
- top_a?: number | null;
846
- top_k?: number | null;
847
- usage?: Chat.Completions.Request.Usage | null;
848
- verbosity?: Chat.Completions.Request.Verbosity | null;
849
- models?: string[] | null;
850
- training_table_name?: string | null;
851
- simple_query: QueryToolParams;
852
- multiple_choice_query: QueryToolParams;
853
- multiple_choice_options_query: QueryToolParams;
854
- }
855
- interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
856
- stream: true;
857
- }
858
- interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
859
- stream?: false | null;
860
- }
861
- type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
862
- interface QueryToolParams {
863
- model: Query.Completions.Request.Model;
864
- logprobs?: boolean | null;
865
- n?: number | null;
866
- prediction?: Chat.Completions.Request.Prediction | null;
867
- seed?: number | null;
868
- service_tier?: Chat.Completions.Request.ServiceTier | null;
869
- tools?: Chat.Completions.Request.Tool[] | null;
870
- top_logprobs?: number | null;
871
- embeddings?: string | null;
872
- }
873
- }
874
- namespace Response {
875
- namespace Streaming {
876
- interface ChatCompletionChunk {
877
- id: string;
878
- choices: Choice[];
879
- created: number;
880
- model: string;
881
- object: "chat.completion.chunk";
882
- service_tier?: Chat.Completions.Response.ServiceTier;
883
- system_fingerprint?: string;
884
- usage?: Chat.Completions.Response.Usage;
885
- }
886
- namespace ChatCompletionChunk {
887
- function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
888
- }
889
- interface Choice {
890
- delta: Delta;
891
- finish_reason: Chat.Completions.Response.FinishReason | null;
892
- index: number;
893
- logprobs?: Chat.Completions.Response.Logprobs;
894
- }
895
- namespace Choice {
896
- function merged(a: Choice, b: Choice): [Choice, boolean];
897
- function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
898
- }
899
- interface Delta {
900
- content?: string;
901
- refusal?: string;
902
- role?: Chat.Completions.Response.Role;
903
- tool_calls?: Chat.Completions.Response.Streaming.ToolCall[];
904
- images?: Chat.Completions.Response.Image[];
905
- reasoning?: Reasoning;
906
- }
907
- namespace Delta {
908
- function merged(a: Delta, b: Delta): [Delta, boolean];
909
- }
910
- type Reasoning = ReasoningCompletion | ReasoningCompletion[];
911
- namespace Reasoning {
912
- function merged(a: Reasoning, b: Reasoning): [Reasoning, boolean];
913
- }
914
- type ReasoningCompletion = ReasoningCompletion.QueryToolCompletion | ReasoningCompletion.ChatCompletion;
915
- namespace ReasoningCompletion {
916
- type QueryToolCompletion = {
917
- index: number;
918
- type: "query_tool";
919
- tool_call_id: string;
920
- error?: ObjectiveAIError;
921
- } & QueryTool.Completions.Response.Streaming.ChatCompletionChunk;
922
- namespace QueryToolCompletion {
923
- function merged(a: QueryToolCompletion, b: QueryToolCompletion): [QueryToolCompletion, boolean];
924
- }
925
- type ChatCompletion = {
926
- index: number;
927
- type: "chat";
928
- error?: ObjectiveAIError;
929
- } & Chat.Completions.Response.Streaming.ChatCompletionChunk;
930
- namespace ChatCompletion {
931
- function merged(a: ChatCompletion, b: ChatCompletion): [ChatCompletion, boolean];
932
- }
933
- }
934
- }
935
- namespace Unary {
936
- interface ChatCompletion {
937
- id: string;
938
- choices: Choice[];
939
- created: number;
940
- model: string;
941
- object: "chat.completion";
942
- service_tier?: Chat.Completions.Response.ServiceTier;
943
- system_fingerprint?: string;
944
- usage?: Chat.Completions.Response.Usage;
945
- }
946
- interface Choice {
947
- message: Message;
948
- finish_reason: Chat.Completions.Response.FinishReason;
949
- index: number;
950
- logprobs: Chat.Completions.Response.Logprobs | null;
951
- }
952
- interface Message {
953
- content: string | null;
954
- refusal: string | null;
955
- role: Chat.Completions.Response.Role;
956
- annotations?: Chat.Completions.Response.Unary.Annotation[];
957
- audio?: Chat.Completions.Response.Unary.Audio;
958
- tool_calls?: Chat.Completions.Response.Unary.ToolCall[];
959
- images?: Chat.Completions.Response.Image[];
960
- reasoning?: Reasoning;
961
- }
962
- type Reasoning = ReasoningCompletion | ReasoningCompletion[];
963
- type ReasoningCompletion = ReasoningCompletion.QueryToolCompletion | ReasoningCompletion.ChatCompletion;
964
- namespace ReasoningCompletion {
965
- type QueryToolCompletion = {
966
- index: number;
967
- type: "query_tool";
968
- tool_call_id: string;
969
- error?: ObjectiveAIError;
970
- } & QueryTool.Completions.Response.Unary.ChatCompletion;
971
- type ChatCompletion = {
972
- index: number;
973
- type: "chat";
974
- error?: ObjectiveAIError;
975
- } & Chat.Completions.Response.Unary.ChatCompletion;
976
- }
977
- }
978
619
  }
979
620
  function list(openai: OpenAI, listOptions?: Chat.Completions.ListOptions, options?: OpenAI.RequestOptions): Promise<{
980
621
  data: Chat.Completions.ListItem[];
@@ -983,7 +624,11 @@ export declare namespace QueryChat {
983
624
  function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
984
625
  request: Request.ChatCompletionCreateParams;
985
626
  response: Response.Unary.ChatCompletion;
627
+ correct_vote: number[] | null;
628
+ correct_vote_modified: string | null;
986
629
  }>;
630
+ function trainingTableAdd(openai: OpenAI, id: string, correctVote: number[], options?: OpenAI.RequestOptions): Promise<void>;
631
+ function trainingTableDelete(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
987
632
  function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
988
633
  function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
989
634
  }
@@ -1108,116 +753,116 @@ export declare namespace Auth {
1108
753
  }
1109
754
  }
1110
755
  export interface Metadata {
1111
- query_requests: number;
1112
- query_completion_tokens: number;
1113
- query_prompt_tokens: number;
1114
- query_cost: number;
756
+ score_requests: number;
757
+ score_completion_tokens: number;
758
+ score_prompt_tokens: number;
759
+ score_total_cost: number;
1115
760
  chat_requests: number;
1116
761
  chat_completion_tokens: number;
1117
762
  chat_prompt_tokens: number;
1118
- chat_cost: number;
1119
- embedding_completion_tokens: number;
1120
- embedding_prompt_tokens: number;
1121
- embedding_cost: number;
763
+ chat_total_cost: number;
1122
764
  }
1123
765
  export declare namespace Metadata {
1124
766
  function get(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<Metadata>;
1125
767
  }
1126
- export interface QueryModelBase {
1127
- models: QueryModel.QueryLlmBase[];
1128
- weight: QueryModel.Weight;
768
+ export interface ScoreLlmBase {
769
+ model: string;
770
+ weight: ScoreLlm.Weight;
771
+ output_mode: ScoreLlm.OutputMode;
772
+ synthetic_reasoning?: boolean | null;
773
+ top_logprobs?: number | null;
774
+ prefix_messages?: Chat.Completions.Request.Message[] | null;
775
+ suffix_messages?: Chat.Completions.Request.Message[] | null;
776
+ frequency_penalty?: number | null;
777
+ logit_bias?: Record<string, number> | null;
778
+ max_completion_tokens?: number | null;
779
+ presence_penalty?: number | null;
780
+ stop?: Chat.Completions.Request.Stop | null;
781
+ temperature?: number | null;
782
+ top_p?: number | null;
783
+ max_tokens?: number | null;
784
+ min_p?: number | null;
785
+ provider?: Chat.Completions.Request.ProviderPreferences | null;
786
+ reasoning?: Chat.Completions.Request.Reasoning | null;
787
+ repetition_penalty?: number | null;
788
+ top_a?: number | null;
789
+ top_k?: number | null;
790
+ verbosity?: Chat.Completions.Request.Verbosity | null;
791
+ models?: string[] | null;
1129
792
  }
1130
- export interface QueryModel {
1131
- name: string;
1132
- training_table_name?: string;
1133
- models: QueryModel.QueryLlm[];
1134
- weight: QueryModel.Weight;
793
+ export interface ScoreLlmWithoutIndices extends ScoreLlmBase {
794
+ id: string;
795
+ training_table_id?: string;
1135
796
  }
1136
- export interface QueryModelWithMetadata extends QueryModel {
1137
- user_id: string;
797
+ export interface ScoreLlmWithoutIndicesWithMetadata extends ScoreLlmWithoutIndices {
1138
798
  created: string;
1139
799
  requests: number;
1140
- chat_completion_tokens: number;
1141
- chat_prompt_tokens: number;
1142
- chat_cost: number;
1143
- embedding_completion_tokens: number;
1144
- embedding_prompt_tokens: number;
1145
- embedding_cost: number;
800
+ completion_tokens: number;
801
+ prompt_tokens: number;
802
+ total_cost: number;
1146
803
  }
1147
- export declare namespace QueryModel {
804
+ export interface ScoreLlm extends ScoreLlmWithoutIndices {
805
+ index: number;
806
+ training_table_index?: number;
807
+ }
808
+ export declare namespace ScoreLlm {
1148
809
  type Weight = Weight.Static | Weight.TrainingTable;
1149
810
  namespace Weight {
1150
811
  interface Static {
1151
812
  type: "static";
813
+ weight: number;
1152
814
  }
1153
815
  interface TrainingTable {
1154
816
  type: "training_table";
1155
- embeddings_model: string;
1156
- top: number;
817
+ base_weight: number;
818
+ min_weight: number;
819
+ max_weight: number;
1157
820
  }
1158
821
  }
1159
- interface QueryLlmBase {
1160
- id: string;
1161
- mode: QueryLlm.Mode;
1162
- select_top_logprobs?: number | null;
1163
- tool_response_format?: boolean | null;
1164
- frequency_penalty?: number | null;
1165
- logit_bias?: Record<string, number> | null;
1166
- max_completion_tokens?: number | null;
1167
- presence_penalty?: number | null;
1168
- reasoning_effort?: Chat.Completions.Request.ReasoningEffort | null;
1169
- stop?: Chat.Completions.Request.Stop | null;
1170
- temperature?: number | null;
1171
- top_p?: number | null;
1172
- max_tokens?: number | null;
1173
- min_p?: number | null;
1174
- provider?: Chat.Completions.Request.ProviderPreferences | null;
1175
- reasoning?: Chat.Completions.Request.Reasoning | null;
1176
- repetition_penalty?: number | null;
1177
- top_a?: number | null;
1178
- top_k?: number | null;
1179
- verbosity?: Chat.Completions.Request.Verbosity | null;
1180
- models?: string[] | null;
1181
- weight: QueryLlm.Weight;
1182
- }
1183
- interface QueryLlmWithoutIndices extends QueryLlmBase {
1184
- name: string;
1185
- training_table_name?: string;
1186
- }
1187
- interface QueryLlm extends QueryLlmWithoutIndices {
1188
- index: number;
1189
- training_table_index?: number;
1190
- }
1191
- interface QueryLlmWithoutIndicesWithMetadata extends QueryLlmWithoutIndices {
1192
- user_id: string;
1193
- created: string;
1194
- requests: number;
1195
- chat_completion_tokens: number;
1196
- chat_prompt_tokens: number;
1197
- chat_cost: number;
1198
- embedding_completion_tokens: number;
1199
- embedding_prompt_tokens: number;
1200
- embedding_cost: number;
1201
- }
1202
- namespace QueryLlm {
1203
- type Mode = "generate" | "select_thinking" | "select_non_thinking" | "select_thinking_logprobs" | "select_non_thinking_logprobs";
1204
- type Weight = Weight.Static | Weight.TrainingTable;
1205
- namespace Weight {
1206
- interface Static {
1207
- type: "static";
1208
- weight: number;
1209
- }
1210
- interface TrainingTable {
1211
- type: "training_table";
1212
- base_weight: number;
1213
- min_weight: number;
1214
- max_weight: number;
1215
- }
822
+ type OutputMode = "instruction" | "json_schema" | "tool_call";
823
+ function list(openai: OpenAI, listOptions?: Models.ListOptions, options?: OpenAI.RequestOptions): Promise<{
824
+ data: string[];
825
+ }>;
826
+ function count(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<{
827
+ data: number;
828
+ }>;
829
+ function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<ScoreLlmWithoutIndices>;
830
+ function retrieve(openai: OpenAI, model: string, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<ScoreLlmWithoutIndicesWithMetadata>;
831
+ function retrieveValidate(openai: OpenAI, model: ScoreLlmBase, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<ScoreLlmWithoutIndices>;
832
+ function retrieveValidate(openai: OpenAI, model: ScoreLlmBase, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<ScoreLlmWithoutIndicesWithMetadata>;
833
+ }
834
+ export interface ScoreModelBase {
835
+ llms: ScoreLlmBase[];
836
+ weight: ScoreModel.Weight;
837
+ }
838
+ export interface ScoreModel {
839
+ id: string;
840
+ training_table_id?: string;
841
+ llms: ScoreLlm[];
842
+ weight: ScoreModel.Weight;
843
+ }
844
+ export interface ScoreModelWithMetadata extends ScoreModel {
845
+ created: string;
846
+ requests: number;
847
+ completion_tokens: number;
848
+ prompt_tokens: number;
849
+ total_cost: number;
850
+ }
851
+ export declare namespace ScoreModel {
852
+ type Weight = Weight.Static | Weight.TrainingTable;
853
+ namespace Weight {
854
+ interface Static {
855
+ type: "static";
856
+ }
857
+ interface TrainingTable {
858
+ type: "training_table";
859
+ embeddings: {
860
+ model: string;
861
+ max_tokens: number;
862
+ provider?: Chat.Completions.Request.ProviderPreferences | null;
863
+ };
864
+ top: number;
1216
865
  }
1217
- function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndices>;
1218
- function retrieve(openai: OpenAI, model: string, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndicesWithMetadata>;
1219
- function retrieveValidate(openai: OpenAI, model: QueryLlmBase, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndices>;
1220
- function retrieveValidate(openai: OpenAI, model: QueryLlmBase, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndicesWithMetadata>;
1221
866
  }
1222
867
  function list(openai: OpenAI, listOptions?: Models.ListOptions, options?: OpenAI.RequestOptions): Promise<{
1223
868
  data: string[];
@@ -1225,10 +870,10 @@ export declare namespace QueryModel {
1225
870
  function count(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<{
1226
871
  count: number;
1227
872
  }>;
1228
- function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryModel>;
1229
- function retrieve(openai: OpenAI, model: string, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryModelWithMetadata>;
1230
- function retrieveValidate(openai: OpenAI, model: QueryModelBase, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryModel>;
1231
- function retrieveValidate(openai: OpenAI, model: QueryModelBase, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryModelWithMetadata>;
873
+ function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<ScoreModel>;
874
+ function retrieve(openai: OpenAI, model: string, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<ScoreModelWithMetadata>;
875
+ function retrieveValidate(openai: OpenAI, model: ScoreModelBase, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<ScoreModel>;
876
+ function retrieveValidate(openai: OpenAI, model: ScoreModelBase, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<ScoreModelWithMetadata>;
1232
877
  }
1233
878
  export type JsonValue = null | boolean | number | string | JsonValue[] | {
1234
879
  [key: string]: JsonValue;