Hypermode generates your Project’s GraphQL API schema from the exported functions in the index.ts file located in the functions / assembly folder of your project.

When deployed, your API is available on your project’s endpoint, visible in the Hypermode Console on the Project Home screen.

For example, with the following index.ts file:

import { models } from "@hypermode/functions-as";
import { ClassificationModel } from "@hypermode/models-as/models/experimental/classification";

const modelName = "sentiment-classifier";

export function testClassifier(text: string): string {
  const model = models.getModel<ClassificationModel>(modelName);
  const input = model.createInput([text]);
  const output = model.invoke(input);

  return output.predictions[0];
}

The API endpoint serves the following GraphQL schema:

type Query {
  testClassifier(text: String!): String!
}

You can visualize the generated GraphQL schema by expanding the Documentation Explorer on the Project Query screen.