In the pipeline definion you can reference values from the instance and secrets files. For example, if you have a secret.yaml file with the following content:
For example, in the secrets.yaml file you can see the following syntax:
access-key:"${ secrets.open-ai.access-key }"#### Mustache templates in YAML filesSome agents, like the **ai-chat-completions** agent, require a configuration that is a Mustache template.For example:```yamlpipeline:.... - name:"ai-chat-completions"type:"ai-chat-completions"configuration:.....messages: - role:systemcontent:| An user is going to perform a questions, he documents below may help you in answering to their questions. Please try to leverage them in your answer as much as possible. Take into consideration that the user is always asking questions about the LangStream project. If you provide code or YAML snippets, please explicitly state that they are examples. Do not provide information that is not related to the LangStream project. Documents: {{# value.related_documents}} {{{ text}}} {{/ value.related_documents}} - role:usercontent:"{{ value.question}}"
Using ENV variables in secrets and instance files
As you can see in the examples in the secrets.yaml and the instance.yaml files, you can use environment variables to define the values of the secrets and instance values. This is useful when you want to run the same application in different environments without using different secrets and instance files. For example, you can define the following environment variables:
In this case the secrets file is dynamically populated with the values of the environment variables. You can also use the same technique to define the values of the instance file. For example:
The syntax for referencing environment variables is like in the Linux bash shell. For example, if you want to reference the value of the OPEN_AI_EMBEDDINGS_MODEL environment variable you can use the following syntax:
Then you run the "langstream docker run", or "langstream apps deploy" commands the value for the OPEN_AI_EMBEDDINGS_MODEL environment variable is replaced with the current value for the ENV variable OPEN_AI_EMBEDDINGS_MODEL, otherwise it is replaced with the default value "text-embedding-ada-002".