Skip to content

Commit ccc6bf8

Browse files
feat(api): api update
1 parent 536ac09 commit ccc6bf8

File tree

9 files changed

+14
-459
lines changed

9 files changed

+14
-459
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 49
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-dc1b1744bf9a13daa82065ecf5dc75e3870d611ab3fabf2b0f91a7b36815b2a4.yml
3-
openapi_spec_hash: ae1eb47bf32f7b2c225338a245298e02
4-
config_hash: 4a6c48034b76c35207964d66524a0a15
1+
configured_endpoints: 42
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-46a7ce79f1dde8bd1fbfa286cbe02e212a760eab26408dc496d2d09437ccf09a.yml
3+
openapi_spec_hash: 3992f9744c24046c45f96a6285c9018d
4+
config_hash: 3ccc0e50f28be581a8cc4501a5758970

api.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,9 @@ Methods:
100100
Types:
101101

102102
- <code><a href="./src/resources/projects/prompts/prompts.ts">Prompt</a></code>
103-
- <code><a href="./src/resources/projects/prompts/prompts.ts">PromptListResponse</a></code>
104-
- <code><a href="./src/resources/projects/prompts/prompts.ts">PromptDeleteResponse</a></code>
105-
106-
Methods:
107-
108-
- <code title="post /project/{project_id}/prompts">client.projects.prompts.<a href="./src/resources/projects/prompts/prompts.ts">create</a>(projectID, { ...params }) -> Prompt</code>
109-
- <code title="get /project/{project_id}/prompts/{prompt_id}">client.projects.prompts.<a href="./src/resources/projects/prompts/prompts.ts">retrieve</a>(promptID, { ...params }) -> Prompt</code>
110-
- <code title="get /project/{project_id}/prompts">client.projects.prompts.<a href="./src/resources/projects/prompts/prompts.ts">list</a>(projectID) -> PromptListResponse</code>
111-
- <code title="delete /project/{project_id}/prompts/{prompt_id}">client.projects.prompts.<a href="./src/resources/projects/prompts/prompts.ts">delete</a>(promptID, { ...params }) -> PromptDeleteResponse</code>
112-
- <code title="patch /project/{project_id}/prompts/{prompt_id}/model">client.projects.prompts.<a href="./src/resources/projects/prompts/prompts.ts">updateModel</a>(promptID, { ...params }) -> Prompt</code>
113103

114104
### Iterations
115105

116-
Types:
117-
118-
- <code><a href="./src/resources/projects/prompts/iterations.ts">PromptIteration</a></code>
119-
- <code><a href="./src/resources/projects/prompts/iterations.ts">IterationListResponse</a></code>
120-
121-
Methods:
122-
123-
- <code title="post /project/{project_id}/prompts/{prompt_id}/iterations">client.projects.prompts.iterations.<a href="./src/resources/projects/prompts/iterations.ts">create</a>(promptID, { ...params }) -> PromptIteration</code>
124-
- <code title="get /project/{project_id}/prompts/{prompt_id}/iterations">client.projects.prompts.iterations.<a href="./src/resources/projects/prompts/iterations.ts">list</a>(promptID, { ...params }) -> IterationListResponse</code>
125-
126106
## Evaluators
127107

128108
Types:

src/resources/projects/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,4 @@ export {
4747
type ProjectCreateParams,
4848
type ProjectUpdateParams,
4949
} from './projects';
50-
export {
51-
Prompts,
52-
type Prompt,
53-
type PromptListResponse,
54-
type PromptDeleteResponse,
55-
type PromptCreateParams,
56-
type PromptRetrieveParams,
57-
type PromptDeleteParams,
58-
type PromptUpdateModelParams,
59-
} from './prompts/index';
50+
export { Prompts, type Prompt } from './prompts/index';

src/resources/projects/projects.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,7 @@ import {
4545
Evaluators,
4646
} from './evaluators/evaluators';
4747
import * as PromptsAPI from './prompts/prompts';
48-
import {
49-
Prompt,
50-
PromptCreateParams,
51-
PromptDeleteParams,
52-
PromptDeleteResponse,
53-
PromptListResponse,
54-
PromptRetrieveParams,
55-
PromptUpdateModelParams,
56-
Prompts,
57-
} from './prompts/prompts';
48+
import { Prompt, Prompts } from './prompts/prompts';
5849
import { APIPromise } from '../../core/api-promise';
5950
import { RequestOptions } from '../../internal/request-options';
6051
import { path } from '../../internal/utils/path';
@@ -193,16 +184,7 @@ export declare namespace Projects {
193184
type OptimizationCreateIterationParams as OptimizationCreateIterationParams,
194185
};
195186

196-
export {
197-
Prompts as Prompts,
198-
type Prompt as Prompt,
199-
type PromptListResponse as PromptListResponse,
200-
type PromptDeleteResponse as PromptDeleteResponse,
201-
type PromptCreateParams as PromptCreateParams,
202-
type PromptRetrieveParams as PromptRetrieveParams,
203-
type PromptDeleteParams as PromptDeleteParams,
204-
type PromptUpdateModelParams as PromptUpdateModelParams,
205-
};
187+
export { Prompts as Prompts, type Prompt as Prompt };
206188

207189
export {
208190
Evaluators as Evaluators,
Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
export {
4-
Iterations,
5-
type PromptIteration,
6-
type IterationListResponse,
7-
type IterationCreateParams,
8-
type IterationListParams,
9-
} from './iterations';
10-
export {
11-
Prompts,
12-
type Prompt,
13-
type PromptListResponse,
14-
type PromptDeleteResponse,
15-
type PromptCreateParams,
16-
type PromptRetrieveParams,
17-
type PromptDeleteParams,
18-
type PromptUpdateModelParams,
19-
} from './prompts';
3+
export { Iterations } from './iterations';
4+
export { Prompts, type Prompt } from './prompts';
Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,5 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../../../core/resource';
4-
import { APIPromise } from '../../../core/api-promise';
5-
import { RequestOptions } from '../../../internal/request-options';
6-
import { path } from '../../../internal/utils/path';
74

8-
export class Iterations extends APIResource {
9-
/**
10-
* Create a new prompt iteration.
11-
*
12-
* Creates a new version/iteration of an existing prompt with updated content. Each
13-
* iteration represents a specific version of the prompt that can be used for
14-
* testing and comparison. The prompt must belong to the specified project.
15-
*/
16-
create(
17-
promptID: string,
18-
params: IterationCreateParams,
19-
options?: RequestOptions,
20-
): APIPromise<PromptIteration> {
21-
const { project_id, ...body } = params;
22-
return this._client.post(path`/project/${project_id}/prompts/${promptID}/iterations`, {
23-
body,
24-
...options,
25-
});
26-
}
27-
28-
/**
29-
* List all iterations for a specific prompt.
30-
*
31-
* Retrieves all iterations/versions of a prompt, ordered by version number (newest
32-
* first). The prompt must belong to the specified project, which must belong to
33-
* the current user's tenant.
34-
*/
35-
list(
36-
promptID: string,
37-
params: IterationListParams,
38-
options?: RequestOptions,
39-
): APIPromise<IterationListResponse> {
40-
const { project_id } = params;
41-
return this._client.get(path`/project/${project_id}/prompts/${promptID}/iterations`, options);
42-
}
43-
}
44-
45-
export interface PromptIteration {
46-
content: string;
47-
48-
promptId: string;
49-
50-
version: number;
51-
}
52-
53-
export type IterationListResponse = Array<PromptIteration>;
54-
55-
export interface IterationCreateParams {
56-
/**
57-
* Path param:
58-
*/
59-
project_id: string;
60-
61-
/**
62-
* Body param: The actual prompt content/text
63-
*/
64-
content: string;
65-
66-
/**
67-
* Body param: Version number for this iteration
68-
*/
69-
version: number;
70-
}
71-
72-
export interface IterationListParams {
73-
project_id: string;
74-
}
75-
76-
export declare namespace Iterations {
77-
export {
78-
type PromptIteration as PromptIteration,
79-
type IterationListResponse as IterationListResponse,
80-
type IterationCreateParams as IterationCreateParams,
81-
type IterationListParams as IterationListParams,
82-
};
83-
}
5+
export class Iterations extends APIResource {}

src/resources/projects/prompts/prompts.ts

Lines changed: 4 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,10 @@
22

33
import { APIResource } from '../../../core/resource';
44
import * 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

167
export 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 {
9214
export 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

16327
Prompts.Iterations = Iterations;
16428

16529
export 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

Comments
 (0)