Configure an AI Connection
This tutorial demonstrates how to configure the AiConnection object used by AI-powered workflows, services, and application logic in Lowgile applications.
By the end of this tutorial, the configured AI connection will:
- Connect the application to an AI provider,
- Authenticate AI requests using provider credentials,
- Configure the Large Language Model (LLM) used by the application, and
- Enable optional LangSmith tracing.
Prerequisites
Section titled “Prerequisites”Before beginning this tutorial, ensure the following resources are available:
- Credentials for the AI provider and LLM you want to configure, and
- LangSmith API credentials if tracing is enabled.
Configure the AI connection
Section titled “Configure the AI connection”- Open the Lowgile platform editor.
- Select Configure from the left navigation.
- Open Settings.
- Locate Module Common.
- Open the Common.AiConnection dialog by clicking on the pencil icon.
Tip
For secret properties such as apiKey and tracingApiKey, click Set new value in the AiConnection editor to enter the secret value.

Set new value buttons for secret properties in the AiConnection editor.
- Configure the following property values:
Note
This tutorial uses Azure OpenAI as the AI provider.
| Property | Value | Description |
|---|---|---|
| aiType | AzureOpenAi | Selects Azure OpenAI as the AI provider type. |
| instanceName | <YOUR_AZURE_OPENAI_NAME> | Identifies the Azure OpenAI resource or provider instance used by the connection. |
| deploymentName | gpt-4o | Specifies the model deployment used for chat, text-generation, or multimodal extraction calls. |
| embeddingsDeploymentName | text-embedding-3-small | Specifies the embeddings deployment used when the application creates or queries embeddings. |
| apiKey | <YOUR_API_KEY> | Stores the Azure OpenAI API key used to authenticate requests. |
| apiVersion | 2024-06-01 | Specifies the Azure OpenAI API version used by the connection. |
| tracingEnabled | true | Enables tracing for AI calls. |
| tracingEndpoint | https://api.smith.langchain.com | Specifies the LangSmith tracing endpoint. |
| tracingApiKey | <YOUR_TRACING_API_KEY> | Stores the LangSmith API key used when tracing is enabled. |
| usdPer1000InputTokens | 0.005 | Defines the estimated input-token cost used for usage-cost tracking. |
| usdPer1000OutputTokens | 0.015 | Defines the estimated output-token cost used for usage-cost tracking. |
- Click the Save button to close the AI Connection dialog.
Test the AI connection
Section titled “Test the AI connection”- Use the console to verify that the configured
AiConnectionworks correctly.
Remember: Open the console by clicking the console icon in the top-right nav bar, or press F8.
-
Keep the module context set as wildcard (
*) option -
Initialize the AI service using the global namespace with :
const ai = new Sys.Ai.SimpleAi(Common.$Config.AiConnection)- Run a simple AI query:
return await ai.queryAndReturnText('What is the capital city of France?')- If the AI connection is configured correctly, the console returns the following AI-generated response:
"The capital city of France is Paris."Result [0] in 2230ms