Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Ut 10888 backend #40

Merged
merged 176 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
55bedaa
edit 1
Dec 25, 2024
619afa9
edit 2
Dec 25, 2024
38aaf58
Repository Governance
Dec 30, 2024
3fe801b
added stale-bot
Dec 30, 2024
7e7b72e
stalebot test
Dec 30, 2024
5a676da
chNGED TO 1 DAY
Dec 30, 2024
d20ffde
edit 3
Dec 30, 2024
9b55d1a
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
Jan 1, 2025
5e568d8
Create test
Harmanpreet-Microsoft Jan 1, 2025
3eb8010
edit1
Jan 1, 2025
8b1298f
edit2
Jan 1, 2025
683c4a9
edit 4
Jan 1, 2025
8ebaa51
edit 5
Jan 1, 2025
801d6eb
edit 6
Jan 1, 2025
1c845fa
edit 6
Jan 1, 2025
82446b2
edit 7
Jan 1, 2025
a9f989f
edit 8
Jan 1, 2025
3e31574
edit 5
Jan 1, 2025
805a8ba
edit 10
Jan 1, 2025
ab4c4c5
edit 11
Jan 1, 2025
7a5dbb4
edit 12
Jan 1, 2025
a32fb8d
edit 13
Jan 1, 2025
bec99d7
Update stale-bot.yml
Harmanpreet-Microsoft Jan 1, 2025
df179d1
edit 14
Jan 2, 2025
d755232
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
Jan 2, 2025
955eb5b
edit 15
Jan 2, 2025
bc48275
edit 16
Jan 2, 2025
e47008f
edit 17
Jan 2, 2025
6a56c07
Update stale-bot.yml
Harmanpreet-Microsoft Jan 3, 2025
5905679
Update CODEOWNER
Harmanpreet-Microsoft Jan 3, 2025
40dfc88
Create nwetest
Harmanpreet-Microsoft Jan 3, 2025
07e1d4e
added pylint
Jan 7, 2025
06f1c2f
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
Jan 7, 2025
9222555
changed flak loc
Jan 7, 2025
bc4e843
edit 1
Jan 7, 2025
7ddb489
add backend test workflow
Jan 7, 2025
aceb522
added test file
Jan 8, 2025
47b3741
edit 2
Jan 8, 2025
950d330
added sample test file
Jan 8, 2025
962b38b
changed py version
Jan 8, 2025
f31bf82
made edits to workflow
Jan 8, 2025
0fcbff4
pass even if test filesa r not present
Jan 8, 2025
4569e80
removed test file
Jan 8, 2025
c0a4dae
added sample test file
Jan 8, 2025
182db35
Create docker-build-and-push.yml
Harmanpreet-Microsoft Jan 14, 2025
d6afd6f
Merge pull request #1 from Harmanpreet-Microsoft/stale_bot_tset
Harmanpreet-Microsoft Jan 14, 2025
0bf1920
Merge pull request #4 from microsoft/main
Harmanpreet-Microsoft Jan 15, 2025
c754e9c
Delete test
Harmanpreet-Microsoft Jan 15, 2025
3109279
Delete src/backend/middleware/test_health_check.py
Harmanpreet-Microsoft Jan 15, 2025
23cd01f
Delete .github/nwetest
Harmanpreet-Microsoft Jan 15, 2025
a720e12
Delete .github/workflows/CI.yml
Harmanpreet-Microsoft Jan 15, 2025
7791bd8
updated docker
Jan 15, 2025
4a1ece9
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
Jan 15, 2025
e31db2d
Testcases
UtkarshMishra-Microsoft Jan 15, 2025
b8ef736
Testcases
UtkarshMishra-Microsoft Jan 16, 2025
945062f
Testcases
UtkarshMishra-Microsoft Jan 16, 2025
6d92760
Update test.yml
Harmanpreet-Microsoft Jan 17, 2025
701695a
Testcases
UtkarshMishra-Microsoft Jan 17, 2025
7c74a8c
Testcases
UtkarshMishra-Microsoft Jan 17, 2025
f5e648a
Merge branch 'hotfix' into UT-10888-backend
Roopan-Microsoft Jan 17, 2025
fc3e814
Merge branch 'testcases-branch' into UT-10888-backend
Harmanpreet-Microsoft Jan 17, 2025
e1dda51
Testcases
UtkarshMishra-Microsoft Jan 17, 2025
ab065a0
Testcases
UtkarshMishra-Microsoft Jan 17, 2025
352e88a
Testcases
UtkarshMishra-Microsoft Jan 17, 2025
f672d43
Testcases
UtkarshMishra-Microsoft Jan 17, 2025
3105a0e
Merge branch 'hotfix' into UT-10888-backend
Roopan-Microsoft Jan 20, 2025
5a683db
Pylint issues fixed
Roopan-Microsoft Jan 20, 2025
3769ccc
pylint issues fixed
Roopan-Microsoft Jan 20, 2025
472af31
Pylint issues fixed
Roopan-Microsoft Jan 20, 2025
87bb3bd
Pylint issues fixed
Roopan-Microsoft Jan 20, 2025
9f12529
pylint fixed for line
Roopan-Microsoft Jan 20, 2025
3b8a63f
fix for test cases failure
Jan 20, 2025
e34ecfc
added agentutils test
Jan 21, 2025
3415894
updated test utils file
Jan 21, 2025
4b91693
Testcases
UtkarshMishra-Microsoft Jan 21, 2025
7966c45
Testcases
UtkarshMishra-Microsoft Jan 21, 2025
0970f67
Testcases
UtkarshMishra-Microsoft Jan 21, 2025
1873fad
Testcases
UtkarshMishra-Microsoft Jan 21, 2025
7b99b4b
Testcases
UtkarshMishra-Microsoft Jan 21, 2025
624f7a6
added genric test file
Jan 22, 2025
eacc9ef
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
5297cfb
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
UtkarshMishra-Microsoft Jan 22, 2025
a1b6077
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
4c46ae3
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
ca3490b
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
8a8aa25
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
100b43a
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
3b229fe
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
a1d8a14
solving pylint errors
Jan 22, 2025
1e141d7
resolved pylint errors
Jan 22, 2025
4ef9083
edit 2
Jan 22, 2025
2c30ff4
resolving pylint
Jan 22, 2025
fda1e2f
edit 3
Jan 22, 2025
440ca84
resolved issue
Jan 22, 2025
89659b5
resolve edit 5
Jan 22, 2025
a61c0cb
resoleving pylint edit 6
Jan 22, 2025
f84ad1f
pylint error edit 7
Jan 22, 2025
f20b5f3
Update test.yml
UtkarshMishra-Microsoft Jan 22, 2025
f5940d4
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
2989411
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
UtkarshMishra-Microsoft Jan 22, 2025
33e9bc4
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
59f9794
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
88d27b3
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
a84a75c
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
e7b2375
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
e2a77bc
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
78738ce
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
af1681c
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
1e0531d
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
b1182d3
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
133e876
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
6694d2c
Testcases
UtkarshMishra-Microsoft Jan 22, 2025
8d774a2
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
39b1f53
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
ab92475
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
9eba704
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
9ec790d
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
6790879
Update test.yml
UtkarshMishra-Microsoft Jan 23, 2025
e44730e
Update test.yml
UtkarshMishra-Microsoft Jan 23, 2025
1b653dd
Update test.yml
UtkarshMishra-Microsoft Jan 23, 2025
fc14494
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
26a3cb8
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
UtkarshMishra-Microsoft Jan 23, 2025
7f901f4
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
510f3a0
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
5558053
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
9397322
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
a7badbe
Merge branch 'hotfix' into UT-10888-backend
UtkarshMishra-Microsoft Jan 23, 2025
3e41cfb
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
f4b4fb5
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
86df8c5
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
8652cff
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
f59954e
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
f7bd5fb
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
49934de
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
15231f7
Testcases
UtkarshMishra-Microsoft Jan 23, 2025
cf7aff8
Testing
UtkarshMishra-Microsoft Jan 24, 2025
a949dc2
Testing
UtkarshMishra-Microsoft Jan 24, 2025
bc879a5
Testcases
UtkarshMishra-Microsoft Jan 24, 2025
984a6d3
Testcases
UtkarshMishra-Microsoft Jan 24, 2025
4bd890b
Testcases
UtkarshMishra-Microsoft Jan 24, 2025
4918ff0
Testcases
UtkarshMishra-Microsoft Jan 24, 2025
8461a50
Testcases
UtkarshMishra-Microsoft Jan 27, 2025
a94e78b
Testcases
UtkarshMishra-Microsoft Jan 27, 2025
bceb635
added test_base_agent file
Jan 28, 2025
e624781
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
Jan 28, 2025
265a0a4
Merge branch 'hotfix' into UT-10888-backend
UtkarshMishra-Microsoft Jan 28, 2025
89a5430
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
70db478
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
a1ec196
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
626fc67
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
8d9dd35
added the test_agentutils and test_base_agent
Jan 28, 2025
c78ddcb
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
Jan 28, 2025
2feb981
deleted agentutils.py
Jan 28, 2025
b3c2ef4
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
82f27a4
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
e790043
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
5702440
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
8ba7f17
Testcases
UtkarshMishra-Microsoft Jan 28, 2025
4affc61
Testcases
UtkarshMishra-Microsoft Jan 29, 2025
c7ff11b
Testcases
UtkarshMishra-Microsoft Jan 29, 2025
40aef6b
edited flak
Jan 29, 2025
bd6dd94
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
Jan 29, 2025
6d84ffa
resolved pylint issues
Jan 29, 2025
b3f4305
Test case Group_chat_manager
Pradheep-Microsoft Jan 29, 2025
11d9f85
Test case Group_chat_manager
Pradheep-Microsoft Jan 29, 2025
c8379d9
updated test_agentutils.py
Jan 29, 2025
8da83f7
editv1
Jan 29, 2025
7152dfa
resolving pylint issue
Jan 29, 2025
1711b0e
edit 2
Jan 29, 2025
cdd1965
Testcases
UtkarshMishra-Microsoft Jan 30, 2025
e48cc18
Testcases
UtkarshMishra-Microsoft Jan 30, 2025
cbcad96
Testcases
UtkarshMishra-Microsoft Jan 30, 2025
4cdb383
Testcases
UtkarshMishra-Microsoft Jan 30, 2025
81aec05
Merge branch 'UT-10888-backend' of https://github.com/microsoft/Multi…
Pradheep-Microsoft Jan 30, 2025
cf7559b
Merge branch 'hotfix' into UT-10888-backend
Roopan-Microsoft Feb 3, 2025
f0c0590
docker changes reverted
Roopan-Microsoft Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
max-line-length = 88
extend-ignore = E501
exclude = .venv, frontend
ignore = E203, W503, G004, G200
ignore = E203, W503, G004, G200, E402
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r src/backend/requirements.txt
pip install pytest-cov
pip install pytest-asyncio

- name: Check if test files exist
id: check_tests
Expand All @@ -50,7 +48,6 @@ jobs:
echo "Test files found, running tests."
echo "skip_tests=false" >> $GITHUB_ENV
fi

- name: Run tests with coverage
if: env.skip_tests == 'false'
run: |
Expand All @@ -59,4 +56,4 @@ jobs:
- name: Skip coverage report if no tests
if: env.skip_tests == 'true'
run: |
echo "Skipping coverage report because no tests were found."
echo "Skipping coverage report because no tests were found."
Empty file added src/__init__.py
Empty file.
Empty file added src/backend/__init__.py
Empty file.
Empty file added src/backend/agents/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions src/backend/agents/agentutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
)
from pydantic import BaseModel

from context.cosmos_memory import CosmosBufferedChatCompletionContext
from models.messages import Step
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.models.messages import Step

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?"

Expand Down
6 changes: 3 additions & 3 deletions src/backend/agents/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
from autogen_core.components.tool_agent import tool_agent_caller_loop
from autogen_core.components.tools import Tool

from context.cosmos_memory import CosmosBufferedChatCompletionContext
from models.messages import (
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.models.messages import (
ActionRequest,
ActionResponse,
AgentMessage,
Step,
StepStatus,
)
from event_utils import track_event_if_configured
from src.backend.event_utils import track_event_if_configured


class BaseAgent(RoutedAgent):
Expand Down
4 changes: 2 additions & 2 deletions src/backend/agents/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from autogen_core.components.models import AzureOpenAIChatCompletionClient
from autogen_core.components.tools import FunctionTool, Tool

from agents.base_agent import BaseAgent
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.agents.base_agent import BaseAgent
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext


async def dummy_function() -> str:
Expand Down
6 changes: 3 additions & 3 deletions src/backend/agents/group_chat_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from autogen_core.components import RoutedAgent, default_subscription, message_handler
from autogen_core.components.models import AzureOpenAIChatCompletionClient

from context.cosmos_memory import CosmosBufferedChatCompletionContext
from models.messages import (
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.models.messages import (
ActionRequest,
AgentMessage,
BAgentType,
Expand All @@ -22,7 +22,7 @@
StepStatus,
)

from event_utils import track_event_if_configured
from src.backend.event_utils import track_event_if_configured


@default_subscription
Expand Down
4 changes: 2 additions & 2 deletions src/backend/agents/hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from autogen_core.components.tools import FunctionTool, Tool
from typing_extensions import Annotated

from agents.base_agent import BaseAgent
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.agents.base_agent import BaseAgent
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext

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."

Expand Down
6 changes: 3 additions & 3 deletions src/backend/agents/human.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
from autogen_core.base import AgentId, MessageContext
from autogen_core.components import RoutedAgent, default_subscription, message_handler

from context.cosmos_memory import CosmosBufferedChatCompletionContext
from models.messages import (
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.models.messages import (
ApprovalRequest,
HumanFeedback,
StepStatus,
AgentMessage,
Step,
)
from event_utils import track_event_if_configured
from src.backend.event_utils import track_event_if_configured


@default_subscription
Expand Down
4 changes: 2 additions & 2 deletions src/backend/agents/marketing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from autogen_core.components.models import AzureOpenAIChatCompletionClient
from autogen_core.components.tools import FunctionTool, Tool

from agents.base_agent import BaseAgent
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.agents.base_agent import BaseAgent
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext


# Define new Marketing tools (functions)
Expand Down
6 changes: 3 additions & 3 deletions src/backend/agents/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
)
from pydantic import BaseModel

from context.cosmos_memory import CosmosBufferedChatCompletionContext
from models.messages import (
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.models.messages import (
AgentMessage,
HumanClarification,
BAgentType,
Expand All @@ -26,7 +26,7 @@
HumanFeedbackStatus,
)

from event_utils import track_event_if_configured
from src.backend.event_utils import track_event_if_configured


@default_subscription
Expand Down
4 changes: 2 additions & 2 deletions src/backend/agents/procurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from autogen_core.components.tools import FunctionTool, Tool
from typing_extensions import Annotated

from agents.base_agent import BaseAgent
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.agents.base_agent import BaseAgent
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext


# Define new Procurement tools (functions)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/agents/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from autogen_core.components.tools import FunctionTool, Tool
from typing_extensions import Annotated

from agents.base_agent import BaseAgent
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.agents.base_agent import BaseAgent
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext

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."

Expand Down
5 changes: 2 additions & 3 deletions src/backend/agents/tech_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from autogen_core.components.tools import FunctionTool, Tool
from typing_extensions import Annotated

from agents.base_agent import BaseAgent
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.agents.base_agent import BaseAgent
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext

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."

Expand Down Expand Up @@ -523,7 +523,6 @@ async def get_tech_information(
Document Name: Contoso's IT Policy and Procedure Manual
Domain: IT Policy
Description: A comprehensive guide detailing the IT policies and procedures at Contoso, including acceptable use, security protocols, and incident reporting.

At Contoso, we prioritize the security and efficiency of our IT infrastructure. All employees are required to adhere to the following policies:
- Use strong passwords and change them every 90 days.
- Report any suspicious emails to the IT department immediately.
Expand Down
14 changes: 7 additions & 7 deletions src/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import os
import uuid
from typing import List, Optional
from middleware.health_check import HealthCheckMiddleware
from src.backend.middleware.health_check import HealthCheckMiddleware
from autogen_core.base import AgentId
from fastapi import FastAPI, HTTPException, Query, Request
from auth.auth_utils import get_authenticated_user_details
from config import Config
from context.cosmos_memory import CosmosBufferedChatCompletionContext
from models.messages import (
from src.backend.auth.auth_utils import get_authenticated_user_details
from src.backend.config import Config
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
from src.backend.models.messages import (
HumanFeedback,
HumanClarification,
InputTask,
Expand All @@ -19,8 +19,8 @@
AgentMessage,
PlanWithSteps,
)
from utils import initialize_runtime_and_context, retrieve_all_agent_tools, rai_success
from event_utils import track_event_if_configured
from src.backend.utils import initialize_runtime_and_context, retrieve_all_agent_tools, rai_success
from src.backend.event_utils import track_event_if_configured
from fastapi.middleware.cors import CORSMiddleware
from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
Expand Down
4 changes: 2 additions & 2 deletions src/backend/context/cosmos_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
)
from azure.cosmos.partition_key import PartitionKey

from config import Config
from models.messages import BaseDataModel, Plan, Session, Step, AgentMessage
from src.backend.config import Config
from src.backend.models.messages import BaseDataModel, Plan, Session, Step, AgentMessage


class CosmosBufferedChatCompletionContext(BufferedChatCompletionContext):
Expand Down
Empty file.
4 changes: 3 additions & 1 deletion src/backend/handlers/runtime_interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from autogen_core.base import AgentId
from autogen_core.base.intervention import DefaultInterventionHandler

from models.messages import GetHumanInputMessage, GroupChatMessage
from src.backend.models.messages import GroupChatMessage

from src.backend.models.messages import GetHumanInputMessage


class NeedsUserInputHandler(DefaultInterventionHandler):
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions src/backend/models/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,11 @@ class RequestToSpeak(BaseModel):

def to_dict(self):
return self.model_dump()


class GetHumanInputMessage:
def __init__(self, message):
self.message = message

def __str__(self):
return f"GetHumanInputMessage: {self.message}"
5 changes: 5 additions & 0 deletions src/backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ opentelemetry-instrumentation-fastapi
opentelemetry-instrumentation-openai
opentelemetry-exporter-otlp-proto-http
opentelemetry-exporter-otlp-proto-grpc

# Testing tools
pytest>=8.2,<9 # Compatible version for pytest-asyncio
pytest-asyncio==0.24.0
pytest-cov==5.0.0
Empty file added src/backend/tests/__init__.py
Empty file.
Empty file.
54 changes: 54 additions & 0 deletions src/backend/tests/agents/test_agentutils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# pylint: disable=import-error, wrong-import-position, missing-module-docstring
import os
import sys
from unittest.mock import MagicMock
import pytest
from pydantic import ValidationError

# Environment and module setup
sys.modules["azure.monitor.events.extension"] = MagicMock()

os.environ["COSMOSDB_ENDPOINT"] = "https://mock-endpoint"
os.environ["COSMOSDB_KEY"] = "mock-key"
os.environ["COSMOSDB_DATABASE"] = "mock-database"
os.environ["COSMOSDB_CONTAINER"] = "mock-container"
os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"] = "mock-deployment-name"
os.environ["AZURE_OPENAI_API_VERSION"] = "2023-01-01"
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://mock-openai-endpoint"

from src.backend.agents.agentutils import extract_and_update_transition_states # noqa: F401, C0413
from src.backend.models.messages import Step # noqa: F401, C0413


def test_step_initialization():
"""Test Step initialization with valid data."""
step = Step(
data_type="step",
plan_id="test_plan",
action="test_action",
agent="HumanAgent",
session_id="test_session",
user_id="test_user",
agent_reply="test_reply",
)

assert step.data_type == "step"
assert step.plan_id == "test_plan"
assert step.action == "test_action"
assert step.agent == "HumanAgent"
assert step.session_id == "test_session"
assert step.user_id == "test_user"
assert step.agent_reply == "test_reply"
assert step.status == "planned"
assert step.human_approval_status == "requested"


def test_step_missing_required_fields():
"""Test Step initialization with missing required fields."""
with pytest.raises(ValidationError):
Step(
data_type="step",
action="test_action",
agent="test_agent",
session_id="test_session",
)
Loading
Loading