Skip to content

Commit 9ead242

Browse files
feat(api): api update
1 parent dda2e8d commit 9ead242

32 files changed

+54
-1801
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 24
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-398e43f06821a461846ebae030851faf308afa99a9c2340530a21272e5ae67a9.yml
3-
openapi_spec_hash: 624c26645898fdc2cd6db3670dc3f1ec
1+
configured_endpoints: 9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-d740cae5b0014320a9b81a06cf19be4740aa75451b68cd041eddc6fe332b0282.yml
3+
openapi_spec_hash: 8ca9bdc602442861e7a4db790e2fa0c7
44
config_hash: 017a31b2ac0856f4d4152a5173e6fa18

README.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ const client = new Lemma({
2929
apiKey: process.env['LEMMA_API_KEY'], // This is the default and can be omitted
3030
});
3131

32-
const dataset = await client.datasets.create({ name: '<NAME>' });
33-
34-
console.log(dataset.id);
32+
const response = await client.datasets.generateDataset({
33+
dataset_id: 'dataset_id',
34+
entries_required: 0,
35+
schema: { foo: 'bar' },
36+
});
3537
```
3638

3739
### Request & Response types
@@ -46,8 +48,12 @@ const client = new Lemma({
4648
apiKey: process.env['LEMMA_API_KEY'], // This is the default and can be omitted
4749
});
4850

49-
const params: Lemma.DatasetCreateParams = { name: 'name' };
50-
const dataset: Lemma.Dataset = await client.datasets.create(params);
51+
const params: Lemma.DatasetGenerateDatasetParams = {
52+
dataset_id: 'dataset_id',
53+
entries_required: 0,
54+
schema: { foo: 'bar' },
55+
};
56+
const response: Lemma.DatasetGenerateDatasetResponse = await client.datasets.generateDataset(params);
5157
```
5258

5359
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -89,15 +95,17 @@ a subclass of `APIError` will be thrown:
8995

9096
<!-- prettier-ignore -->
9197
```ts
92-
const dataset = await client.datasets.create({ name: 'name' }).catch(async (err) => {
93-
if (err instanceof Lemma.APIError) {
94-
console.log(err.status); // 400
95-
console.log(err.name); // BadRequestError
96-
console.log(err.headers); // {server: 'nginx', ...}
97-
} else {
98-
throw err;
99-
}
100-
});
98+
const response = await client.datasets
99+
.generateDataset({ dataset_id: 'dataset_id', entries_required: 0, schema: { foo: 'bar' } })
100+
.catch(async (err) => {
101+
if (err instanceof Lemma.APIError) {
102+
console.log(err.status); // 400
103+
console.log(err.name); // BadRequestError
104+
console.log(err.headers); // {server: 'nginx', ...}
105+
} else {
106+
throw err;
107+
}
108+
});
101109
```
102110

103111
Error codes are as follows:
@@ -129,7 +137,7 @@ const client = new Lemma({
129137
});
130138

131139
// Or, configure per-request:
132-
await client.datasets.create({ name: 'name' }, {
140+
await client.datasets.generateDataset({ dataset_id: 'dataset_id', entries_required: 0, schema: { foo: 'bar' } }, {
133141
maxRetries: 5,
134142
});
135143
```
@@ -146,7 +154,7 @@ const client = new Lemma({
146154
});
147155

148156
// Override per-request:
149-
await client.datasets.create({ name: 'name' }, {
157+
await client.datasets.generateDataset({ dataset_id: 'dataset_id', entries_required: 0, schema: { foo: 'bar' } }, {
150158
timeout: 5 * 1000,
151159
});
152160
```
@@ -169,13 +177,17 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
169177
```ts
170178
const client = new Lemma();
171179

172-
const response = await client.datasets.create({ name: 'name' }).asResponse();
180+
const response = await client.datasets
181+
.generateDataset({ dataset_id: 'dataset_id', entries_required: 0, schema: { foo: 'bar' } })
182+
.asResponse();
173183
console.log(response.headers.get('X-My-Header'));
174184
console.log(response.statusText); // access the underlying Response object
175185

176-
const { data: dataset, response: raw } = await client.datasets.create({ name: 'name' }).withResponse();
186+
const { data: response, response: raw } = await client.datasets
187+
.generateDataset({ dataset_id: 'dataset_id', entries_required: 0, schema: { foo: 'bar' } })
188+
.withResponse();
177189
console.log(raw.headers.get('X-My-Header'));
178-
console.log(dataset.id);
190+
console.log(response);
179191
```
180192

181193
### Logging
@@ -255,7 +267,7 @@ parameter. This library doesn't validate at runtime that the request matches the
255267
send will be sent as-is.
256268

257269
```ts
258-
client.datasets.create({
270+
client.datasets.generateDataset({
259271
// ...
260272
// @ts-expect-error baz is not yet public
261273
baz: 'undocumented option',

api.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,12 @@
33
Types:
44

55
- <code><a href="./src/resources/datasets/datasets.ts">Dataset</a></code>
6-
- <code><a href="./src/resources/datasets/datasets.ts">DatasetListResponse</a></code>
7-
- <code><a href="./src/resources/datasets/datasets.ts">DatasetDeleteResponse</a></code>
8-
- <code><a href="./src/resources/datasets/datasets.ts">DatasetCreateDownloadURLResponse</a></code>
96
- <code><a href="./src/resources/datasets/datasets.ts">DatasetGenerateDatasetResponse</a></code>
107
- <code><a href="./src/resources/datasets/datasets.ts">DatasetGenerateSchemaResponse</a></code>
118
- <code><a href="./src/resources/datasets/datasets.ts">DatasetGenerateValidatorsResponse</a></code>
129

1310
Methods:
1411

15-
- <code title="post /datasets">client.datasets.<a href="./src/resources/datasets/datasets.ts">create</a>({ ...params }) -> Dataset</code>
16-
- <code title="get /datasets/{dataset_id}">client.datasets.<a href="./src/resources/datasets/datasets.ts">retrieve</a>(datasetID) -> Dataset</code>
17-
- <code title="get /datasets/">client.datasets.<a href="./src/resources/datasets/datasets.ts">list</a>() -> DatasetListResponse</code>
18-
- <code title="delete /datasets/{dataset_id}">client.datasets.<a href="./src/resources/datasets/datasets.ts">delete</a>(datasetID) -> DatasetDeleteResponse</code>
19-
- <code title="get /datasets/{dataset_id}/create-download-url">client.datasets.<a href="./src/resources/datasets/datasets.ts">createDownloadURL</a>(datasetID) -> string</code>
2012
- <code title="post /datasets/generate-dataset">client.datasets.<a href="./src/resources/datasets/datasets.ts">generateDataset</a>({ ...params }) -> DatasetGenerateDatasetResponse</code>
2113
- <code title="post /datasets/generate-schema">client.datasets.<a href="./src/resources/datasets/datasets.ts">generateSchema</a>({ ...params }) -> DatasetGenerateSchemaResponse</code>
2214
- <code title="post /datasets/generate-validators">client.datasets.<a href="./src/resources/datasets/datasets.ts">generateValidators</a>({ ...params }) -> DatasetGenerateValidatorsResponse</code>
@@ -62,27 +54,12 @@ Methods:
6254
Types:
6355

6456
- <code><a href="./src/resources/prompts/prompts.ts">Prompt</a></code>
65-
- <code><a href="./src/resources/prompts/prompts.ts">PromptListResponse</a></code>
66-
- <code><a href="./src/resources/prompts/prompts.ts">PromptDeleteResponse</a></code>
67-
68-
Methods:
69-
70-
- <code title="post /prompts">client.prompts.<a href="./src/resources/prompts/prompts.ts">create</a>({ ...params }) -> Prompt</code>
71-
- <code title="get /prompts/{prompt_id}">client.prompts.<a href="./src/resources/prompts/prompts.ts">retrieve</a>(promptID) -> Prompt</code>
72-
- <code title="get /prompts">client.prompts.<a href="./src/resources/prompts/prompts.ts">list</a>() -> PromptListResponse</code>
73-
- <code title="delete /prompts/{prompt_id}">client.prompts.<a href="./src/resources/prompts/prompts.ts">delete</a>(promptID) -> PromptDeleteResponse</code>
7457

7558
## Iterations
7659

7760
Types:
7861

7962
- <code><a href="./src/resources/prompts/iterations.ts">PromptIteration</a></code>
80-
- <code><a href="./src/resources/prompts/iterations.ts">IterationListResponse</a></code>
81-
82-
Methods:
83-
84-
- <code title="post /prompts/{prompt_id}/iterations">client.prompts.iterations.<a href="./src/resources/prompts/iterations.ts">create</a>(promptID, { ...params }) -> PromptIteration</code>
85-
- <code title="get /prompts/{prompt_id}/iterations">client.prompts.iterations.<a href="./src/resources/prompts/iterations.ts">list</a>(promptID) -> IterationListResponse</code>
8663

8764
# Evaluators
8865

@@ -91,14 +68,3 @@ Types:
9168
- <code><a href="./src/resources/evaluators.ts">Evaluator</a></code>
9269
- <code><a href="./src/resources/evaluators.ts">RubricCriterion</a></code>
9370
- <code><a href="./src/resources/evaluators.ts">RubricExample</a></code>
94-
- <code><a href="./src/resources/evaluators.ts">EvaluatorRetrieveResponse</a></code>
95-
- <code><a href="./src/resources/evaluators.ts">EvaluatorUpdateResponse</a></code>
96-
- <code><a href="./src/resources/evaluators.ts">EvaluatorListResponse</a></code>
97-
- <code><a href="./src/resources/evaluators.ts">EvaluatorCreateRubricResponse</a></code>
98-
99-
Methods:
100-
101-
- <code title="get /evaluators/{evaluator_id}">client.evaluators.<a href="./src/resources/evaluators.ts">retrieve</a>(evaluatorID) -> EvaluatorRetrieveResponse</code>
102-
- <code title="put /evaluators/{evaluator_id}">client.evaluators.<a href="./src/resources/evaluators.ts">update</a>(evaluatorID, { ...params }) -> EvaluatorUpdateResponse</code>
103-
- <code title="get /evaluators">client.evaluators.<a href="./src/resources/evaluators.ts">list</a>() -> EvaluatorListResponse</code>
104-
- <code title="post /evaluators/rubric">client.evaluators.<a href="./src/resources/evaluators.ts">createRubric</a>({ ...params }) -> EvaluatorCreateRubricResponse</code>

packages/mcp-server/README.md

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ For clients with a configuration JSON, it might look something like this:
4040
"mcpServers": {
4141
"lemma_api": {
4242
"command": "node",
43-
"args": ["/path/to/local/lemma-typescript/packages/mcp-server", "--client=claude", "--tools=dynamic"],
43+
"args": ["/path/to/local/lemma-typescript/packages/mcp-server", "--client=claude", "--tools=all"],
4444
"env": {
4545
"LEMMA_API_KEY": "My API Key"
4646
}
@@ -187,7 +187,7 @@ http://localhost:3000?client=cursor&capability=tool-name-length%3D40
187187
import { server, endpoints, init } from "lemma-mcp/server";
188188

189189
// import a specific tool
190-
import createDatasets from "lemma-mcp/tools/datasets/create-datasets";
190+
import generateDatasetDatasets from "lemma-mcp/tools/datasets/generate-dataset-datasets";
191191

192192
// initialize the server and all endpoints
193193
init({ server, endpoints });
@@ -212,7 +212,7 @@ const myCustomEndpoint = {
212212
};
213213

214214
// initialize the server with your custom endpoints
215-
init({ server: myServer, endpoints: [createDatasets, myCustomEndpoint] });
215+
init({ server: myServer, endpoints: [generateDatasetDatasets, myCustomEndpoint] });
216216
```
217217

218218
## Available Tools
@@ -221,32 +221,6 @@ The following tools are available in this MCP server.
221221

222222
### Resource `datasets`:
223223

224-
- `create_datasets` (`write`): Create a new dataset.
225-
226-
Creates a new dataset with the specified name and optional description.
227-
The dataset will be associated with the current user's tenant.
228-
229-
- `retrieve_datasets` (`read`): Get a dataset by ID.
230-
231-
Retrieves a specific dataset by its ID. The dataset must belong to the
232-
current user's tenant.
233-
234-
- `list_datasets` (`read`): List all datasets for the current tenant.
235-
236-
Retrieves all datasets that belong to the current user's tenant.
237-
This includes datasets created by any user within the same tenant.
238-
239-
- `delete_datasets` (`write`): Delete a dataset by ID.
240-
241-
Permanently deletes a dataset and all its associated data. This action
242-
cannot be undone. The dataset must belong to the current user's tenant.
243-
244-
- `create_download_url_datasets` (`read`): Create a download URL for a dataset.
245-
246-
Creates a secure, time-limited download URL that allows downloading
247-
the dataset data. The URL can be used to access the dataset file
248-
without requiring authentication.
249-
250224
- `generate_dataset_datasets` (`write`): Generate a dataset using AI.
251225

252226
Initiates the generation of a dataset based on the provided schema and
@@ -298,61 +272,3 @@ The following tools are available in this MCP server.
298272
### Resource `playground`:
299273

300274
- `run_playground` (`write`): Run a playground experiment with a prompt and optional evaluator.
301-
302-
### Resource `prompts`:
303-
304-
- `create_prompts` (`write`): Create a new prompt.
305-
306-
Creates a new prompt with the specified ID and optional description.
307-
If a seed_prompt is provided, it will create the first iteration of the prompt.
308-
Returns the created prompt object with metadata.
309-
310-
- `retrieve_prompts` (`read`): Get a specific prompt by ID.
311-
312-
Retrieves a single prompt with all its details. The prompt must
313-
belong to the current user's tenant.
314-
315-
- `list_prompts` (`read`): List all prompts for the current user.
316-
317-
Retrieves all prompts belonging to the current user's tenant.
318-
Results are ordered by creation date (newest first).
319-
320-
- `delete_prompts` (`write`): Delete a prompt by ID.
321-
322-
Permanently deletes a prompt and all its iterations. This action
323-
cannot be undone. The prompt must belong to the current user's tenant.
324-
325-
### Resource `prompts.iterations`:
326-
327-
- `create_prompts_iterations` (`write`): Create a new prompt iteration.
328-
329-
Creates a new version/iteration of an existing prompt with updated content.
330-
Each iteration represents a specific version of the prompt that can be
331-
used for testing and comparison.
332-
333-
- `list_prompts_iterations` (`read`): List all iterations for a specific prompt.
334-
335-
Retrieves all iterations/versions of a prompt, ordered by version
336-
number (newest first). The prompt must belong to the current user's tenant.
337-
338-
### Resource `evaluators`:
339-
340-
- `retrieve_evaluators` (`read`): Get a specific evaluator by ID.
341-
342-
Retrieves detailed information about a specific evaluator.
343-
The evaluator must belong to the current user's tenant.
344-
345-
- `update_evaluators` (`write`): Update an existing evaluator.
346-
347-
Updates the configuration and settings of an existing evaluator.
348-
The evaluator must belong to the current user's tenant.
349-
350-
- `list_evaluators` (`read`): List all evaluators for the current tenant.
351-
352-
Retrieves all evaluators that belong to the current user's tenant.
353-
Evaluators are used to assess the quality of AI model outputs.
354-
355-
- `create_rubric_evaluators` (`write`): Create a new rubric for evaluation.
356-
357-
Creates a new rubric that defines how to evaluate AI model outputs.
358-
Rubrics provide structured criteria for assessment.

packages/mcp-server/src/tools/datasets/create-datasets.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)