output-items.d.ts 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. import { APIResource } from "../../../resource.js";
  2. import * as Core from "../../../core.js";
  3. import * as RunsAPI from "./runs.js";
  4. import { CursorPage, type CursorPageParams } from "../../../pagination.js";
  5. export declare class OutputItems extends APIResource {
  6. /**
  7. * Get an evaluation run output item by ID.
  8. */
  9. retrieve(evalId: string, runId: string, outputItemId: string, options?: Core.RequestOptions): Core.APIPromise<OutputItemRetrieveResponse>;
  10. /**
  11. * Get a list of output items for an evaluation run.
  12. */
  13. list(evalId: string, runId: string, query?: OutputItemListParams, options?: Core.RequestOptions): Core.PagePromise<OutputItemListResponsesPage, OutputItemListResponse>;
  14. list(evalId: string, runId: string, options?: Core.RequestOptions): Core.PagePromise<OutputItemListResponsesPage, OutputItemListResponse>;
  15. }
  16. export declare class OutputItemListResponsesPage extends CursorPage<OutputItemListResponse> {
  17. }
  18. /**
  19. * A schema representing an evaluation run output item.
  20. */
  21. export interface OutputItemRetrieveResponse {
  22. /**
  23. * Unique identifier for the evaluation run output item.
  24. */
  25. id: string;
  26. /**
  27. * Unix timestamp (in seconds) when the evaluation run was created.
  28. */
  29. created_at: number;
  30. /**
  31. * Details of the input data source item.
  32. */
  33. datasource_item: Record<string, unknown>;
  34. /**
  35. * The identifier for the data source item.
  36. */
  37. datasource_item_id: number;
  38. /**
  39. * The identifier of the evaluation group.
  40. */
  41. eval_id: string;
  42. /**
  43. * The type of the object. Always "eval.run.output_item".
  44. */
  45. object: 'eval.run.output_item';
  46. /**
  47. * A list of results from the evaluation run.
  48. */
  49. results: Array<Record<string, unknown>>;
  50. /**
  51. * The identifier of the evaluation run associated with this output item.
  52. */
  53. run_id: string;
  54. /**
  55. * A sample containing the input and output of the evaluation run.
  56. */
  57. sample: OutputItemRetrieveResponse.Sample;
  58. /**
  59. * The status of the evaluation run.
  60. */
  61. status: string;
  62. }
  63. export declare namespace OutputItemRetrieveResponse {
  64. /**
  65. * A sample containing the input and output of the evaluation run.
  66. */
  67. interface Sample {
  68. /**
  69. * An object representing an error response from the Eval API.
  70. */
  71. error: RunsAPI.EvalAPIError;
  72. /**
  73. * The reason why the sample generation was finished.
  74. */
  75. finish_reason: string;
  76. /**
  77. * An array of input messages.
  78. */
  79. input: Array<Sample.Input>;
  80. /**
  81. * The maximum number of tokens allowed for completion.
  82. */
  83. max_completion_tokens: number;
  84. /**
  85. * The model used for generating the sample.
  86. */
  87. model: string;
  88. /**
  89. * An array of output messages.
  90. */
  91. output: Array<Sample.Output>;
  92. /**
  93. * The seed used for generating the sample.
  94. */
  95. seed: number;
  96. /**
  97. * The sampling temperature used.
  98. */
  99. temperature: number;
  100. /**
  101. * The top_p value used for sampling.
  102. */
  103. top_p: number;
  104. /**
  105. * Token usage details for the sample.
  106. */
  107. usage: Sample.Usage;
  108. }
  109. namespace Sample {
  110. /**
  111. * An input message.
  112. */
  113. interface Input {
  114. /**
  115. * The content of the message.
  116. */
  117. content: string;
  118. /**
  119. * The role of the message sender (e.g., system, user, developer).
  120. */
  121. role: string;
  122. }
  123. interface Output {
  124. /**
  125. * The content of the message.
  126. */
  127. content?: string;
  128. /**
  129. * The role of the message (e.g. "system", "assistant", "user").
  130. */
  131. role?: string;
  132. }
  133. /**
  134. * Token usage details for the sample.
  135. */
  136. interface Usage {
  137. /**
  138. * The number of tokens retrieved from cache.
  139. */
  140. cached_tokens: number;
  141. /**
  142. * The number of completion tokens generated.
  143. */
  144. completion_tokens: number;
  145. /**
  146. * The number of prompt tokens used.
  147. */
  148. prompt_tokens: number;
  149. /**
  150. * The total number of tokens used.
  151. */
  152. total_tokens: number;
  153. }
  154. }
  155. }
  156. /**
  157. * A schema representing an evaluation run output item.
  158. */
  159. export interface OutputItemListResponse {
  160. /**
  161. * Unique identifier for the evaluation run output item.
  162. */
  163. id: string;
  164. /**
  165. * Unix timestamp (in seconds) when the evaluation run was created.
  166. */
  167. created_at: number;
  168. /**
  169. * Details of the input data source item.
  170. */
  171. datasource_item: Record<string, unknown>;
  172. /**
  173. * The identifier for the data source item.
  174. */
  175. datasource_item_id: number;
  176. /**
  177. * The identifier of the evaluation group.
  178. */
  179. eval_id: string;
  180. /**
  181. * The type of the object. Always "eval.run.output_item".
  182. */
  183. object: 'eval.run.output_item';
  184. /**
  185. * A list of results from the evaluation run.
  186. */
  187. results: Array<Record<string, unknown>>;
  188. /**
  189. * The identifier of the evaluation run associated with this output item.
  190. */
  191. run_id: string;
  192. /**
  193. * A sample containing the input and output of the evaluation run.
  194. */
  195. sample: OutputItemListResponse.Sample;
  196. /**
  197. * The status of the evaluation run.
  198. */
  199. status: string;
  200. }
  201. export declare namespace OutputItemListResponse {
  202. /**
  203. * A sample containing the input and output of the evaluation run.
  204. */
  205. interface Sample {
  206. /**
  207. * An object representing an error response from the Eval API.
  208. */
  209. error: RunsAPI.EvalAPIError;
  210. /**
  211. * The reason why the sample generation was finished.
  212. */
  213. finish_reason: string;
  214. /**
  215. * An array of input messages.
  216. */
  217. input: Array<Sample.Input>;
  218. /**
  219. * The maximum number of tokens allowed for completion.
  220. */
  221. max_completion_tokens: number;
  222. /**
  223. * The model used for generating the sample.
  224. */
  225. model: string;
  226. /**
  227. * An array of output messages.
  228. */
  229. output: Array<Sample.Output>;
  230. /**
  231. * The seed used for generating the sample.
  232. */
  233. seed: number;
  234. /**
  235. * The sampling temperature used.
  236. */
  237. temperature: number;
  238. /**
  239. * The top_p value used for sampling.
  240. */
  241. top_p: number;
  242. /**
  243. * Token usage details for the sample.
  244. */
  245. usage: Sample.Usage;
  246. }
  247. namespace Sample {
  248. /**
  249. * An input message.
  250. */
  251. interface Input {
  252. /**
  253. * The content of the message.
  254. */
  255. content: string;
  256. /**
  257. * The role of the message sender (e.g., system, user, developer).
  258. */
  259. role: string;
  260. }
  261. interface Output {
  262. /**
  263. * The content of the message.
  264. */
  265. content?: string;
  266. /**
  267. * The role of the message (e.g. "system", "assistant", "user").
  268. */
  269. role?: string;
  270. }
  271. /**
  272. * Token usage details for the sample.
  273. */
  274. interface Usage {
  275. /**
  276. * The number of tokens retrieved from cache.
  277. */
  278. cached_tokens: number;
  279. /**
  280. * The number of completion tokens generated.
  281. */
  282. completion_tokens: number;
  283. /**
  284. * The number of prompt tokens used.
  285. */
  286. prompt_tokens: number;
  287. /**
  288. * The total number of tokens used.
  289. */
  290. total_tokens: number;
  291. }
  292. }
  293. }
  294. export interface OutputItemListParams extends CursorPageParams {
  295. /**
  296. * Sort order for output items by timestamp. Use `asc` for ascending order or
  297. * `desc` for descending order. Defaults to `asc`.
  298. */
  299. order?: 'asc' | 'desc';
  300. /**
  301. * Filter output items by status. Use `failed` to filter by failed output items or
  302. * `pass` to filter by passed output items.
  303. */
  304. status?: 'fail' | 'pass';
  305. }
  306. export declare namespace OutputItems {
  307. export { type OutputItemRetrieveResponse as OutputItemRetrieveResponse, type OutputItemListResponse as OutputItemListResponse, OutputItemListResponsesPage as OutputItemListResponsesPage, type OutputItemListParams as OutputItemListParams, };
  308. }
  309. //# sourceMappingURL=output-items.d.ts.map