# Functions on models You can deploy models as functions to enable live usage of models in end-user applications like [Workshop](../../workshop/functions-use/index.md), [Slate](../../slate/concepts-foundry-functions/index.md), [Actions](../../action-types/function-actions-overview/index.md), and [more](../../functions/use-functions/index.md). Model functions can also be used in other functions to write custom business logic involving the model in code. ## Publish a function for your model Functions can be published for models with [a live deployment configured](../../manage-models/create-a-model-deployment/index.md), or for [Modeling Objectives live deployments](../../manage-models/set-up-live/index.md). [Learn more about how to configure and manage model functions](../model-functions-guide/index.md). ## Call a model function in code 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](../../functions/functions-on-models/index.md#ontology-or-space-bound-functions). 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](../../functions/functions-on-models/index.md#if-the-function-is-registered-to-an-ontology) for a complete example. ```typescript tab="TypeScript v1" import { Function, Double } from "@foundry/functions-api"; import { ModelDeployment } from "@foundry/models-api/deployments"; @Function() public async predictValues(inputs: Double[]): Promise { const modelOutput = await ModelDeployment({ input_df: inputs }); return modelOutput.output_df; } ``` ```typescript tab="TypeScript v2" import { Client } from "@osdk/client"; import { Double } from "@osdk/functions"; import { modelDeployment } from "@ontology/sdk"; async function predictValues(client: Client, inputs: Double[]): Promise { const modelOutput = await client(modelDeployment).executeFunction({ input_df: inputs }); return modelOutput.output_df; } export default predictValues; ``` ```python tab="Python" from 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](../../functions/functions-on-models/index.md).