About Environment Variables
Environment variables allow you to access information uniformly across public apps on Sieve and custom-deployed Sieve functions. These can be accessed throughos.environ
. Several public apps, like Dubbing and Text-To-Speech, use environment variables to let users supply custom API Keys for external services like OpenAI and ElevenLabs.
If users set secrets, they will be mapped automatically to any environment variable with a matching name. For more information on secrets, click here.
Adding Environment Variables to a Sieve Function
We can add one or more environment variables to a sieve Function using the header parameterenvironment_variables
.
Each environment variable you would supply is packaged as a sieve.Env
object, which is structured as follows:
list
of sieve.Env
objects to the environment_variables
parameter of the header. An example function is pasted below.
Example: Generate an image with Dall-E 3
Let’s build a simple function to generate an image using OpenAI’s Dall-E 3 model.
