22
33import { APIResource } from '../../../core/resource' ;
44import * as IterationsAPI from './iterations' ;
5- import {
6- IterationCreateParams ,
7- IterationListParams ,
8- IterationListResponse ,
9- Iterations ,
10- PromptIteration ,
11- } from './iterations' ;
12- import { APIPromise } from '../../../core/api-promise' ;
13- import { RequestOptions } from '../../../internal/request-options' ;
14- import { path } from '../../../internal/utils/path' ;
5+ import { Iterations } from './iterations' ;
156
167export class Prompts extends APIResource {
178 iterations : IterationsAPI . Iterations = new IterationsAPI . Iterations ( this . _client ) ;
18-
19- /**
20- * Create a new prompt.
21- *
22- * Creates a new prompt with the specified ID and optional description. If a
23- * seed_prompt is provided, it will create the first iteration of the prompt. The
24- * prompt will be associated with the specified project. Returns the created prompt
25- * object with metadata.
26- */
27- create ( projectID : string , body : PromptCreateParams , options ?: RequestOptions ) : APIPromise < Prompt > {
28- return this . _client . post ( path `/project/${ projectID } /prompts` , { body, ...options } ) ;
29- }
30-
31- /**
32- * Get a specific prompt by ID.
33- *
34- * Retrieves a single prompt with all its details. The prompt must belong to the
35- * specified project, which must belong to the current user's tenant.
36- */
37- retrieve ( promptID : string , params : PromptRetrieveParams , options ?: RequestOptions ) : APIPromise < Prompt > {
38- const { project_id } = params ;
39- return this . _client . get ( path `/project/${ project_id } /prompts/${ promptID } ` , options ) ;
40- }
41-
42- /**
43- * List all prompts for the specified project.
44- *
45- * Retrieves all prompts belonging to the specified project. The project must
46- * belong to the current user's tenant. Results are ordered by creation date
47- * (newest first).
48- */
49- list ( projectID : string , options ?: RequestOptions ) : APIPromise < PromptListResponse > {
50- return this . _client . get ( path `/project/${ projectID } /prompts` , options ) ;
51- }
52-
53- /**
54- * Delete a prompt by ID.
55- *
56- * Permanently deletes a prompt and all its iterations. This action cannot be
57- * undone. The prompt must belong to the specified project, which must belong to
58- * the current user's tenant.
59- */
60- delete (
61- promptID : string ,
62- params : PromptDeleteParams ,
63- options ?: RequestOptions ,
64- ) : APIPromise < PromptDeleteResponse > {
65- const { project_id } = params ;
66- return this . _client . delete ( path `/project/${ project_id } /prompts/${ promptID } ` , options ) ;
67- }
68-
69- /**
70- * Update a prompt's model.
71- *
72- * Updates the model associated with a prompt. This is typically done when
73- * switching to a different AI model for optimization iterations. The prompt must
74- * belong to the specified project, which must belong to the current user's tenant.
75- */
76- updateModel (
77- promptID : string ,
78- params : PromptUpdateModelParams ,
79- options ?: RequestOptions ,
80- ) : APIPromise < Prompt > {
81- const { project_id, body } = params ;
82- return this . _client . patch ( path `/project/${ project_id } /prompts/${ promptID } /model` , {
83- body : body ,
84- ...options ,
85- } ) ;
86- }
879}
8810
8911/**
@@ -92,92 +14,20 @@ export class Prompts extends APIResource {
9214export interface Prompt {
9315 projectId : string ;
9416
95- promptId : string ;
96-
97- id ?: string ;
98-
99- /**
100- * Timestamp when the record was created
101- */
102- createdAt ?: string | null ;
17+ promptName : string ;
10318
10419 description ?: string | null ;
10520
10621 /**
10722 * Model associated with this prompt
10823 */
10924 model ?: string ;
110-
111- /**
112- * Timestamp when the record was last updated
113- */
114- updatedAt ?: string | null ;
115- }
116-
117- export type PromptListResponse = Array < Prompt > ;
118-
119- export type PromptDeleteResponse = boolean ;
120-
121- export interface PromptCreateParams {
122- /**
123- * Unique identifier for the prompt
124- */
125- prompt_id : string ;
126-
127- /**
128- * Optional description of the prompt's purpose
129- */
130- description ?: string | null ;
131-
132- /**
133- * Model associated with this prompt
134- */
135- model ?: string ;
136-
137- /**
138- * Optional initial content for the prompt
139- */
140- seed_prompt ?: string | null ;
141- }
142-
143- export interface PromptRetrieveParams {
144- project_id : string ;
145- }
146-
147- export interface PromptDeleteParams {
148- project_id : string ;
149- }
150-
151- export interface PromptUpdateModelParams {
152- /**
153- * Path param:
154- */
155- project_id : string ;
156-
157- /**
158- * Body param:
159- */
160- body : { [ key : string ] : unknown } ;
16125}
16226
16327Prompts . Iterations = Iterations ;
16428
16529export declare namespace Prompts {
166- export {
167- type Prompt as Prompt ,
168- type PromptListResponse as PromptListResponse ,
169- type PromptDeleteResponse as PromptDeleteResponse ,
170- type PromptCreateParams as PromptCreateParams ,
171- type PromptRetrieveParams as PromptRetrieveParams ,
172- type PromptDeleteParams as PromptDeleteParams ,
173- type PromptUpdateModelParams as PromptUpdateModelParams ,
174- } ;
30+ export { type Prompt as Prompt } ;
17531
176- export {
177- Iterations as Iterations ,
178- type PromptIteration as PromptIteration ,
179- type IterationListResponse as IterationListResponse ,
180- type IterationCreateParams as IterationCreateParams ,
181- type IterationListParams as IterationListParams ,
182- } ;
32+ export { Iterations as Iterations } ;
18333}
0 commit comments