|
1 | 1 | # app_kernel.py |
2 | 2 | import asyncio |
| 3 | +import json |
3 | 4 | import logging |
4 | 5 | import os |
5 | | -import uuid |
6 | 6 | import re |
7 | | -import json |
8 | | -from typing import List, Dict, Optional, Any |
| 7 | +import uuid |
| 8 | +from typing import Any, Dict, List, Optional |
9 | 9 |
|
10 | | -# FastAPI imports |
11 | | -from fastapi import FastAPI, HTTPException, Query, Request |
12 | | -from fastapi.middleware.cors import CORSMiddleware |
| 10 | +# Semantic Kernel imports |
| 11 | +import semantic_kernel as sk |
| 12 | +from app_config import config |
| 13 | +from auth.auth_utils import get_authenticated_user_details |
13 | 14 |
|
14 | 15 | # Azure monitoring |
15 | 16 | from azure.monitor.opentelemetry import configure_azure_monitor |
| 17 | +from config_kernel import Config |
| 18 | +from context.cosmos_memory_kernel import CosmosMemoryContext |
| 19 | +from event_utils import track_event_if_configured |
16 | 20 |
|
17 | | -# Semantic Kernel imports |
18 | | -import semantic_kernel as sk |
19 | | - |
20 | | -# Updated import for KernelArguments |
21 | | -from semantic_kernel.functions.kernel_arguments import KernelArguments |
| 21 | +# FastAPI imports |
| 22 | +from fastapi import FastAPI, HTTPException, Query, Request |
| 23 | +from fastapi.middleware.cors import CORSMiddleware |
| 24 | +from kernel_agents.agent_factory import AgentFactory |
22 | 25 |
|
23 | 26 | # Local imports |
24 | 27 | from middleware.health_check import HealthCheckMiddleware |
25 | | -from auth.auth_utils import get_authenticated_user_details |
26 | | -from config_kernel import Config |
27 | | -from context.cosmos_memory_kernel import CosmosMemoryContext |
28 | 28 | from models.messages_kernel import ( |
29 | | - HumanFeedback, |
| 29 | + ActionRequest, |
| 30 | + ActionResponse, |
| 31 | + AgentMessage, |
| 32 | + AgentType, |
30 | 33 | HumanClarification, |
| 34 | + HumanFeedback, |
31 | 35 | InputTask, |
32 | 36 | Plan, |
33 | | - Step, |
34 | | - AgentMessage, |
35 | 37 | PlanWithSteps, |
36 | | - ActionRequest, |
37 | | - ActionResponse, |
| 38 | + Step, |
38 | 39 | ) |
39 | | -from utils_kernel import initialize_runtime_and_context, get_agents, rai_success |
40 | | -from event_utils import track_event_if_configured |
41 | | -from models.messages_kernel import AgentType |
42 | | -from kernel_agents.agent_factory import AgentFactory |
43 | | -from app_config import config |
| 40 | + |
| 41 | +# Updated import for KernelArguments |
| 42 | +from semantic_kernel.functions.kernel_arguments import KernelArguments |
| 43 | +from utils_kernel import get_agents, initialize_runtime_and_context, rai_success |
44 | 44 |
|
45 | 45 | # # Check if the Application Insights Instrumentation Key is set in the environment variables |
46 | | -instrumentation_key = os.getenv("APPLICATIONINSIGHTS_INSTRUMENTATION_KEY") |
47 | | -if instrumentation_key: |
| 46 | +connection_string = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING") |
| 47 | +if connection_string: |
48 | 48 | # Configure Application Insights if the Instrumentation Key is found |
49 | | - configure_azure_monitor(connection_string=instrumentation_key) |
| 49 | + configure_azure_monitor(connection_string=connection_string) |
50 | 50 | logging.info( |
51 | 51 | "Application Insights configured with the provided Instrumentation Key" |
52 | 52 | ) |
|
0 commit comments