Skip to content

Commit bb6d517

Browse files
Merge pull request #74 from microsoft/hotfix
fix: Merging hotfix branches to main
2 parents 0605de3 + 7355efe commit bb6d517

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3766
-156
lines changed

Diff for: .devcontainer/devcontainer.json

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
{
2-
"name": "Multi Agent Custom Automation Engine Solution Accelerator",
3-
"image": "mcr.microsoft.com/devcontainers/python:3.10",
4-
"features": {
5-
"ghcr.io/devcontainers/features/azure-cli:1.0.8": {},
6-
"ghcr.io/azure/azure-dev/azd:latest": {},
7-
"ghcr.io/rchaganti/vsc-devcontainer-features/azurebicep:1.0.5": {}
8-
},
9-
10-
"postCreateCommand": "sudo chmod +x .devcontainer/setupEnv.sh && ./.devcontainer/setupEnv.sh",
11-
12-
"customizations": {
13-
"vscode": {
14-
"extensions": [
15-
"ms-azuretools.azure-dev",
16-
"ms-azuretools.vscode-bicep",
17-
"ms-python.python"
18-
]
19-
},
20-
"codespaces": {
21-
"openFiles": [
22-
"README.md"
23-
]
24-
}
25-
},
26-
27-
"remoteUser": "vscode",
28-
"hostRequirements": {
29-
"memory": "8gb"
30-
}
31-
}
1+
{
2+
"name": "Multi Agent Custom Automation Engine Solution Accelerator",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.10",
4+
"features": {
5+
"ghcr.io/devcontainers/features/azure-cli:1.0.8": {},
6+
"ghcr.io/azure/azure-dev/azd:latest": {},
7+
"ghcr.io/rchaganti/vsc-devcontainer-features/azurebicep:1.0.5": {}
8+
},
9+
10+
"postCreateCommand": "sudo chmod +x .devcontainer/setupEnv.sh && ./.devcontainer/setupEnv.sh",
11+
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-azuretools.azure-dev",
16+
"ms-azuretools.vscode-bicep",
17+
"ms-python.python"
18+
]
19+
},
20+
"codespaces": {
21+
"openFiles": [
22+
"README.md"
23+
]
24+
}
25+
},
26+
27+
"remoteUser": "vscode",
28+
"hostRequirements": {
29+
"memory": "8gb"
30+
}
31+
}

Diff for: .devcontainer/setupEnv.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ pip install --upgrade pip
55

66
(cd ./src/frontend; pip install -r requirements.txt)
77

8-
(cd ./src/backend; pip install -r requirements.txt)
8+
9+
(cd ./src/backend; pip install -r requirements.txt)
10+
11+

Diff for: .flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
max-line-length = 88
33
extend-ignore = E501
44
exclude = .venv, frontend
5-
ignore = E203, W503, G004, G200
5+
ignore = E203, W503, G004, G200, E402

Diff for: .github/workflows/test.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ jobs:
3737
run: |
3838
python -m pip install --upgrade pip
3939
pip install -r src/backend/requirements.txt
40-
pip install pytest-cov
41-
pip install pytest-asyncio
4240
4341
- name: Check if test files exist
4442
id: check_tests
@@ -50,7 +48,6 @@ jobs:
5048
echo "Test files found, running tests."
5149
echo "skip_tests=false" >> $GITHUB_ENV
5250
fi
53-
5451
- name: Run tests with coverage
5552
if: env.skip_tests == 'false'
5653
run: |
@@ -59,4 +56,4 @@ jobs:
5956
- name: Skip coverage report if no tests
6057
if: env.skip_tests == 'true'
6158
run: |
62-
echo "Skipping coverage report because no tests were found."
59+
echo "Skipping coverage report because no tests were found."

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ To add your newly created backend image:
177177
name: 'FRONTEND_SITE_NAME'
178178
value: 'https://<website Name>.azurewebsites.net'
179179

180-
name: 'APPLICATIONINSIGHTS_INSTRUMENTATION_KEY'
181-
value: <Application Insights Instrumentation Key>
180+
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
181+
value: <Application Insights Connection String>
182182

183183
- Click 'Save' and deploy your new revision
184184

Diff for: deploy/macae-continer-oc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.32.4.45862",
9-
"templateHash": "13282901028774763433"
9+
"templateHash": "14272651486454797588"
1010
}
1111
},
1212
"parameters": {
@@ -368,7 +368,7 @@
368368
"value": "[format('https://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]"
369369
},
370370
{
371-
"name": "APPLICATIONINSIGHTS_INSTRUMENTATION_KEY",
371+
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
372372
"value": "[reference('appInsights').ConnectionString]"
373373
}
374374
]

Diff for: deploy/macae-continer.bicep

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
280280
value: 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net'
281281
}
282282
{
283-
name: 'APPLICATIONINSIGHTS_INSTRUMENTATION_KEY'
283+
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
284284
value: appInsights.properties.ConnectionString
285285
}
286286
]

Diff for: documentation/LocalDeployment.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# Local setup
1010

1111
> **Note for macOS Developers**: If you are using macOS on Apple Silicon (ARM64) the DevContainer will **not** work. This is due to a limitation with the Azure Functions Core Tools (see [here](https://github.com/Azure/azure-functions-core-tools/issues/3112)). We recommend using the [Non DevContainer Setup](./NON_DEVCONTAINER_SETUP.md) instructions to run the accelerator locally.
12+
1213
The easiest way to run this accelerator is in a VS Code Dev Containers, which will open the project in your local VS Code using the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers):
1314

1415
1. Start Docker Desktop (install it if not already installed)
@@ -96,8 +97,8 @@ The files for the dev container are located in `/.devcontainer/` folder.
9697
**Using a Different Database in Cosmos:**
9798
9899
You can set the solution up to use a different database in Cosmos. For example, you can name it something like autogen-dev. To do this:
99-
1. Change the environment variable **COSMOSDB_DATABASE** to the new database name.
100-
2. You will need to create the database in the Cosmos DB account. You can do this from the Data Explorer pane in the portal, click on the drop down labeled “_+ New Container_” and provide all the necessary details.
100+
1. Change the environment variable **COSMOSDB_DATABASE** to the new database name.
101+
2. You will need to create the database in the Cosmos DB account. You can do this from the Data Explorer pane in the portal, click on the drop down labeled “_+ New Container_” and provide all the necessary details.
101102
102103
6. **Create a `.env` file:**
103104

Diff for: src/__init__.py

Whitespace-only changes.

Diff for: src/backend/.env.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AZURE_OPENAI_ENDPOINT=
66
AZURE_OPENAI_MODEL_NAME=gpt-4o
77
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
88
AZURE_OPENAI_API_VERSION=2024-08-01-preview
9-
APPLICATIONINSIGHTS_INSTRUMENTATION_KEY=
9+
APPLICATIONINSIGHTS_CONNECTION_STRING=
1010

1111
BACKEND_API_URL='http://localhost:8000'
1212
FRONTEND_SITE_NAME='http://127.0.0.1:3000'

Diff for: src/backend/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:3.11-slim
33

44

55
# Backend app setup
6-
WORKDIR /app/backend
6+
WORKDIR /src/backend
77
COPY . .
88
# Install dependencies
99
RUN pip install --no-cache-dir -r requirements.txt

Diff for: src/backend/__init__.py

Whitespace-only changes.

Diff for: src/backend/agents/__init__.py

Whitespace-only changes.

Diff for: src/backend/agents/agentutils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
)
77
from pydantic import BaseModel
88

9-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
10-
from models.messages import Step
9+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
10+
from src.backend.models.messages import Step
1111

1212
common_agent_system_message = "If you do not have the information for the arguments of the function you need to call, do not call the function. Instead, respond back to the user requesting further information. You must not hallucinate or invent any of the information used as arguments in the function. For example, if you need to call a function that requires a delivery address, you must not generate 123 Example St. You must skip calling functions and return a clarification message along the lines of: Sorry, I'm missing some information I need to help you with that. Could you please provide the delivery address so I can do that for you?"
1313

Diff for: src/backend/agents/base_agent.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
from autogen_core.components.tool_agent import tool_agent_caller_loop
1414
from autogen_core.components.tools import Tool
1515

16-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
17-
from models.messages import (
16+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
17+
from src.backend.models.messages import (
1818
ActionRequest,
1919
ActionResponse,
2020
AgentMessage,
2121
Step,
2222
StepStatus,
2323
)
24-
from event_utils import track_event_if_configured
24+
from src.backend.event_utils import track_event_if_configured
2525

2626

2727
class BaseAgent(RoutedAgent):

Diff for: src/backend/agents/generic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from autogen_core.components.models import AzureOpenAIChatCompletionClient
66
from autogen_core.components.tools import FunctionTool, Tool
77

8-
from agents.base_agent import BaseAgent
9-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
8+
from src.backend.agents.base_agent import BaseAgent
9+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1010

1111

1212
async def dummy_function() -> str:

Diff for: src/backend/agents/group_chat_manager.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from autogen_core.components import RoutedAgent, default_subscription, message_handler
1010
from autogen_core.components.models import AzureOpenAIChatCompletionClient
1111

12-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
13-
from models.messages import (
12+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
13+
from src.backend.models.messages import (
1414
ActionRequest,
1515
AgentMessage,
1616
BAgentType,
@@ -22,7 +22,7 @@
2222
StepStatus,
2323
)
2424

25-
from event_utils import track_event_if_configured
25+
from src.backend.event_utils import track_event_if_configured
2626

2727

2828
@default_subscription

Diff for: src/backend/agents/hr.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from autogen_core.components.tools import FunctionTool, Tool
77
from typing_extensions import Annotated
88

9-
from agents.base_agent import BaseAgent
10-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
9+
from src.backend.agents.base_agent import BaseAgent
10+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1111

1212
formatting_instructions = "Instructions: returning the output of this function call verbatim to the user in markdown. Then write AGENT SUMMARY: and then include a summary of what you did."
1313

Diff for: src/backend/agents/human.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
from autogen_core.base import AgentId, MessageContext
55
from autogen_core.components import RoutedAgent, default_subscription, message_handler
66

7-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
8-
from models.messages import (
7+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
8+
from src.backend.models.messages import (
99
ApprovalRequest,
1010
HumanFeedback,
1111
StepStatus,
1212
AgentMessage,
1313
Step,
1414
)
15-
from event_utils import track_event_if_configured
15+
from src.backend.event_utils import track_event_if_configured
1616

1717

1818
@default_subscription

Diff for: src/backend/agents/marketing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from autogen_core.components.models import AzureOpenAIChatCompletionClient
66
from autogen_core.components.tools import FunctionTool, Tool
77

8-
from agents.base_agent import BaseAgent
9-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
8+
from src.backend.agents.base_agent import BaseAgent
9+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1010

1111

1212
# Define new Marketing tools (functions)

Diff for: src/backend/agents/planner.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
)
1414
from pydantic import BaseModel
1515

16-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
17-
from models.messages import (
16+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
17+
from src.backend.models.messages import (
1818
AgentMessage,
1919
HumanClarification,
2020
BAgentType,
@@ -26,7 +26,7 @@
2626
HumanFeedbackStatus,
2727
)
2828

29-
from event_utils import track_event_if_configured
29+
from src.backend.event_utils import track_event_if_configured
3030

3131

3232
@default_subscription

Diff for: src/backend/agents/procurement.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from autogen_core.components.tools import FunctionTool, Tool
77
from typing_extensions import Annotated
88

9-
from agents.base_agent import BaseAgent
10-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
9+
from src.backend.agents.base_agent import BaseAgent
10+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1111

1212

1313
# Define new Procurement tools (functions)

Diff for: src/backend/agents/product.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from autogen_core.components.tools import FunctionTool, Tool
99
from typing_extensions import Annotated
1010

11-
from agents.base_agent import BaseAgent
12-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
11+
from src.backend.agents.base_agent import BaseAgent
12+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1313

1414
formatting_instructions = "Instructions: returning the output of this function call verbatim to the user in markdown. Then write AGENT SUMMARY: and then include a summary of what you did."
1515

Diff for: src/backend/agents/tech_support.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from autogen_core.components.tools import FunctionTool, Tool
77
from typing_extensions import Annotated
88

9-
from agents.base_agent import BaseAgent
10-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
9+
from src.backend.agents.base_agent import BaseAgent
10+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1111

1212
formatting_instructions = "Instructions: returning the output of this function call verbatim to the user in markdown. Then write AGENT SUMMARY: and then include a summary of what you did."
1313

@@ -523,7 +523,6 @@ async def get_tech_information(
523523
Document Name: Contoso's IT Policy and Procedure Manual
524524
Domain: IT Policy
525525
Description: A comprehensive guide detailing the IT policies and procedures at Contoso, including acceptable use, security protocols, and incident reporting.
526-
527526
At Contoso, we prioritize the security and efficiency of our IT infrastructure. All employees are required to adhere to the following policies:
528527
- Use strong passwords and change them every 90 days.
529528
- Report any suspicious emails to the IT department immediately.

Diff for: src/backend/app.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
# app.py
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
# Add the parent directory (the one that contains the "src" folder) to sys.path.
6+
# This allows absolute imports such as "from src.backend.middleware.health_check" to work
7+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
28
import asyncio
39
import logging
4-
import os
510
import uuid
611
from typing import List, Optional
7-
from middleware.health_check import HealthCheckMiddleware
12+
from src.backend.middleware.health_check import HealthCheckMiddleware
813
from autogen_core.base import AgentId
914
from fastapi import FastAPI, HTTPException, Query, Request
10-
from auth.auth_utils import get_authenticated_user_details
11-
from config import Config
12-
from context.cosmos_memory import CosmosBufferedChatCompletionContext
13-
from models.messages import (
15+
from src.backend.auth.auth_utils import get_authenticated_user_details
16+
from src.backend.config import Config
17+
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
18+
from src.backend.models.messages import (
1419
HumanFeedback,
1520
HumanClarification,
1621
InputTask,
@@ -19,15 +24,15 @@
1924
AgentMessage,
2025
PlanWithSteps,
2126
)
22-
from utils import initialize_runtime_and_context, retrieve_all_agent_tools, rai_success
23-
from event_utils import track_event_if_configured
27+
from src.backend.utils import initialize_runtime_and_context, retrieve_all_agent_tools, rai_success
28+
from src.backend.event_utils import track_event_if_configured
2429
from fastapi.middleware.cors import CORSMiddleware
2530
from azure.monitor.opentelemetry import configure_azure_monitor
2631
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
2732

2833

2934
# Check if the Application Insights Instrumentation Key is set in the environment variables
30-
instrumentation_key = os.getenv("APPLICATIONINSIGHTS_INSTRUMENTATION_KEY")
35+
instrumentation_key = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING")
3136
if instrumentation_key:
3237
# Configure Application Insights if the Instrumentation Key is found
3338
configure_azure_monitor(connection_string=instrumentation_key)

0 commit comments

Comments
 (0)