Functions on models

Functions on models allow you to operationalize models in the context of the Ontology by writing Functions that invoke models during their runtime. A model can be made available through a live deployment and imported into a Functions repository for usage in code.

Once the Function is released, you can consume your model anywhere in Foundry where Functions are already used, including Workshop, Slate, Actions, and more.

Below is a simplified example of a Function that calls a live deployment that takes an input Double[] and returns an output Double[]:

Copied!
1 2 3 4 5 6 7 8 import { Function, Double } from "@foundry/functions-api"; import { ModelDeployment } from "@foundry/models-api/deployments"; @Function() public async predictValues(inputs: Double[]): Promise<Double[]> { const modelOutput = await ModelDeployment.transform(inputs); return modelOutput.outputValues; }

Learn more about Functions on models, and learn how they can be used to create an an end-to-end semantic search workflow.