-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevolutionaryscale-forge-esm3-api-openapi.yml
More file actions
526 lines (526 loc) · 15.4 KB
/
Copy pathevolutionaryscale-forge-esm3-api-openapi.yml
File metadata and controls
526 lines (526 loc) · 15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
openapi: 3.1.0
info:
title: EvolutionaryScale Forge ESM3 API
description: >
Hosted inference API for the ESM3 multimodal protein language model from
EvolutionaryScale. ESM3 reasons jointly across sequence, structure, and
function tracks. The Forge API exposes generate, batch_generate, encode,
decode, forward_and_sample, and logits operations across small (1.4B),
medium (7B), and large (98B) parameter checkpoints. All requests authenticate
with a Forge API token obtained from forge.evolutionaryscale.ai. This OpenAPI
is reconstructed from the open-source `esm` Python SDK (Biohub/esm) which is
the canonical client for the Forge service.
version: 2024-08-01
contact:
name: EvolutionaryScale Forge
url: https://forge.evolutionaryscale.ai
license:
name: Cambrian Inference Clickthrough License Agreement
url: https://www.evolutionaryscale.ai/policies/cambrian-inference-clickthrough-license-agreement
servers:
- url: https://forge.evolutionaryscale.ai
description: EvolutionaryScale Forge Production
security:
- BearerAuth: []
tags:
- name: Generation
description: Generate proteins across sequence, structure, and function tracks.
- name: Encoding
description: Tokenize ESMProtein objects into ESMProteinTensor inputs (and back).
- name: Sampling
description: Low-level forward passes with logits and sampling control.
paths:
/api/v1/generate:
post:
summary: Generate Protein With ESM3
description: >
Iteratively samples tokens on the requested track of an `ESMProtein`
input, filling in masked positions until the track is complete. Wraps
encode, iterative sampling, and decode in a single call. Returns a
fully populated `ESMProtein`.
operationId: generate
tags:
- Generation
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/GenerateRequest'
examples:
SequenceCompletion:
$ref: '#/components/examples/SequenceCompletionRequest'
responses:
'200':
description: Generated protein with completed track.
content:
application/json:
schema:
$ref: '#/components/schemas/ESMProtein'
'4XX':
$ref: '#/components/responses/ErrorResponse'
/api/v1/batch_generate:
post:
summary: Batch Generate Proteins With ESM3
description: >
Generate multiple proteins concurrently using a list of `ESMProtein`
inputs and a parallel list of `GenerationConfig` objects. Returns a
list of completed `ESMProtein` results in the same order.
operationId: batchGenerate
tags:
- Generation
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchGenerateRequest'
responses:
'200':
description: List of generated proteins.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ESMProtein'
'4XX':
$ref: '#/components/responses/ErrorResponse'
/api/v1/encode:
post:
summary: Encode Protein To Tensor
description: >
Convert an `ESMProtein` into an `ESMProteinTensor` representation by
running the structure tokenizer (and other per-track tokenizers) over
the input. The tensor representation is required for low-level
forward_and_sample and logits operations.
operationId: encode
tags:
- Encoding
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EncodeRequest'
responses:
'200':
description: Tokenized protein tensor.
content:
application/json:
schema:
$ref: '#/components/schemas/ESMProteinTensor'
'4XX':
$ref: '#/components/responses/ErrorResponse'
/api/v1/decode:
post:
summary: Decode Protein Tensor
description: >
Inverse of encode. Runs the structure token decoder to convert an
`ESMProteinTensor` back into an `ESMProtein` with sequence and atom
coordinates.
operationId: decode
tags:
- Encoding
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DecodeRequest'
responses:
'200':
description: Decoded protein.
content:
application/json:
schema:
$ref: '#/components/schemas/ESMProtein'
'4XX':
$ref: '#/components/responses/ErrorResponse'
/api/v1/forward_and_sample:
post:
summary: Forward And Sample
description: >
Executes a single forward pass of ESM3 against a tokenized protein and
samples tokens according to a `SamplingConfig`. Intended for power
users who need fine-grained control over each iteration (for example,
chain-of-thought protein design or custom sampling schedules).
operationId: forwardAndSample
tags:
- Sampling
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ForwardAndSampleRequest'
responses:
'200':
description: Sampled output with optional logits and entropy.
content:
application/json:
schema:
$ref: '#/components/schemas/ForwardAndSampleOutput'
'4XX':
$ref: '#/components/responses/ErrorResponse'
/api/v1/logits:
post:
summary: Get Logits And Embeddings
description: >
Returns raw per-position logits, embeddings, and optional hidden states
for a tokenized protein. The SDK discourages routine use because logits
payloads are large; prefer encode + forward_and_sample for typical
workflows.
operationId: logits
tags:
- Sampling
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LogitsRequest'
responses:
'200':
description: Logits and embeddings response.
content:
application/json:
schema:
$ref: '#/components/schemas/LogitsOutput'
'4XX':
$ref: '#/components/responses/ErrorResponse'
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: Forge API token issued via forge.evolutionaryscale.ai.
schemas:
ESMProtein:
type: object
description: Raw protein representation with optional sequence, structure, function, secondary structure, and SASA tracks.
properties:
sequence:
type: string
description: Amino acid sequence using one-letter codes (A, R, N, ..., V). Underscore `_` marks masked positions.
example: "MKTAYIAKQRQISFVK_____SSERVKKLLVGDIVT"
coordinates:
type: array
description: Per-residue atom37 coordinates (list of [37,3] arrays).
items:
type: array
items:
type: array
items:
type: number
secondary_structure:
type: string
description: DSSP-style per-residue secondary structure annotation.
sasa:
type: array
description: Per-residue solvent accessible surface area.
items:
type: number
function_annotations:
type: array
description: Optional per-residue function annotations.
items:
type: object
ptm:
type: number
description: Predicted TM-score (if available).
plddt:
type: array
description: Per-residue pLDDT confidence (if available).
items:
type: number
ESMProteinTensor:
type: object
description: Tokenized representation of a protein across all ESM3 tracks.
properties:
sequence:
type: array
items:
type: integer
structure:
type: array
items:
type: integer
secondary_structure:
type: array
items:
type: integer
sasa:
type: array
items:
type: integer
function:
type: array
items:
type: integer
residue_annotations:
type: array
items:
type: integer
GenerationConfig:
type: object
description: Configuration for an ESM3 generate call.
required:
- track
properties:
track:
type: string
description: Which protein track to generate.
enum:
- sequence
- structure
- secondary_structure
- sasa
- function
num_steps:
type: integer
description: Number of iterative sampling steps.
default: 8
minimum: 1
temperature:
type: number
description: Sampling temperature.
default: 1.0
minimum: 0.0
top_p:
type: number
description: Nucleus sampling cutoff.
minimum: 0.0
maximum: 1.0
schedule:
type: string
description: Decoding schedule (e.g. cosine, linear).
enum:
- cosine
- linear
invalid_ids:
type: array
description: Token IDs that the sampler must never emit.
items:
type: integer
SamplingConfig:
type: object
description: Per-track sampling configuration for forward_and_sample.
properties:
sequence:
$ref: '#/components/schemas/SamplingTrackConfig'
structure:
$ref: '#/components/schemas/SamplingTrackConfig'
secondary_structure:
$ref: '#/components/schemas/SamplingTrackConfig'
sasa:
$ref: '#/components/schemas/SamplingTrackConfig'
function:
$ref: '#/components/schemas/SamplingTrackConfig'
SamplingTrackConfig:
type: object
properties:
temperature:
type: number
top_p:
type: number
invalid_ids:
type: array
items:
type: integer
only_sample_masked_tokens:
type: boolean
default: true
GenerateRequest:
type: object
required:
- model
- protein
- config
properties:
model:
type: string
description: ESM3 model checkpoint identifier.
example: esm3-medium-2024-08
enum:
- esm3-large-2024-03
- esm3-medium-2024-08
- esm3-small-2024-08
- esm3-open
protein:
$ref: '#/components/schemas/ESMProtein'
config:
$ref: '#/components/schemas/GenerationConfig'
BatchGenerateRequest:
type: object
required:
- model
- proteins
- configs
properties:
model:
type: string
example: esm3-medium-2024-08
proteins:
type: array
items:
$ref: '#/components/schemas/ESMProtein'
configs:
type: array
items:
$ref: '#/components/schemas/GenerationConfig'
EncodeRequest:
type: object
required:
- model
- protein
properties:
model:
type: string
example: esm3-medium-2024-08
protein:
$ref: '#/components/schemas/ESMProtein'
DecodeRequest:
type: object
required:
- model
- protein_tensor
properties:
model:
type: string
example: esm3-medium-2024-08
protein_tensor:
$ref: '#/components/schemas/ESMProteinTensor'
ForwardAndSampleRequest:
type: object
required:
- model
- protein_tensor
- sampling_config
properties:
model:
type: string
example: esm3-medium-2024-08
protein_tensor:
$ref: '#/components/schemas/ESMProteinTensor'
sampling_config:
$ref: '#/components/schemas/SamplingConfig'
LogitsRequest:
type: object
required:
- model
- protein_tensor
properties:
model:
type: string
example: esm3-medium-2024-08
protein_tensor:
$ref: '#/components/schemas/ESMProteinTensor'
config:
type: object
properties:
sequence:
type: boolean
default: false
structure:
type: boolean
default: false
secondary_structure:
type: boolean
default: false
sasa:
type: boolean
default: false
function:
type: boolean
default: false
return_embeddings:
type: boolean
default: false
return_hidden_states:
type: boolean
default: false
ith_hidden_layer:
type: integer
default: -1
LogitsOutput:
type: object
description: Logits, embeddings, and optional hidden states.
properties:
logits:
type: object
properties:
sequence:
type: array
items:
type: array
items:
type: number
structure:
type: array
items:
type: array
items:
type: number
embeddings:
type: array
description: Per-residue embedding vectors.
items:
type: array
items:
type: number
hidden_states:
type: array
items:
type: array
items:
type: array
items:
type: number
ForwardAndSampleOutput:
type: object
properties:
protein_tensor:
$ref: '#/components/schemas/ESMProteinTensor'
per_residue_entropy:
type: array
items:
type: number
topk_logprobs:
type: object
embeddings:
type: array
items:
type: array
items:
type: number
Error:
type: object
properties:
error:
type: object
properties:
type:
type: string
message:
type: string
code:
type: string
responses:
ErrorResponse:
description: Error returned by the Forge API.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
SequenceCompletionRequest:
summary: Fill masked positions in a partial sequence
value:
model: esm3-medium-2024-08
protein:
sequence: "MKTAYIAKQRQISFVK_____SSERVKKLLVGDIVT"
config:
track: sequence
num_steps: 8
temperature: 1.0