You can deploy models as functions to enable live usage of models in end-user applications like Workshop, Slate, Actions, and more. Model functions can also be used in other functions to write custom business logic involving the model in code.
Functions can be published for models with a live deployment configured, or for Modeling Objectives live deployments.
Learn more about how to configure and manage model functions.
You can call model functions from TypeScript v1, TypeScript v2, and Python functions. TypeScript v2 and Python repositories support only model functions that are tied to an ontology. The generated Ontology SDK exposes the model function in each language.
Below is a simplified example of a function that calls a live deployment that takes an input Double[] and returns a Double[] output called output_df in the model API. All three examples reference the model API input by name; this example assumes that the input is named input_df.
The TypeScript v1 example below shows a space-bound model function. Model functions created in or after February 2026 are tied to an ontology instead. For those functions, import Queries from @foundry/ontology-api and call Queries.modelDeployment({ input_df: inputs }). See the ontology-bound TypeScript v1 form for a complete example.
Copied!1 2 3 4 5 6 7 8import { 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({ input_df: inputs }); return modelOutput.output_df; }
Copied!1 2 3 4 5 6 7 8 9 10 11 12import { Client } from "@osdk/client"; import { Double } from "@osdk/functions"; import { modelDeployment } from "@ontology/sdk"; async function predictValues(client: Client, inputs: Double[]): Promise<Double[]> { const modelOutput = await client(modelDeployment).executeFunction({ input_df: inputs }); return modelOutput.output_df; } export default predictValues;
Copied!1 2 3 4 5 6 7 8 9 10from functions.api import function, Double from ontology_sdk import FoundryClient @function(beta=True) def predict_values(inputs: list[Double]) -> list[Double]: model_output = FoundryClient().ontology.queries.model_deployment( input_df=inputs ) return model_output.output_df
Learn more about how to use model functions in other functions.