interface.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. import { ContentItem, OutputText, Refusal } from "aiChatDialogue/foundation";
  2. export interface ChatCompletion {
  3. id?: string;
  4. object?: string;
  5. created?: number;
  6. model?: string;
  7. choices?: Choice[];
  8. usage?: Usage;
  9. service_tier?: string;
  10. system_fingerprint?: string
  11. }
  12. export interface ChatCompletionChunk {
  13. id?: string;
  14. object?: string;
  15. created?: number;
  16. model?: string;
  17. choices?: ChoiceChunk[];
  18. usage?: Usage;
  19. service_tier?: string;
  20. system_fingerprint?: string
  21. }
  22. export interface Choice {
  23. index?: number;
  24. message?: ChatCompletionMessage;
  25. logprobs?: Logprobs;
  26. finish_reason?: string
  27. }
  28. export interface ChoiceChunk {
  29. index?: number;
  30. delta?: Delta;
  31. logprobs?: Logprobs;
  32. finish_reason?: string
  33. }
  34. export interface Delta {
  35. role?: string;
  36. content?: string;
  37. refusal?: string;
  38. function_call?: FunctionCall;
  39. tool_calls?: FunctionToolCall[]
  40. }
  41. interface ChatCompletionMessage {
  42. role?: string;
  43. content?: string;
  44. refusal?: string;
  45. annotations?: ChatCompletionAnnotation[];
  46. audio?: Audio;
  47. function_call?: FunctionCall;
  48. tool_calls?: ToolCalls[]
  49. }
  50. export type ToolCalls = FunctionToolCall | CustomToolCall
  51. interface ChatCompletionAnnotation {
  52. type?: string;
  53. url_citation?: URLCitation
  54. }
  55. interface URLCitation {
  56. end_index?: number;
  57. start_index?: number;
  58. title?: string;
  59. url?: string
  60. }
  61. interface Audio {
  62. data: string;
  63. expires_at?: number;
  64. id?: string;
  65. transcript?: string
  66. }
  67. interface FunctionCall {
  68. name?: string;
  69. arguments?: string
  70. }
  71. interface ToolCall {
  72. input?: string;
  73. result?: string
  74. }
  75. export interface FunctionToolCall {
  76. id?: string;
  77. index?: number;
  78. type?: string;
  79. function?: FunctionCall
  80. }
  81. export interface CustomToolCall {
  82. id?: string;
  83. type?: string;
  84. custom?: ToolCall
  85. }
  86. interface Logprobs {
  87. content?: LogprobsContent[];
  88. refusal?: LogprobsContent[]
  89. }
  90. interface LogprobsContent {
  91. bytes?: number[];
  92. logprob?: number;
  93. token?: string;
  94. top_logprobs?: LogprobsContent[]
  95. }
  96. interface Usage {
  97. prompt_tokens?: number;
  98. completion_tokens?: number;
  99. total_tokens?: number;
  100. completion_tokens_details?: CompletionTokensDetails;
  101. prompt_tokens_details?: PromptTokensDetails
  102. }
  103. interface CompletionTokensDetails {
  104. reasoning_tokens?: number;
  105. audio_tokens?: number;
  106. accepted_prediction_tokens?: number;
  107. rejected_prediction_tokens?: number
  108. }
  109. interface PromptTokensDetails {
  110. cached_tokens?: number;
  111. audio_tokens?: number
  112. }
  113. export interface Response {
  114. id?: string;
  115. created_at?: number;
  116. error?: ResponseError;
  117. incomplete_details?: {
  118. reason: string
  119. };
  120. max_output_tokens?: number;
  121. max_tool_calls?: number;
  122. model?: string;
  123. object?: string;
  124. output?: ContentItem | ContentItem[];
  125. output_text?: string;
  126. parallel_tool_calls?: boolean;
  127. previous_response_id?: string;
  128. reasoning?: ResponseReasoning;
  129. safety_identifier?: string;
  130. status?: string;
  131. temperature?: number;
  132. top_logprobs?: number;
  133. top_p?: number;
  134. truncation?: string;
  135. [x: string]: any
  136. }
  137. export interface ResponseError {
  138. code?: string;
  139. message?: string
  140. }
  141. interface ResponseReasoning {
  142. effort?: string;
  143. generate_summary?: string;
  144. summary?: string
  145. }
  146. export interface ResponseChunk {
  147. type?: string;
  148. response?: Response;
  149. sequence_number?: number;
  150. output_index?: number;
  151. item?: ContentItem;
  152. content_index?: number;
  153. item_id?: string;
  154. part?: OutputText | Refusal | ReasoningText;
  155. delta?: string;
  156. refusal?: string;
  157. name?: string;
  158. arguments?: string;
  159. summary_index?: number;
  160. text?: string;
  161. code?: string;
  162. message?: string;
  163. param?: string;
  164. [x: string]: any
  165. }
  166. interface ReasoningText {
  167. text?: string;
  168. type?: string
  169. }
  170. export interface CodeInterpreterCall {
  171. code?: string;
  172. status?: string;
  173. outputs?: {
  174. logs?: string;
  175. url?: string;
  176. type?: string
  177. }[];
  178. id?: string;
  179. container_id?: string;
  180. type?: string
  181. }
  182. export interface ImageGenerationCall {
  183. id?: string;
  184. result?: string;
  185. status?: string;
  186. type?: string
  187. }