cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.0.0-beta.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/ai/ai.ts

1167lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { APIResource } from '../../resource';
4import { isRequestOptions } from '../../core';
5import * as Core from '../../core';
6import * as AuthorsAPI from './authors';
7import { AuthorListParams, AuthorListResponse, AuthorListResponsesSinglePage, Authors } from './authors';
8import * as TasksAPI from './tasks';
9import { TaskListParams, TaskListResponse, TaskListResponsesSinglePage, Tasks } from './tasks';
10import * as ToMarkdownAPI from './to-markdown';
11import {
12 ToMarkdown,
13 ToMarkdownSupportedParams,
14 ToMarkdownSupportedResponse,
15 ToMarkdownSupportedResponsesSinglePage,
16 ToMarkdownTransformParams,
17 ToMarkdownTransformResponse,
18} from './to-markdown';
19import * as FinetunesAPI from './finetunes/finetunes';
20import {
21 FinetuneCreateParams,
22 FinetuneCreateResponse,
23 FinetuneListParams,
24 FinetuneListResponse,
25 Finetunes,
26} from './finetunes/finetunes';
27import * as ModelsAPI from './models/models';
28import {
29 ModelListParams,
30 ModelListResponse,
31 ModelListResponsesV4PagePaginationArray,
32 Models,
33} from './models/models';
34
35export class AI extends APIResource {
36 finetunes: FinetunesAPI.Finetunes = new FinetunesAPI.Finetunes(this._client);
37 authors: AuthorsAPI.Authors = new AuthorsAPI.Authors(this._client);
38 tasks: TasksAPI.Tasks = new TasksAPI.Tasks(this._client);
39 models: ModelsAPI.Models = new ModelsAPI.Models(this._client);
40 toMarkdown: ToMarkdownAPI.ToMarkdown = new ToMarkdownAPI.ToMarkdown(this._client);
41
42 /**
43 * This endpoint provides users with the capability to run specific AI models
44 * on-demand.
45 *
46 * By submitting the required input data, users can receive real-time predictions
47 * or results generated by the chosen AI model. The endpoint supports various AI
48 * model types, ensuring flexibility and adaptability for diverse use cases.
49 *
50 * Model specific inputs available in
51 * [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).
52 */
53 run(modelName: string, params?: AIRunParams, options?: Core.RequestOptions): Core.APIPromise<AIRunResponse>;
54 run(modelName: string, options?: Core.RequestOptions): Core.APIPromise<AIRunResponse>;
55 run(
56 modelName: string,
57 params: AIRunParams | Core.RequestOptions = {},
58 options?: Core.RequestOptions,
59 ): Core.APIPromise<AIRunResponse> {
60 if (isRequestOptions(params)) {
61 return this.run(modelName, {}, params);
62 }
63 const { account_id = this._client.accountId, ...body } = params;
64 return (
65 this._client.post(`/accounts/${account_id}/ai/run/${modelName}`, {
66 body,
67 ...options,
68 }) as Core.APIPromise<{ result: AIRunResponse }>
69 )._thenUnwrap((obj) => obj.result);
70 }
71}
72
73/**
74 * An array of classification results for the input text
75 */
76export type AIRunResponse =
77 | Array<AIRunResponse.TextClassification>
78 | Core.Uploadable
79 | AIRunResponse.Audio
80 | Core.Uploadable
81 | AIRunResponse.TextEmbeddings
82 | AIRunResponse.AutomaticSpeechRecognition
83 | Array<AIRunResponse.ImageClassification>
84 | Array<AIRunResponse.ObjectDetection>
85 | AIRunResponse.UnionMember8
86 | Core.Uploadable
87 | AIRunResponse.Translation
88 | AIRunResponse.Summarization
89 | AIRunResponse.ImageToText
90 | AIRunResponse.ImageTextToText
91 | AIRunResponse.MultimodalEmbeddings;
92
93export namespace AIRunResponse {
94 export interface TextClassification {
95 /**
96 * The classification label assigned to the text (e.g., 'POSITIVE' or 'NEGATIVE')
97 */
98 label?: string;
99
100 /**
101 * Confidence score indicating the likelihood that the text belongs to the
102 * specified label
103 */
104 score?: number;
105 }
106
107 export interface Audio {
108 /**
109 * The generated audio in MP3 format, base64-encoded
110 */
111 audio?: string;
112 }
113
114 export interface TextEmbeddings {
115 /**
116 * Embeddings of the requested text values
117 */
118 data?: Array<Array<number>>;
119
120 shape?: Array<number>;
121 }
122
123 export interface AutomaticSpeechRecognition {
124 /**
125 * The transcription
126 */
127 text: string;
128
129 vtt?: string;
130
131 word_count?: number;
132
133 words?: Array<AutomaticSpeechRecognition.Word>;
134 }
135
136 export namespace AutomaticSpeechRecognition {
137 export interface Word {
138 /**
139 * The ending second when the word completes
140 */
141 end?: number;
142
143 /**
144 * The second this word begins in the recording
145 */
146 start?: number;
147
148 word?: string;
149 }
150 }
151
152 export interface ImageClassification {
153 /**
154 * The predicted category or class for the input image based on analysis
155 */
156 label?: string;
157
158 /**
159 * A confidence value, between 0 and 1, indicating how certain the model is about
160 * the predicted label
161 */
162 score?: number;
163 }
164
165 export interface ObjectDetection {
166 /**
167 * Coordinates defining the bounding box around the detected object
168 */
169 box?: ObjectDetection.Box;
170
171 /**
172 * The class label or name of the detected object
173 */
174 label?: string;
175
176 /**
177 * Confidence score indicating the likelihood that the detection is correct
178 */
179 score?: number;
180 }
181
182 export namespace ObjectDetection {
183 /**
184 * Coordinates defining the bounding box around the detected object
185 */
186 export interface Box {
187 /**
188 * The x-coordinate of the bottom-right corner of the bounding box
189 */
190 xmax?: number;
191
192 /**
193 * The x-coordinate of the top-left corner of the bounding box
194 */
195 xmin?: number;
196
197 /**
198 * The y-coordinate of the bottom-right corner of the bounding box
199 */
200 ymax?: number;
201
202 /**
203 * The y-coordinate of the top-left corner of the bounding box
204 */
205 ymin?: number;
206 }
207 }
208
209 export interface UnionMember8 {
210 /**
211 * The generated text response from the model
212 */
213 response: string;
214
215 /**
216 * An array of tool calls requests made during the response generation
217 */
218 tool_calls?: Array<UnionMember8.ToolCall>;
219
220 /**
221 * Usage statistics for the inference request
222 */
223 usage?: UnionMember8.Usage;
224 }
225
226 export namespace UnionMember8 {
227 export interface ToolCall {
228 /**
229 * The arguments passed to be passed to the tool call request
230 */
231 arguments?: unknown;
232
233 /**
234 * The name of the tool to be called
235 */
236 name?: string;
237 }
238
239 /**
240 * Usage statistics for the inference request
241 */
242 export interface Usage {
243 /**
244 * Total number of tokens in output
245 */
246 completion_tokens?: number;
247
248 /**
249 * Total number of tokens in input
250 */
251 prompt_tokens?: number;
252
253 /**
254 * Total number of input and output tokens
255 */
256 total_tokens?: number;
257 }
258 }
259
260 export interface Translation {
261 /**
262 * The translated text in the target language
263 */
264 translated_text?: string;
265 }
266
267 export interface Summarization {
268 /**
269 * The summarized version of the input text
270 */
271 summary?: string;
272 }
273
274 export interface ImageToText {
275 description?: string;
276 }
277
278 export interface ImageTextToText {
279 description?: string;
280 }
281
282 export interface MultimodalEmbeddings {
283 data?: Array<Array<number>>;
284
285 shape?: Array<number>;
286 }
287}
288
289export type AIRunParams =
290 | AIRunParams.TextClassification
291 | AIRunParams.TextToImage
292 | AIRunParams.TextToSpeech
293 | AIRunParams.TextEmbeddings
294 | AIRunParams.AutomaticSpeechRecognition
295 | AIRunParams.ImageClassification
296 | AIRunParams.ObjectDetection
297 | AIRunParams.Prompt
298 | AIRunParams.Messages
299 | AIRunParams.Translation
300 | AIRunParams.Summarization
301 | AIRunParams.ImageToText
302 | AIRunParams.Variant12
303 | AIRunParams.Variant13
304 | AIRunParams.MultimodalEmbeddings;
305
306export declare namespace AIRunParams {
307 export interface TextClassification {
308 /**
309 * Path param
310 */
311 account_id?: string;
312
313 /**
314 * Body param: The text that you want to classify
315 */
316 text: string;
317 }
318
319 export interface TextToImage {
320 /**
321 * Path param
322 */
323 account_id?: string;
324
325 /**
326 * Body param: A text description of the image you want to generate
327 */
328 prompt: string;
329
330 /**
331 * Body param: Controls how closely the generated image should adhere to the
332 * prompt; higher values make the image more aligned with the prompt
333 */
334 guidance?: number;
335
336 /**
337 * Body param: The height of the generated image in pixels
338 */
339 height?: number;
340
341 /**
342 * Body param: For use with img2img tasks. An array of integers that represent the
343 * image data constrained to 8-bit unsigned integer values
344 */
345 image?: Array<number>;
346
347 /**
348 * Body param: For use with img2img tasks. A base64-encoded string of the input
349 * image
350 */
351 image_b64?: string;
352
353 /**
354 * Body param: An array representing An array of integers that represent mask image
355 * data for inpainting constrained to 8-bit unsigned integer values
356 */
357 mask?: Array<number>;
358
359 /**
360 * Body param: Text describing elements to avoid in the generated image
361 */
362 negative_prompt?: string;
363
364 /**
365 * Body param: The number of diffusion steps; higher values can improve quality but
366 * take longer
367 */
368 num_steps?: number;
369
370 /**
371 * Body param: Random seed for reproducibility of the image generation
372 */
373 seed?: number;
374
375 /**
376 * Body param: A value between 0 and 1 indicating how strongly to apply the
377 * transformation during img2img tasks; lower values make the output closer to the
378 * input image
379 */
380 strength?: number;
381
382 /**
383 * Body param: The width of the generated image in pixels
384 */
385 width?: number;
386 }
387
388 export interface TextToSpeech {
389 /**
390 * Path param
391 */
392 account_id?: string;
393
394 /**
395 * Body param: A text description of the audio you want to generate
396 */
397 prompt: string;
398
399 /**
400 * Body param: The speech language (e.g., 'en' for English, 'fr' for French).
401 * Defaults to 'en' if not specified
402 */
403 lang?: string;
404 }
405
406 export interface TextEmbeddings {
407 /**
408 * Path param
409 */
410 account_id?: string;
411
412 /**
413 * Body param: The text to embed
414 */
415 text: string | Array<string>;
416 }
417
418 export interface AutomaticSpeechRecognition {
419 /**
420 * Path param
421 */
422 account_id?: string;
423
424 /**
425 * Body param: An array of integers that represent the audio data constrained to
426 * 8-bit unsigned integer values
427 */
428 audio: Array<number>;
429
430 /**
431 * Body param: The language of the recorded audio
432 */
433 source_lang?: string;
434
435 /**
436 * Body param: The language to translate the transcription into. Currently only
437 * English is supported.
438 */
439 target_lang?: string;
440 }
441
442 export interface ImageClassification {
443 /**
444 * Path param
445 */
446 account_id?: string;
447
448 /**
449 * Body param: An array of integers that represent the image data constrained to
450 * 8-bit unsigned integer values
451 */
452 image: Array<number>;
453 }
454
455 export interface ObjectDetection {
456 /**
457 * Path param
458 */
459 account_id?: string;
460
461 /**
462 * Body param: An array of integers that represent the image data constrained to
463 * 8-bit unsigned integer values
464 */
465 image?: Array<number>;
466 }
467
468 export interface Prompt {
469 /**
470 * Path param
471 */
472 account_id?: string;
473
474 /**
475 * Body param: The input text prompt for the model to generate a response.
476 */
477 prompt: string;
478
479 /**
480 * Body param: Decreases the likelihood of the model repeating the same lines
481 * verbatim.
482 */
483 frequency_penalty?: number;
484
485 /**
486 * Body param: Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base
487 * model.
488 */
489 lora?: string;
490
491 /**
492 * Body param: The maximum number of tokens to generate in the response.
493 */
494 max_tokens?: number;
495
496 /**
497 * Body param: Increases the likelihood of the model introducing new topics.
498 */
499 presence_penalty?: number;
500
501 /**
502 * Body param: If true, a chat template is not applied and you must adhere to the
503 * specific model's expected formatting.
504 */
505 raw?: boolean;
506
507 /**
508 * Body param: Penalty for repeated tokens; higher values discourage repetition.
509 */
510 repetition_penalty?: number;
511
512 /**
513 * Body param
514 */
515 response_format?: Prompt.ResponseFormat;
516
517 /**
518 * Body param: Random seed for reproducibility of the generation.
519 */
520 seed?: number;
521
522 /**
523 * Body param: If true, the response will be streamed back incrementally using SSE,
524 * Server Sent Events.
525 */
526 stream?: boolean;
527
528 /**
529 * Body param: Controls the randomness of the output; higher values produce more
530 * random results.
531 */
532 temperature?: number;
533
534 /**
535 * Body param: Limits the AI to choose from the top 'k' most probable words. Lower
536 * values make responses more focused; higher values introduce more variety and
537 * potential surprises.
538 */
539 top_k?: number;
540
541 /**
542 * Body param: Adjusts the creativity of the AI's responses by controlling how many
543 * possible words it considers. Lower values make outputs more predictable; higher
544 * values allow for more varied and creative responses.
545 */
546 top_p?: number;
547 }
548
549 export namespace Prompt {
550 export interface ResponseFormat {
551 json_schema?: unknown;
552
553 type?: 'json_object' | 'json_schema';
554 }
555 }
556
557 export interface Messages {
558 /**
559 * Path param
560 */
561 account_id?: string;
562
563 /**
564 * Body param: An array of message objects representing the conversation history.
565 */
566 messages: Array<Messages.Message>;
567
568 /**
569 * Body param: Decreases the likelihood of the model repeating the same lines
570 * verbatim.
571 */
572 frequency_penalty?: number;
573
574 /**
575 * Body param
576 */
577 functions?: Array<Messages.Function>;
578
579 /**
580 * Body param: The maximum number of tokens to generate in the response.
581 */
582 max_tokens?: number;
583
584 /**
585 * Body param: Increases the likelihood of the model introducing new topics.
586 */
587 presence_penalty?: number;
588
589 /**
590 * Body param: If true, a chat template is not applied and you must adhere to the
591 * specific model's expected formatting.
592 */
593 raw?: boolean;
594
595 /**
596 * Body param: Penalty for repeated tokens; higher values discourage repetition.
597 */
598 repetition_penalty?: number;
599
600 /**
601 * Body param
602 */
603 response_format?: Messages.ResponseFormat;
604
605 /**
606 * Body param: Random seed for reproducibility of the generation.
607 */
608 seed?: number;
609
610 /**
611 * Body param: If true, the response will be streamed back incrementally using SSE,
612 * Server Sent Events.
613 */
614 stream?: boolean;
615
616 /**
617 * Body param: Controls the randomness of the output; higher values produce more
618 * random results.
619 */
620 temperature?: number;
621
622 /**
623 * Body param: A list of tools available for the assistant to use.
624 */
625 tools?: Array<Messages.UnionMember0 | Messages.Function>;
626
627 /**
628 * Body param: Limits the AI to choose from the top 'k' most probable words. Lower
629 * values make responses more focused; higher values introduce more variety and
630 * potential surprises.
631 */
632 top_k?: number;
633
634 /**
635 * Body param: Adjusts the creativity of the AI's responses by controlling how many
636 * possible words it considers. Lower values make outputs more predictable; higher
637 * values allow for more varied and creative responses.
638 */
639 top_p?: number;
640 }
641
642 export namespace Messages {
643 export interface Message {
644 /**
645 * The content of the message as a string.
646 */
647 content: string | Array<Message.UnionMember1>;
648
649 /**
650 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
651 */
652 role: string;
653 }
654
655 export namespace Message {
656 export interface UnionMember1 {
657 /**
658 * Text content
659 */
660 text?: string;
661
662 /**
663 * Type of the content (text)
664 */
665 type?: string;
666 }
667 }
668
669 export interface Function {
670 code: string;
671
672 name: string;
673 }
674
675 export interface ResponseFormat {
676 json_schema?: unknown;
677
678 type?: 'json_object' | 'json_schema';
679 }
680
681 export interface UnionMember0 {
682 /**
683 * A brief description of what the tool does.
684 */
685 description: string;
686
687 /**
688 * The name of the tool. More descriptive the better.
689 */
690 name: string;
691
692 /**
693 * Schema defining the parameters accepted by the tool.
694 */
695 parameters: UnionMember0.Parameters;
696 }
697
698 export namespace UnionMember0 {
699 /**
700 * Schema defining the parameters accepted by the tool.
701 */
702 export interface Parameters {
703 /**
704 * Definitions of each parameter.
705 */
706 properties: { [key: string]: Parameters.Properties };
707
708 /**
709 * The type of the parameters object (usually 'object').
710 */
711 type: string;
712
713 /**
714 * List of required parameter names.
715 */
716 required?: Array<string>;
717 }
718
719 export namespace Parameters {
720 export interface Properties {
721 /**
722 * A description of the expected parameter.
723 */
724 description: string;
725
726 /**
727 * The data type of the parameter.
728 */
729 type: string;
730 }
731 }
732 }
733
734 export interface Function {
735 /**
736 * Details of the function tool.
737 */
738 function: Function.Function;
739
740 /**
741 * Specifies the type of tool (e.g., 'function').
742 */
743 type: string;
744 }
745
746 export namespace Function {
747 /**
748 * Details of the function tool.
749 */
750 export interface Function {
751 /**
752 * A brief description of what the function does.
753 */
754 description: string;
755
756 /**
757 * The name of the function.
758 */
759 name: string;
760
761 /**
762 * Schema defining the parameters accepted by the function.
763 */
764 parameters: Function.Parameters;
765 }
766
767 export namespace Function {
768 /**
769 * Schema defining the parameters accepted by the function.
770 */
771 export interface Parameters {
772 /**
773 * Definitions of each parameter.
774 */
775 properties: { [key: string]: Parameters.Properties };
776
777 /**
778 * The type of the parameters object (usually 'object').
779 */
780 type: string;
781
782 /**
783 * List of required parameter names.
784 */
785 required?: Array<string>;
786 }
787
788 export namespace Parameters {
789 export interface Properties {
790 /**
791 * A description of the expected parameter.
792 */
793 description: string;
794
795 /**
796 * The data type of the parameter.
797 */
798 type: string;
799 }
800 }
801 }
802 }
803 }
804
805 export interface Translation {
806 /**
807 * Path param
808 */
809 account_id?: string;
810
811 /**
812 * Body param: The language code to translate the text into (e.g., 'es' for
813 * Spanish)
814 */
815 target_lang: string;
816
817 /**
818 * Body param: The text to be translated
819 */
820 text: string;
821
822 /**
823 * Body param: The language code of the source text (e.g., 'en' for English).
824 * Defaults to 'en' if not specified
825 */
826 source_lang?: string;
827 }
828
829 export interface Summarization {
830 /**
831 * Path param
832 */
833 account_id?: string;
834
835 /**
836 * Body param: The text that you want the model to summarize
837 */
838 input_text: string;
839
840 /**
841 * Body param: The maximum length of the generated summary in tokens
842 */
843 max_length?: number;
844 }
845
846 export interface ImageToText {
847 /**
848 * Path param
849 */
850 account_id?: string;
851
852 /**
853 * Body param: An array of integers that represent the image data constrained to
854 * 8-bit unsigned integer values
855 */
856 image: Array<number>;
857
858 /**
859 * Body param: Decreases the likelihood of the model repeating the same lines
860 * verbatim.
861 */
862 frequency_penalty?: number;
863
864 /**
865 * Body param: The maximum number of tokens to generate in the response.
866 */
867 max_tokens?: number;
868
869 /**
870 * Body param: Increases the likelihood of the model introducing new topics.
871 */
872 presence_penalty?: number;
873
874 /**
875 * Body param: The input text prompt for the model to generate a response.
876 */
877 prompt?: string;
878
879 /**
880 * Body param: If true, a chat template is not applied and you must adhere to the
881 * specific model's expected formatting.
882 */
883 raw?: boolean;
884
885 /**
886 * Body param: Penalty for repeated tokens; higher values discourage repetition.
887 */
888 repetition_penalty?: number;
889
890 /**
891 * Body param: Random seed for reproducibility of the generation.
892 */
893 seed?: number;
894
895 /**
896 * Body param: Controls the randomness of the output; higher values produce more
897 * random results.
898 */
899 temperature?: number;
900
901 /**
902 * Body param: Limits the AI to choose from the top 'k' most probable words. Lower
903 * values make responses more focused; higher values introduce more variety and
904 * potential surprises.
905 */
906 top_k?: number;
907
908 /**
909 * Body param: Controls the creativity of the AI's responses by adjusting how many
910 * possible words it considers. Lower values make outputs more predictable; higher
911 * values allow for more varied and creative responses.
912 */
913 top_p?: number;
914 }
915
916 export interface Variant12 {
917 /**
918 * Path param
919 */
920 account_id?: string;
921
922 /**
923 * Body param: Image in base64 encoded format.
924 */
925 image: string;
926
927 /**
928 * Body param: The input text prompt for the model to generate a response.
929 */
930 prompt: string;
931
932 /**
933 * Body param: Decreases the likelihood of the model repeating the same lines
934 * verbatim.
935 */
936 frequency_penalty?: number;
937
938 /**
939 * Body param: Whether to ignore the EOS token and continue generating tokens after
940 * the EOS token is generated.
941 */
942 ignore_eos?: boolean;
943
944 /**
945 * Body param: The maximum number of tokens to generate in the response.
946 */
947 max_tokens?: number;
948
949 /**
950 * Body param: Increases the likelihood of the model introducing new topics.
951 */
952 presence_penalty?: number;
953
954 /**
955 * Body param: Penalty for repeated tokens; higher values discourage repetition.
956 */
957 repetition_penalty?: number;
958
959 /**
960 * Body param: Random seed for reproducibility of the generation.
961 */
962 seed?: number;
963
964 /**
965 * Body param: Controls the randomness of the output; higher values produce more
966 * random results.
967 */
968 temperature?: number;
969
970 /**
971 * Body param: Limits the AI to choose from the top 'k' most probable words. Lower
972 * values make responses more focused; higher values introduce more variety and
973 * potential surprises.
974 */
975 top_k?: number;
976
977 /**
978 * Body param: Controls the creativity of the AI's responses by adjusting how many
979 * possible words it considers. Lower values make outputs more predictable; higher
980 * values allow for more varied and creative responses.
981 */
982 top_p?: number;
983 }
984
985 export interface Variant13 {
986 /**
987 * Path param
988 */
989 account_id?: string;
990
991 /**
992 * Body param: Image in base64 encoded format.
993 */
994 image: string;
995
996 /**
997 * Body param: An array of message objects representing the conversation history.
998 */
999 messages: Array<Variant13.Message>;
1000
1001 /**
1002 * Body param: Decreases the likelihood of the model repeating the same lines
1003 * verbatim.
1004 */
1005 frequency_penalty?: number;
1006
1007 /**
1008 * Body param: Whether to ignore the EOS token and continue generating tokens after
1009 * the EOS token is generated.
1010 */
1011 ignore_eos?: boolean;
1012
1013 /**
1014 * Body param: The maximum number of tokens to generate in the response.
1015 */
1016 max_tokens?: number;
1017
1018 /**
1019 * Body param: Increases the likelihood of the model introducing new topics.
1020 */
1021 presence_penalty?: number;
1022
1023 /**
1024 * Body param: Penalty for repeated tokens; higher values discourage repetition.
1025 */
1026 repetition_penalty?: number;
1027
1028 /**
1029 * Body param: Random seed for reproducibility of the generation.
1030 */
1031 seed?: number;
1032
1033 /**
1034 * Body param: Controls the randomness of the output; higher values produce more
1035 * random results.
1036 */
1037 temperature?: number;
1038
1039 /**
1040 * Body param: Limits the AI to choose from the top 'k' most probable words. Lower
1041 * values make responses more focused; higher values introduce more variety and
1042 * potential surprises.
1043 */
1044 top_k?: number;
1045
1046 /**
1047 * Body param: Controls the creativity of the AI's responses by adjusting how many
1048 * possible words it considers. Lower values make outputs more predictable; higher
1049 * values allow for more varied and creative responses.
1050 */
1051 top_p?: number;
1052 }
1053
1054 export namespace Variant13 {
1055 export interface Message {
1056 /**
1057 * The content of the message as a string.
1058 */
1059 content: string | Array<Message.UnionMember1>;
1060
1061 /**
1062 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
1063 */
1064 role: string;
1065 }
1066
1067 export namespace Message {
1068 export interface UnionMember1 {
1069 /**
1070 * Type of the content part (e.g. 'text', 'image_url').
1071 */
1072 type: string;
1073
1074 /**
1075 * Image URL object (when type is 'image_url').
1076 */
1077 image_url?: UnionMember1.ImageURL;
1078
1079 /**
1080 * Text content (when type is 'text').
1081 */
1082 text?: string;
1083 }
1084
1085 export namespace UnionMember1 {
1086 /**
1087 * Image URL object (when type is 'image_url').
1088 */
1089 export interface ImageURL {
1090 /**
1091 * Image URI with data (e.g. data:image/jpeg;base64,/9j/...).
1092 */
1093 url: string;
1094 }
1095 }
1096 }
1097 }
1098
1099 export interface MultimodalEmbeddings {
1100 /**
1101 * Path param
1102 */
1103 account_id?: string;
1104
1105 /**
1106 * Body param: Image in base64 encoded format.
1107 */
1108 image?: string;
1109
1110 /**
1111 * Body param
1112 */
1113 text?: Array<string>;
1114 }
1115}
1116
1117AI.Finetunes = Finetunes;
1118AI.Authors = Authors;
1119AI.AuthorListResponsesSinglePage = AuthorListResponsesSinglePage;
1120AI.Tasks = Tasks;
1121AI.TaskListResponsesSinglePage = TaskListResponsesSinglePage;
1122AI.Models = Models;
1123AI.ModelListResponsesV4PagePaginationArray = ModelListResponsesV4PagePaginationArray;
1124AI.ToMarkdown = ToMarkdown;
1125AI.ToMarkdownSupportedResponsesSinglePage = ToMarkdownSupportedResponsesSinglePage;
1126
1127export declare namespace AI {
1128 export { type AIRunResponse as AIRunResponse, type AIRunParams as AIRunParams };
1129
1130 export {
1131 Finetunes as Finetunes,
1132 type FinetuneCreateResponse as FinetuneCreateResponse,
1133 type FinetuneListResponse as FinetuneListResponse,
1134 type FinetuneCreateParams as FinetuneCreateParams,
1135 type FinetuneListParams as FinetuneListParams,
1136 };
1137
1138 export {
1139 Authors as Authors,
1140 type AuthorListResponse as AuthorListResponse,
1141 AuthorListResponsesSinglePage as AuthorListResponsesSinglePage,
1142 type AuthorListParams as AuthorListParams,
1143 };
1144
1145 export {
1146 Tasks as Tasks,
1147 type TaskListResponse as TaskListResponse,
1148 TaskListResponsesSinglePage as TaskListResponsesSinglePage,
1149 type TaskListParams as TaskListParams,
1150 };
1151
1152 export {
1153 Models as Models,
1154 type ModelListResponse as ModelListResponse,
1155 ModelListResponsesV4PagePaginationArray as ModelListResponsesV4PagePaginationArray,
1156 type ModelListParams as ModelListParams,
1157 };
1158
1159 export {
1160 ToMarkdown as ToMarkdown,
1161 type ToMarkdownSupportedResponse as ToMarkdownSupportedResponse,
1162 type ToMarkdownTransformResponse as ToMarkdownTransformResponse,
1163 ToMarkdownSupportedResponsesSinglePage as ToMarkdownSupportedResponsesSinglePage,
1164 type ToMarkdownSupportedParams as ToMarkdownSupportedParams,
1165 type ToMarkdownTransformParams as ToMarkdownTransformParams,
1166 };
1167}
1168