> ## Documentation Index
> Fetch the complete documentation index at: https://docs.biohub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# forward_and_sample

> (ESM3) Performs one inference step and samples output tokens



## OpenAPI

````yaml openapi/biohub-platform-openapi.json POST /api/v1/forward_and_sample
openapi: 3.1.0
info:
  title: Biohub Platform API
  version: 1.0.0
servers:
  - url: https://biohub.ai
security: []
paths:
  /api/v1/forward_and_sample:
    post:
      tags:
        - v1
      summary: (ESM3) Performs one inference step and samples output tokens
      operationId: forward_and_sample_api_v1_forward_and_sample_post
      parameters:
        - name: accept
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Accept
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForwardAndSampleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForwardAndSampleResponse'
            application/vnd.evolutionaryscale.pickle:
              schema:
                type: string
                format: binary
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ForwardAndSampleRequest:
      properties:
        model:
          type: string
          enum:
            - esm3-open-2024-03
          description: >-
            You may have access to additional, private models as well. These
            will be visible on the Rate Limits page under the Developer Console
        potential_sequence_of_concern:
          type: boolean
          description: >-
            Disclose potential sequences of concern. For approved users, such
            sequences will not go through additional safety filtering. Reach out
            if you are interested in using this.
          default: false
        inputs:
          $ref: '#/components/schemas/Tokens'
        sampling_config:
          $ref: '#/components/schemas/SamplingConfig'
        embedding_config:
          anyOf:
            - $ref: '#/components/schemas/EmbeddingConfig'
            - type: 'null'
      type: object
      required:
        - model
        - inputs
        - sampling_config
    ForwardAndSampleResponse:
      properties:
        model:
          type: string
          enum:
            - esm3-open-2024-03
          description: >-
            You may have access to additional, private models as well. These
            will be visible on the Rate Limits page under the Developer Console
        created:
          type: string
          description: ISO formatted date time
        potential_sequence_of_concern:
          type: boolean
          description: Indicate that the returned sequence may be of potential concerns.
          default: false
        warning_messages:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Warning messages returned by FastAPI.
        sequence:
          anyOf:
            - $ref: '#/components/schemas/SamplingOutput'
            - type: 'null'
          description: Sampling output for sequence track.
        structure:
          anyOf:
            - $ref: '#/components/schemas/SamplingOutput'
            - type: 'null'
          description: Sampling output for structure track.
        secondary_structure:
          anyOf:
            - $ref: '#/components/schemas/SamplingOutput'
            - type: 'null'
          description: Sampling output for secondary structure track.
        sasa:
          anyOf:
            - $ref: '#/components/schemas/SamplingOutput'
            - type: 'null'
          description: Sampling output for sasa track.
        function:
          anyOf:
            - $ref: '#/components/schemas/SamplingOutput'
            - type: 'null'
          description: Sampling output for function annotation track.
        residue_annotation:
          anyOf:
            - $ref: '#/components/schemas/SamplingOutput'
            - type: 'null'
          description: Sampling output for residue annotation track.
        embeddings:
          $ref: '#/components/schemas/Embeddings'
      type: object
      required:
        - model
        - created
        - tokens_used
        - embeddings
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
    Tokens:
      properties:
        sequence:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: Sequence as a list of tokens as integers.
        coordinates:
          anyOf:
            - items:
                items:
                  items:
                    anyOf:
                      - type: number
                      - type: 'null'
                  type: array
                type: array
              type: array
            - type: 'null'
          description: Coordinates of the N, CA, C atom sequence as a Nx37x3 array.
        structure:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: Structure output from the model as a list of integer tokens.
        secondary_structure:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: Secondary structure in 8-class DSSP format.
        sasa:
          anyOf:
            - items:
                anyOf:
                  - type: integer
                  - type: 'null'
              type: array
            - type: 'null'
          description: Solvent accessible surface area (SASA) as a list of integers.
        function:
          anyOf:
            - items:
                items:
                  type: integer
                type: array
              type: array
            - type: 'null'
          description: Function annotations, as a list of integers.
        residue_annotation:
          anyOf:
            - items:
                items:
                  type: integer
                type: array
              type: array
            - type: 'null'
          description: Residue annotations tokens, as a list of integers.
      type: object
    SamplingConfig:
      properties:
        sequence:
          anyOf:
            - $ref: '#/components/schemas/PerTrackSamplingConfig'
            - type: 'null'
          description: Sampling configuration for the sequence track.
        structure:
          anyOf:
            - $ref: '#/components/schemas/PerTrackSamplingConfig'
            - type: 'null'
          description: Sampling configuration for the structure track.
        secondary_structure:
          anyOf:
            - $ref: '#/components/schemas/PerTrackSamplingConfig'
            - type: 'null'
          description: Sampling configuration for the secondary structure track.
        sasa:
          anyOf:
            - $ref: '#/components/schemas/PerTrackSamplingConfig'
            - type: 'null'
          description: Sampling configuration for the SASA track.
        function:
          anyOf:
            - $ref: '#/components/schemas/PerTrackSamplingConfig'
            - type: 'null'
          description: Sampling configuration for the function annotation track.
      type: object
    EmbeddingConfig:
      properties:
        sequence:
          type: boolean
          description: >-
            Whether to return the embedding mean-pooled over the sequence
            length.
          default: false
        per_residue:
          type: boolean
          description: Whether to return per-residue embeddings.
          default: false
      type: object
    SamplingOutput:
      properties:
        tokens:
          anyOf:
            - items:
                type: integer
              type: array
            - items:
                items:
                  type: integer
                type: array
              type: array
            - items:
                type: number
              type: array
            - type: 'null'
          description: Sampled tokens.
        logprobs:
          anyOf:
            - items:
                type: number
              type: array
            - items:
                items:
                  type: number
                type: array
              type: array
            - type: 'null'
          description: Log probabilities that were sampled from.
        entropy:
          anyOf:
            - items:
                type: number
              type: array
            - type: 'null'
          description: Entropies of different tokens.
        topk_logprobs:
          anyOf:
            - items:
                items:
                  type: number
                type: array
              type: array
            - items:
                items:
                  items:
                    type: number
                  type: array
                type: array
              type: array
            - type: 'null'
          description: Log probabilities of topk tokens if option is turned on
        topk_tokens:
          anyOf:
            - items:
                items:
                  type: number
                type: array
              type: array
            - type: 'null'
          description: Topk most likely tokens if option is turned on
      type: object
      required:
        - tokens
    Embeddings:
      properties:
        sequence:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          description: Sequence embedding.
        per_residue:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          description: Per residue embedding.
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
        input: {}
        ctx:
          type: object
      type: object
      required:
        - loc
        - msg
        - type
    PerTrackSamplingConfig:
      properties:
        temperature:
          type: number
          minimum: 0
          description: Temperature for sampling.
          default: 1
        top_p:
          type: number
          maximum: 1
          exclusiveMinimum: 0
          description: Sample from logits within the top-p probability.
          default: 1
        only_sample_masked_tokens:
          type: boolean
          description: Only sample for masked tokens.
          default: true
        invalid_ids:
          items:
            type: integer
          type: array
          description: Token indices that should not be sampled.
          default: []
        topk_logprobs:
          type: integer
          description: Number of top ranking prediction and logprobs to return.
          default: 0
      type: object
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````