Skip to content

Commit ffca634

Browse files
authored
Merge pull request #76 from demaagdk/main
add sight machine filler agent
2 parents 2776be2 + 883bc05 commit ffca634

34 files changed

+2472
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Sight Machine
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<h1>
2+
<span style="display: flex; align-items: center;">
3+
<picture>
4+
<source media="(prefers-color-scheme: dark)" srcset="./assets/SM_Aperture_42x42_fff.svg">
5+
<source media="(prefers-color-scheme: light)" srcset="./assets/SM_Aperture_500x500_333.svg">
6+
<img alt="Sight Machine Logo" src="SM_Aperture_500x500_333.svg" width="50" height="50">
7+
</picture>
8+
<span style="margin-left: 10px;">Sight Machine Filler Agent</span>
9+
</span>
10+
</h1>
11+
12+
This repository provides templates for deploying and running the Sight Machine Filler Agent. Sight Machine is a data and analytics platform for manufacturing. We model data, provide basic visualization and analytics tools, and provide advanced AI analytics for manufacturing plant floor users. For more information, see www.sightmachine.com.
13+
14+
**IMPORTANT**: Full functionality of this agent, including advanced features, requires a subscription to Sight Machine. However, basic example data allows users to test and explore the core functionality of the agent.
15+
16+
## Use Cases
17+
18+
This is a tool to help manufacturers with Filling machines optimize their process. It is designed to help with data retrieval, reporting, root cause analysis, predictions, and anomaly detection.
19+
20+
Potential use cases include retrieving key performance indicators and other metrics, identifying root causes of downtime or throughput issues, and detecting anomalies in key process variables.
21+
22+
## Architecture Overview
23+
24+
The following diagram illustrates the architecture used in demo environments.
25+
26+
![Demo architecture](./assets/demo_arch.png)
27+
28+
The following diagram illustrates the architecture when using a full implementation paired with Sight Machine:
29+
30+
![Sight Machine architecture](./assets/sm_arch.png)
31+
32+
33+
## Project Structure
34+
- `README.md` - This file, project documentation and install instructions
35+
- `LICENSE` - Project license
36+
- `infra` - Folder with Bicep files for deployment
37+
- `python` - Example Python scripts for running the agent
38+
- `assets` - Image files for documentation
39+
40+
## Prerequisites
41+
42+
1. **Azure Subscription**: Ensure you have an active Azure subscription
43+
2. **Azure Resource Group**: Strongly recommend having a dedicated resource group for the required supporting Azure resource
44+
3. **Azure Developer CLI (azd)**: Install [azd](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd)
45+
4. **Python**: Install Python 3.10 or later.
46+
5. **VS Code**: Strongly recommend [VS Code](https://code.visualstudio.com/download) with the [Azure Functions extension](https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-vs-code).
47+
48+
## Deployment
49+
50+
Once you have a subscription and resource group, initialize the project by running the following command:
51+
52+
**TODO: Once this is in a github repo, revise this to a azd init --template command**
53+
54+
```bash
55+
azd init --from-code
56+
```
57+
58+
If prompted, provide a project name such as `filler_agent` and select to keep existing files unchanged.
59+
60+
Next, provision the resources in Azure
61+
```bash
62+
azd provision
63+
```
64+
65+
Finally, create the `local.settings.json` in the `python` folder.
66+
```json
67+
{
68+
"IsEncrypted": false,
69+
"Values": {
70+
"FUNCTIONS_WORKER_RUNTIME": "python",
71+
"STORAGE_CONNECTION__queueServiceUri": "https://<storageaccount>.queue.core.windows.net",
72+
"PROJECT_CONNECTION_STRING": "<project connection for AI Project>",
73+
"AzureWebJobsStorage": "UseDevelopmentStorage=true"
74+
}
75+
}
76+
```
77+
78+
## Test app in VS Code
79+
1. Open VS Code, and then open the `python` folder for this app. VS Code should detect that this is an Azure Function app and prompt you to set up the environment for debugging.
80+
2. Launch Azurite by selecting `Azurite: Start` from the command palette (F1).
81+
3. Run the debugger. If prompted with any warnings, select `Debug Anyway`
82+
4. Once started, open a web browser and go to `localhost:7071/api/main`.
83+
84+
## Example questions
85+
1. What is the current throughput on Filler 1?
86+
2. What would my throughput be on Filler 1 if Pressure was 5% higher.
87+
3. Did you detect any recent anomalies on Filler 1?
88+
89+
## Support
90+
91+
- Technical support: email `[email protected]`
92+
- Setting up an account: Fill out our [contact form](https://sightmachine.com/contact/)
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 19 additions & 0 deletions
Loading
29.8 KB
Loading
34.8 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This folder includes code originally obtained from
2+
https://github.com/Azure-Samples/azure-functions-ai-services-agent-python
3+
and is used under the terms of the MIT License.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"analysisServicesServers": "as",
3+
"apiManagementService": "apim-",
4+
"appConfigurationConfigurationStores": "appcs-",
5+
"appManagedEnvironments": "cae-",
6+
"appContainerApps": "ca-",
7+
"authorizationPolicyDefinitions": "policy-",
8+
"automationAutomationAccounts": "aa-",
9+
"blueprintBlueprints": "bp-",
10+
"blueprintBlueprintsArtifacts": "bpa-",
11+
"cacheRedis": "redis-",
12+
"cdnProfiles": "cdnp-",
13+
"cdnProfilesEndpoints": "cdne-",
14+
"cognitiveServicesAccounts": "cog-",
15+
"cognitiveServicesFormRecognizer": "cog-fr-",
16+
"cognitiveServicesTextAnalytics": "cog-ta-",
17+
"computeAvailabilitySets": "avail-",
18+
"computeCloudServices": "cld-",
19+
"computeDiskEncryptionSets": "des",
20+
"computeDisks": "disk",
21+
"computeDisksOs": "osdisk",
22+
"computeGalleries": "gal",
23+
"computeSnapshots": "snap-",
24+
"computeVirtualMachines": "vm",
25+
"computeVirtualMachineScaleSets": "vmss-",
26+
"containerInstanceContainerGroups": "ci",
27+
"containerRegistryRegistries": "cr",
28+
"containerServiceManagedClusters": "aks-",
29+
"databricksWorkspaces": "dbw-",
30+
"dataFactoryFactories": "adf-",
31+
"dataLakeAnalyticsAccounts": "dla",
32+
"dataLakeStoreAccounts": "dls",
33+
"dataMigrationServices": "dms-",
34+
"dBforMySQLServers": "mysql-",
35+
"dBforPostgreSQLServers": "psql-",
36+
"devicesIotHubs": "iot-",
37+
"devicesProvisioningServices": "provs-",
38+
"devicesProvisioningServicesCertificates": "pcert-",
39+
"documentDBDatabaseAccounts": "cosmos-",
40+
"eventGridDomains": "evgd-",
41+
"eventGridDomainsTopics": "evgt-",
42+
"eventGridEventSubscriptions": "evgs-",
43+
"eventHubNamespaces": "evhns-",
44+
"eventHubNamespacesEventHubs": "evh-",
45+
"hdInsightClustersHadoop": "hadoop-",
46+
"hdInsightClustersHbase": "hbase-",
47+
"hdInsightClustersKafka": "kafka-",
48+
"hdInsightClustersMl": "mls-",
49+
"hdInsightClustersSpark": "spark-",
50+
"hdInsightClustersStorm": "storm-",
51+
"hybridComputeMachines": "arcs-",
52+
"insightsActionGroups": "ag-",
53+
"insightsComponents": "appi-",
54+
"keyVaultVaults": "kv-",
55+
"kubernetesConnectedClusters": "arck",
56+
"kustoClusters": "dec",
57+
"kustoClustersDatabases": "dedb",
58+
"logicIntegrationAccounts": "ia-",
59+
"logicWorkflows": "logic-",
60+
"machineLearningServicesWorkspaces": "mlw-",
61+
"managedIdentityUserAssignedIdentities": "id-",
62+
"managementManagementGroups": "mg-",
63+
"migrateAssessmentProjects": "migr-",
64+
"networkApplicationGateways": "agw-",
65+
"networkApplicationSecurityGroups": "asg-",
66+
"networkAzureFirewalls": "afw-",
67+
"networkBastionHosts": "bas-",
68+
"networkConnections": "con-",
69+
"networkDnsZones": "dnsz-",
70+
"networkExpressRouteCircuits": "erc-",
71+
"networkFirewallPolicies": "afwp-",
72+
"networkFirewallPoliciesWebApplication": "waf",
73+
"networkFirewallPoliciesRuleGroups": "wafrg",
74+
"networkFrontDoors": "fd-",
75+
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-",
76+
"networkLoadBalancersExternal": "lbe-",
77+
"networkLoadBalancersInternal": "lbi-",
78+
"networkLoadBalancersInboundNatRules": "rule-",
79+
"networkLocalNetworkGateways": "lgw-",
80+
"networkNatGateways": "ng-",
81+
"networkNetworkInterfaces": "nic-",
82+
"networkNetworkSecurityGroups": "nsg-",
83+
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-",
84+
"networkNetworkWatchers": "nw-",
85+
"networkPrivateDnsZones": "pdnsz-",
86+
"networkPrivateLinkServices": "pl-",
87+
"networkPublicIPAddresses": "pip-",
88+
"networkPublicIPPrefixes": "ippre-",
89+
"networkRouteFilters": "rf-",
90+
"networkRouteTables": "rt-",
91+
"networkRouteTablesRoutes": "udr-",
92+
"networkTrafficManagerProfiles": "traf-",
93+
"networkVirtualNetworkGateways": "vgw-",
94+
"networkVirtualNetworks": "vnet-",
95+
"networkVirtualNetworksSubnets": "snet-",
96+
"networkVirtualNetworksVirtualNetworkPeerings": "peer-",
97+
"networkVirtualWans": "vwan-",
98+
"networkVpnGateways": "vpng-",
99+
"networkVpnGatewaysVpnConnections": "vcn-",
100+
"networkVpnGatewaysVpnSites": "vst-",
101+
"notificationHubsNamespaces": "ntfns-",
102+
"notificationHubsNamespacesNotificationHubs": "ntf-",
103+
"operationalInsightsWorkspaces": "log-",
104+
"portalDashboards": "dash-",
105+
"powerBIDedicatedCapacities": "pbi-",
106+
"purviewAccounts": "pview-",
107+
"recoveryServicesVaults": "rsv-",
108+
"resourcesResourceGroups": "rg-",
109+
"searchSearchServices": "srch-",
110+
"serviceBusNamespaces": "sb-",
111+
"serviceBusNamespacesQueues": "sbq-",
112+
"serviceBusNamespacesTopics": "sbt-",
113+
"serviceEndPointPolicies": "se-",
114+
"serviceFabricClusters": "sf-",
115+
"signalRServiceSignalR": "sigr",
116+
"sqlManagedInstances": "sqlmi-",
117+
"sqlServers": "sql-",
118+
"sqlServersDataWarehouse": "sqldw-",
119+
"sqlServersDatabases": "sqldb-",
120+
"sqlServersDatabasesStretch": "sqlstrdb-",
121+
"storageStorageAccounts": "st",
122+
"storageStorageAccountsVm": "stvm",
123+
"storSimpleManagers": "ssimp",
124+
"streamAnalyticsCluster": "asa-",
125+
"synapseWorkspaces": "syn",
126+
"synapseWorkspacesAnalyticsWorkspaces": "synw",
127+
"synapseWorkspacesSqlPoolsDedicated": "syndp",
128+
"synapseWorkspacesSqlPoolsSpark": "synsp",
129+
"timeSeriesInsightsEnvironments": "tsi-",
130+
"webServerFarms": "plan-",
131+
"webSitesAppService": "app-",
132+
"webSitesAppServiceEnvironment": "ase-",
133+
"webSitesFunctions": "func-",
134+
"webStaticSites": "stapp-"
135+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Assigns the necessary roles to the AI project
2+
3+
param aiSearchName string
4+
param aiProjectPrincipalId string
5+
param aiProjectId string
6+
7+
resource searchService 'Microsoft.Search/searchServices@2024-06-01-preview' existing = {
8+
name: aiSearchName
9+
scope: resourceGroup()
10+
}
11+
12+
// search roles
13+
resource searchIndexDataContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
14+
name: '8ebe5a00-799e-43f5-93ac-243d3dce84a7'
15+
scope: resourceGroup()
16+
}
17+
18+
resource searchIndexDataContributorAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
19+
scope: searchService
20+
name: guid(aiProjectId, searchIndexDataContributorRole.id, searchService.id)
21+
properties: {
22+
principalId: aiProjectPrincipalId
23+
roleDefinitionId: searchIndexDataContributorRole.id
24+
principalType: 'ServicePrincipal'
25+
}
26+
}
27+
28+
resource searchServiceContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
29+
name: '7ca78c08-252a-4471-8644-bb5ff32d4ba0'
30+
scope: resourceGroup()
31+
}
32+
33+
resource searchServiceContributorRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
34+
scope: searchService
35+
name: guid(aiProjectId, searchServiceContributorRole.id, searchService.id)
36+
properties: {
37+
principalId: aiProjectPrincipalId
38+
roleDefinitionId: searchServiceContributorRole.id
39+
principalType: 'ServicePrincipal'
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Assigns the necessary roles to the AI project
2+
3+
param aiServicesName string
4+
param aiProjectPrincipalId string
5+
param aiProjectId string
6+
7+
resource aiServices 'Microsoft.CognitiveServices/accounts@2024-06-01-preview' existing = {
8+
name: aiServicesName
9+
scope: resourceGroup()
10+
}
11+
12+
resource cognitiveServicesContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
13+
name: '25fbc0a9-bd7c-42a3-aa1a-3b75d497ee68'
14+
scope: resourceGroup()
15+
16+
}
17+
18+
resource cognitiveServicesContributorAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01'= {
19+
scope: aiServices
20+
name: guid(aiServices.id, cognitiveServicesContributorRole.id, aiProjectId)
21+
properties: {
22+
principalId: aiProjectPrincipalId
23+
roleDefinitionId: cognitiveServicesContributorRole.id
24+
principalType: 'ServicePrincipal'
25+
}
26+
}
27+
28+
29+
resource cognitiveServicesOpenAIUserRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
30+
name: '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'
31+
scope: resourceGroup()
32+
}
33+
resource cognitiveServicesOpenAIUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
34+
scope: aiServices
35+
name: guid(aiProjectId, cognitiveServicesOpenAIUserRole.id, aiServices.id)
36+
properties: {
37+
principalId: aiProjectPrincipalId
38+
roleDefinitionId: cognitiveServicesOpenAIUserRole.id
39+
principalType: 'ServicePrincipal'
40+
}
41+
}
42+
43+
resource cognitiveServicesUserRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
44+
name: 'a97b65f3-24c7-4388-baec-2e87135dc908'
45+
scope: resourceGroup()
46+
}
47+
48+
resource cognitiveServicesUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
49+
scope: aiServices
50+
name: guid(aiProjectId, cognitiveServicesUserRole.id, aiServices.id)
51+
properties: {
52+
principalId: aiProjectPrincipalId
53+
roleDefinitionId: cognitiveServicesUserRole.id
54+
principalType: 'ServicePrincipal'
55+
}
56+
}

0 commit comments

Comments
 (0)