Functions enable code authors to write logic that can be executed quickly in operational contexts, such as dashboards and applications designed to empower decision-making processes. This logic is executed on the server side in an isolated environment.
Notably, Functions include first-class support for authoring logic based on the Foundry ontology. This includes support for reading properties of various object types, traversing links, and flexibly making ontology edits.
Common use cases for Functions include:
The languages supported by Functions are TypeScript ↗ and Python (Beta)↗.
To get started using Functions in Foundry, we recommend the following tutorials:
Not all features are supported by both languages. Refer to the chart below for language support for specific features.
Functions capability | Supported in Typescript | Supported in Python | Description |
---|---|---|---|
Ontology object support | Yes | Yes | The ability to access Ontology objects in your function. |
Ontology edits support | Yes | Yes | The ability to edit Ontology objects in your function. |
Queryable in Workshop | Yes | Yes | Invoking a function from a workshop app. |
Usable in Pipeline Builder | No | Yes | Calling a function from Pipeline Builder pipelines. |
Functions on models support | Yes | No | Writing functions that can be embedded within a model. |
Semantic search support | Yes | No | Use functions to create vectors for semantic search. |
External API call support | Yes | No | Querying external services from within functions. |
Serverless execution support | Yes | No | A serverless function will be spun up on demand when invoked. |
Deployed execution support | No | Yes | A deployed function will have dedicated resources allocated to it, ready to serve requests. |
Calling function from API Gateway | Yes | Yes | The ability to hit a Query function from the API gateway. |
Marketplace support | Yes | No | The ability to package and ship functions via Marketplace |
Currently, each serverless function is allocated a total of 60 seconds of wall time to run. This includes 30 seconds of CPU time and a 30-second buffer for any network delays. The function will fail if the timeout is exceeded.
Currently, each deployed function is allocated a total of 60 seconds of wall time to run. The function will fail if the timeout is exceeded.