cwyodmodules 0.3.46__tar.gz → 0.3.47__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/PKG-INFO +2 -2
  2. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/env_helper.py +4 -5
  3. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/mgmt_config.py +181 -132
  4. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules.egg-info/PKG-INFO +2 -2
  5. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules.egg-info/SOURCES.txt +0 -1
  6. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules.egg-info/requires.txt +1 -1
  7. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/pyproject.toml +2 -2
  8. cwyodmodules-0.3.46/cwyodmodules/batch/utilities/helpers/secret_helper.py +0 -79
  9. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/LICENSE +0 -0
  10. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/README.md +0 -0
  11. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/__init__.py +0 -0
  12. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/api/__init__.py +0 -0
  13. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/api/chat_history.py +0 -0
  14. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/__init__.py +0 -0
  15. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/__init__.py +0 -0
  16. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/chat_history/auth_utils.py +0 -0
  17. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/chat_history/cosmosdb.py +0 -0
  18. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/chat_history/database_client_base.py +0 -0
  19. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/chat_history/database_factory.py +0 -0
  20. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/chat_history/postgresdbservice.py +0 -0
  21. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/chat_history/sample_user.py +0 -0
  22. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/common/__init__.py +0 -0
  23. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/common/answer.py +0 -0
  24. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/common/source_document.py +0 -0
  25. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/__init__.py +0 -0
  26. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/chunking_strategy.py +0 -0
  27. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/document_chunking_base.py +0 -0
  28. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/fixed_size_overlap.py +0 -0
  29. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/layout.py +0 -0
  30. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/page.py +0 -0
  31. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/paragraph.py +0 -0
  32. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_chunking/strategies.py +0 -0
  33. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/__init__.py +0 -0
  34. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/document_loading_base.py +0 -0
  35. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/layout.py +0 -0
  36. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/read.py +0 -0
  37. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/strategies.py +0 -0
  38. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/web.py +0 -0
  39. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/document_loading/word_document.py +0 -0
  40. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/__init__.py +0 -0
  41. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/azure_blob_storage_client.py +0 -0
  42. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/azure_computer_vision_client.py +0 -0
  43. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/azure_form_recognizer_helper.py +0 -0
  44. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/azure_postgres_helper.py +0 -0
  45. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/azure_postgres_helper_light_rag.py +0 -0
  46. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/azure_search_helper.py +0 -0
  47. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/agent_mode.py +0 -0
  48. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/assistant_strategy.py +0 -0
  49. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/config_helper.py +0 -0
  50. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/conversation_flow.py +0 -0
  51. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/database_type.py +0 -0
  52. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/default.json +0 -0
  53. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/default_contract_assistant_prompt.txt +0 -0
  54. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/default_employee_assistant_prompt.txt +0 -0
  55. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/config/embedding_config.py +0 -0
  56. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/document_chunking_helper.py +0 -0
  57. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/document_loading_helper.py +0 -0
  58. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/embedders/embedder_base.py +0 -0
  59. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/embedders/embedder_factory.py +0 -0
  60. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py +0 -0
  61. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/embedders/postgres_embedder.py +0 -0
  62. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/embedders/push_embedder.py +0 -0
  63. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/lightrag_helper.py +0 -0
  64. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/llm_helper.py +0 -0
  65. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/helpers/orchestrator_helper.py +0 -0
  66. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_datasource.py +0 -0
  67. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_index.py +0 -0
  68. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_indexer.py +0 -0
  69. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_skillset.py +0 -0
  70. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/loggers/conversation_logger.py +0 -0
  71. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/__init__.py +0 -0
  72. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/lang_chain_agent.py +0 -0
  73. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/open_ai_functions.py +0 -0
  74. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/orchestration_strategy.py +0 -0
  75. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/orchestrator_base.py +0 -0
  76. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/prompt_flow.py +0 -0
  77. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/semantic_kernel_orchestrator.py +0 -0
  78. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/orchestrator/strategies.py +0 -0
  79. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/parser/__init__.py +0 -0
  80. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/parser/output_parser_tool.py +0 -0
  81. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/parser/parser_base.py +0 -0
  82. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/plugins/chat_plugin.py +0 -0
  83. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/plugins/outlook_calendar_plugin.py +0 -0
  84. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/plugins/post_answering_plugin.py +0 -0
  85. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/azure_search_handler.py +0 -0
  86. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/azure_search_handler_light_rag.py +0 -0
  87. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/integrated_vectorization_search_handler.py +0 -0
  88. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/lightrag_search_handler.py +0 -0
  89. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/postgres_search_handler.py +0 -0
  90. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/postgres_search_handler_light_rag.py +0 -0
  91. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/search.py +0 -0
  92. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/search/search_handler_base.py +0 -0
  93. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/__init__.py +0 -0
  94. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/answer_processing_base.py +0 -0
  95. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/answering_tool_base.py +0 -0
  96. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/content_safety_checker.py +0 -0
  97. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/post_prompt_tool.py +0 -0
  98. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/question_answer_tool.py +0 -0
  99. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/batch/utilities/tools/text_processing_tool.py +0 -0
  100. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/__init__.py +0 -0
  101. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/config.py +0 -0
  102. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/database/__init__.py +0 -0
  103. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/database/base.py +0 -0
  104. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/database/models.py +0 -0
  105. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/indexing/__init__.py +0 -0
  106. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/indexing/chunking.py +0 -0
  107. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/indexing/extraction.py +0 -0
  108. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/indexing/types.py +0 -0
  109. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/indexing/upsert.py +0 -0
  110. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/indexing/utils.py +0 -0
  111. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/llm/__init__.py +0 -0
  112. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/llm/llm.py +0 -0
  113. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/llm/prompt.py +0 -0
  114. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/main.py +0 -0
  115. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/query/__init__.py +0 -0
  116. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/query/generate.py +0 -0
  117. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/query/graph_search.py +0 -0
  118. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/query/types.py +0 -0
  119. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules/graphrag/query/vector_search.py +0 -0
  120. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules.egg-info/dependency_links.txt +0 -0
  121. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/cwyodmodules.egg-info/top_level.txt +0 -0
  122. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/setup.cfg +0 -0
  123. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/tests/test_api.py +0 -0
  124. {cwyodmodules-0.3.46 → cwyodmodules-0.3.47}/tests/test_batch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.46
3
+ Version: 0.3.47
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -40,7 +40,7 @@ Requires-Dist: azure-search-documents==11.6.0b4
40
40
  Requires-Dist: semantic-kernel==1.3.0
41
41
  Requires-Dist: pydantic==2.7.4
42
42
  Requires-Dist: pandas>=2.2.3
43
- Requires-Dist: azpaddypy>=0.3.4
43
+ Requires-Dist: azpaddypy>=0.3.5
44
44
  Dynamic: license-file
45
45
 
46
46
  # paddypy
@@ -6,9 +6,8 @@ import threading
6
6
  from ..orchestrator.orchestration_strategy import OrchestrationStrategy
7
7
  from ..helpers.config.conversation_flow import ConversationFlow
8
8
  from ..helpers.config.database_type import DatabaseType
9
- from ..helpers.secret_helper import SecretHelper
10
9
 
11
- from mgmt_config import logger, identity
10
+ from mgmt_config import logger, identity, keyvault, create_keyvault_client
12
11
 
13
12
 
14
13
 
@@ -33,10 +32,10 @@ class EnvHelper:
33
32
  # Wrapper for Azure Key Vault
34
33
  os.environ["APPLICATIONINSIGHTS_ENABLED"] = "true"
35
34
 
36
- self.secretHelper = SecretHelper(keyvault_uri=os.environ["key_vault_uri"])
35
+ self.secretHelper = keyvault
37
36
 
38
- self.secretHelperHead = SecretHelper(
39
- keyvault_uri=os.environ["head_key_vault_uri"]
37
+ self.secretHelperHead = create_keyvault_client(
38
+ vault_url=os.environ["head_key_vault_uri"]
40
39
  )
41
40
 
42
41
  # self.secretHelper = SecretHelper(
@@ -1,132 +1,181 @@
1
- """
2
- Azure Project Management Configuration Template
3
-
4
- This template provides standardized configuration for Azure logging and identity
5
- management across projects. It creates singleton instances of AzureLogger and
6
- AzureIdentity that can be imported and used throughout your application.
7
-
8
- Usage:
9
- from mgmt_config import logger, identity
10
-
11
- logger.info("Application started")
12
- credential = identity.get_credential()
13
- """
14
-
15
- import os
16
- from typing import Optional, Dict, Any
17
- from azpaddypy.mgmt.logging import create_app_logger, create_function_logger
18
- from azpaddypy.mgmt.identity import create_azure_identity
19
-
20
- # =============================================================================
21
- # SERVICE CONFIGURATION
22
- # =============================================================================
23
-
24
- # Service identity - customize these for your project
25
- SERVICE_NAME = os.getenv("SERVICE_NAME", "cwyodmodules-pacakge")
26
- SERVICE_VERSION = os.getenv("SERVICE_VERSION", "1.0.0")
27
-
28
- # =============================================================================
29
- # LOGGING CONFIGURATION
30
- # =============================================================================
31
-
32
- # Enable console output (useful for local development)
33
- LOGGER_ENABLE_CONSOLE = os.getenv("LOGGER_ENABLE_CONSOLE", "true").lower() == "true"
34
-
35
- # Application Insights connection string (optional, will use environment variable if not set)
36
- LOGGER_CONNECTION_STRING = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING")
37
-
38
- # Configure which Azure SDK components to instrument
39
- LOGGER_INSTRUMENTATION_OPTIONS = {
40
- "azure_sdk": {"enabled": True},
41
- "django": {"enabled": False},
42
- "fastapi": {"enabled": False},
43
- "flask": {"enabled": True},
44
- "psycopg2": {"enabled": True},
45
- "requests": {"enabled": True},
46
- "urllib": {"enabled": True},
47
- "urllib3": {"enabled": True},
48
- }
49
-
50
- # =============================================================================
51
- # IDENTITY CONFIGURATION
52
- # =============================================================================
53
-
54
- # Token caching settings
55
- IDENTITY_ENABLE_TOKEN_CACHE = os.getenv("IDENTITY_ENABLE_TOKEN_CACHE", "true").lower() == "true"
56
- IDENTITY_ALLOW_UNENCRYPTED_STORAGE = os.getenv("IDENTITY_ALLOW_UNENCRYPTED_STORAGE", "true").lower() == "true"
57
-
58
- # Custom credential options (None means use defaults)
59
- IDENTITY_CUSTOM_CREDENTIAL_OPTIONS: Optional[Dict[str, Any]] = None
60
-
61
- # Connection string for identity logging (uses same as logger by default)
62
- IDENTITY_CONNECTION_STRING = LOGGER_CONNECTION_STRING
63
-
64
- # =============================================================================
65
- # INITIALIZE SERVICES
66
- # =============================================================================
67
- # Create logger instance
68
- if "functionapp" in os.getenv("REFLECTION_KIND", "app"):
69
- logger = create_function_logger(
70
- function_app_name=os.getenv("REFLECTION_NAME", "app"),
71
- function_name="backend",
72
- service_version=SERVICE_VERSION,
73
- connection_string=LOGGER_CONNECTION_STRING,
74
- instrumentation_options=LOGGER_INSTRUMENTATION_OPTIONS,
75
- )
76
- logger.info("Function logger initialized")
77
- else:
78
- logger = create_app_logger(
79
- service_name=SERVICE_NAME,
80
- service_version=SERVICE_VERSION,
81
- connection_string=LOGGER_CONNECTION_STRING,
82
- enable_console_logging=LOGGER_ENABLE_CONSOLE,
83
- instrumentation_options=LOGGER_INSTRUMENTATION_OPTIONS,
84
- )
85
- logger.info("App logger initialized")
86
-
87
- # Create identity instance with shared logger
88
- identity = create_azure_identity(
89
- service_name=SERVICE_NAME,
90
- service_version=SERVICE_VERSION,
91
- enable_token_cache=IDENTITY_ENABLE_TOKEN_CACHE,
92
- allow_unencrypted_storage=IDENTITY_ALLOW_UNENCRYPTED_STORAGE,
93
- custom_credential_options=IDENTITY_CUSTOM_CREDENTIAL_OPTIONS,
94
- connection_string=IDENTITY_CONNECTION_STRING,
95
- logger=logger,
96
- )
97
-
98
- # =============================================================================
99
- # VALIDATION & STARTUP
100
- # =============================================================================
101
-
102
- # Validate critical configuration
103
- if SERVICE_NAME == __name__:
104
- logger.warning(
105
- "SERVICE_NAME is not configured. Please set SERVICE_NAME environment variable or update this template.",
106
- extra={"configuration_issue": "service_name_not_set"}
107
- )
108
-
109
- if not LOGGER_CONNECTION_STRING:
110
- logger.info(
111
- "No Application Insights connection string configured. Telemetry will be disabled.",
112
- extra={"telemetry_status": "disabled"}
113
- )
114
-
115
- # Log successful initialization
116
- logger.info(
117
- f"Management configuration initialized for service '{SERVICE_NAME}' v{SERVICE_VERSION}",
118
- extra={
119
- "service_name": SERVICE_NAME,
120
- "service_version": SERVICE_VERSION,
121
- "console_logging": LOGGER_ENABLE_CONSOLE,
122
- "token_cache_enabled": IDENTITY_ENABLE_TOKEN_CACHE,
123
- "telemetry_enabled": bool(LOGGER_CONNECTION_STRING),
124
- }
125
- )
126
-
127
- # =============================================================================
128
- # EXPORTS
129
- # =============================================================================
130
-
131
- # Export both logger and identity for use in applications
132
- __all__ = ["logger", "identity"]
1
+ """
2
+ Azure Project Management Configuration Template
3
+
4
+ This template provides standardized configuration for Azure logging, identity,
5
+ and KeyVault management across projects. It creates singleton instances of
6
+ AzureLogger, AzureIdentity, and AzureKeyVault that can be imported and used
7
+ throughout your application.
8
+
9
+ Usage:
10
+ from mgmt_config import logger, identity, keyvault
11
+
12
+ logger.info("Application started")
13
+ credential = identity.get_credential()
14
+ secret = keyvault.get_secret("my-secret") if keyvault else None
15
+ """
16
+
17
+ import os
18
+ from typing import Optional, Dict, Any
19
+ from azpaddypy.mgmt.logging import create_app_logger
20
+ from azpaddypy.mgmt.identity import create_azure_identity
21
+ from azpaddypy.resources.keyvault import create_azure_keyvault, AzureKeyVault
22
+
23
+ # =============================================================================
24
+ # SERVICE CONFIGURATION
25
+ # =============================================================================
26
+
27
+ # Service identity - customize these for your project
28
+ SERVICE_NAME = os.getenv("SERVICE_NAME", "cwyodmodules-pacakge")
29
+ SERVICE_VERSION = os.getenv("SERVICE_VERSION", "1.0.0")
30
+
31
+ # =============================================================================
32
+ # LOGGING CONFIGURATION
33
+ # =============================================================================
34
+
35
+ # Enable console output (useful for local development)
36
+ LOGGER_ENABLE_CONSOLE = os.getenv("LOGGER_ENABLE_CONSOLE", "true").lower() == "true"
37
+
38
+ # Application Insights connection string (optional, will use environment variable if not set)
39
+ LOGGER_CONNECTION_STRING = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING")
40
+
41
+ # Configure which Azure SDK components to instrument
42
+ LOGGER_INSTRUMENTATION_OPTIONS = {
43
+ "azure_sdk": {"enabled": True},
44
+ "django": {"enabled": False},
45
+ "fastapi": {"enabled": False},
46
+ "flask": {"enabled": True},
47
+ "psycopg2": {"enabled": True},
48
+ "requests": {"enabled": True},
49
+ "urllib": {"enabled": True},
50
+ "urllib3": {"enabled": True},
51
+ }
52
+
53
+ # =============================================================================
54
+ # IDENTITY CONFIGURATION
55
+ # =============================================================================
56
+
57
+ # Token caching settings
58
+ IDENTITY_ENABLE_TOKEN_CACHE = os.getenv("IDENTITY_ENABLE_TOKEN_CACHE", "true").lower() == "true"
59
+ IDENTITY_ALLOW_UNENCRYPTED_STORAGE = os.getenv("IDENTITY_ALLOW_UNENCRYPTED_STORAGE", "true").lower() == "true"
60
+
61
+ # Custom credential options (None means use defaults)
62
+ IDENTITY_CUSTOM_CREDENTIAL_OPTIONS: Optional[Dict[str, Any]] = None
63
+
64
+ # Connection string for identity logging (uses same as logger by default)
65
+ IDENTITY_CONNECTION_STRING = LOGGER_CONNECTION_STRING
66
+
67
+ # =============================================================================
68
+ # KEYVAULT CONFIGURATION
69
+ # =============================================================================
70
+
71
+ # KeyVault URL (optional, will be None if not configured)
72
+ KEYVAULT_URL = os.getenv("key_vault_uri")
73
+
74
+ # KeyVault client enablement settings
75
+ KEYVAULT_ENABLE_SECRETS = os.getenv("KEYVAULT_ENABLE_SECRETS", "true").lower() == "true"
76
+ KEYVAULT_ENABLE_KEYS = os.getenv("KEYVAULT_ENABLE_KEYS", "false").lower() == "true"
77
+ KEYVAULT_ENABLE_CERTIFICATES = os.getenv("KEYVAULT_ENABLE_CERTIFICATES", "false").lower() == "true"
78
+
79
+ # Connection string for KeyVault logging (uses same as logger by default)
80
+ KEYVAULT_CONNECTION_STRING = LOGGER_CONNECTION_STRING
81
+
82
+ # =============================================================================
83
+ # INITIALIZE SERVICES
84
+ # =============================================================================
85
+
86
+ # Create logger instance
87
+ logger = create_app_logger(
88
+ service_name=SERVICE_NAME,
89
+ service_version=SERVICE_VERSION,
90
+ connection_string=LOGGER_CONNECTION_STRING,
91
+ enable_console_logging=LOGGER_ENABLE_CONSOLE,
92
+ instrumentation_options=LOGGER_INSTRUMENTATION_OPTIONS,
93
+ )
94
+
95
+ # Create identity instance with shared logger
96
+ identity = create_azure_identity(
97
+ service_name=SERVICE_NAME,
98
+ service_version=SERVICE_VERSION,
99
+ enable_token_cache=IDENTITY_ENABLE_TOKEN_CACHE,
100
+ allow_unencrypted_storage=IDENTITY_ALLOW_UNENCRYPTED_STORAGE,
101
+ custom_credential_options=IDENTITY_CUSTOM_CREDENTIAL_OPTIONS,
102
+ connection_string=IDENTITY_CONNECTION_STRING,
103
+ logger=logger,
104
+ )
105
+
106
+ # Create KeyVault instance with shared logger and identity (only if URL is configured)
107
+ keyvault = None
108
+ if KEYVAULT_URL:
109
+ keyvault = create_azure_keyvault(
110
+ vault_url=KEYVAULT_URL,
111
+ azure_identity=identity,
112
+ service_name=SERVICE_NAME,
113
+ service_version=SERVICE_VERSION,
114
+ logger=logger,
115
+ connection_string=KEYVAULT_CONNECTION_STRING,
116
+ enable_secrets=KEYVAULT_ENABLE_SECRETS,
117
+ enable_keys=KEYVAULT_ENABLE_KEYS,
118
+ enable_certificates=KEYVAULT_ENABLE_CERTIFICATES,
119
+ )
120
+
121
+ def create_keyvault_client(vault_url: str) -> Optional[AzureKeyVault]:
122
+ """Creates a secondary KeyVault client for a different vault."""
123
+ if not vault_url:
124
+ return None
125
+ return create_azure_keyvault(
126
+ vault_url=vault_url,
127
+ azure_identity=identity,
128
+ service_name=SERVICE_NAME,
129
+ service_version=SERVICE_VERSION,
130
+ logger=logger,
131
+ connection_string=KEYVAULT_CONNECTION_STRING,
132
+ enable_secrets=KEYVAULT_ENABLE_SECRETS,
133
+ enable_keys=KEYVAULT_ENABLE_KEYS,
134
+ enable_certificates=KEYVAULT_ENABLE_CERTIFICATES,
135
+ )
136
+
137
+ # =============================================================================
138
+ # VALIDATION & STARTUP
139
+ # =============================================================================
140
+
141
+ # Validate critical configuration
142
+ if SERVICE_NAME == "your-service-name":
143
+ logger.warning(
144
+ "SERVICE_NAME is not configured. Please set SERVICE_NAME environment variable or update this template.",
145
+ extra={"configuration_issue": "service_name_not_set"}
146
+ )
147
+
148
+ if not LOGGER_CONNECTION_STRING:
149
+ logger.info(
150
+ "No Application Insights connection string configured. Telemetry will be disabled.",
151
+ extra={"telemetry_status": "disabled"}
152
+ )
153
+
154
+ if not KEYVAULT_URL:
155
+ logger.info(
156
+ "No KeyVault URL configured. KeyVault operations will be disabled.",
157
+ extra={"keyvault_status": "disabled"}
158
+ )
159
+
160
+ # Log successful initialization
161
+ logger.info(
162
+ f"Management configuration initialized for service '{SERVICE_NAME}' v{SERVICE_VERSION}",
163
+ extra={
164
+ "service_name": SERVICE_NAME,
165
+ "service_version": SERVICE_VERSION,
166
+ "console_logging": LOGGER_ENABLE_CONSOLE,
167
+ "token_cache_enabled": IDENTITY_ENABLE_TOKEN_CACHE,
168
+ "telemetry_enabled": bool(LOGGER_CONNECTION_STRING),
169
+ "keyvault_enabled": bool(KEYVAULT_URL),
170
+ "keyvault_secrets_enabled": KEYVAULT_ENABLE_SECRETS,
171
+ "keyvault_keys_enabled": KEYVAULT_ENABLE_KEYS,
172
+ "keyvault_certificates_enabled": KEYVAULT_ENABLE_CERTIFICATES,
173
+ }
174
+ )
175
+
176
+ # =============================================================================
177
+ # EXPORTS
178
+ # =============================================================================
179
+
180
+ # Export logger, identity, and keyvault for use in applications
181
+ __all__ = ["logger", "identity", "keyvault", "create_keyvault_client"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.46
3
+ Version: 0.3.47
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -40,7 +40,7 @@ Requires-Dist: azure-search-documents==11.6.0b4
40
40
  Requires-Dist: semantic-kernel==1.3.0
41
41
  Requires-Dist: pydantic==2.7.4
42
42
  Requires-Dist: pandas>=2.2.3
43
- Requires-Dist: azpaddypy>=0.3.4
43
+ Requires-Dist: azpaddypy>=0.3.5
44
44
  Dynamic: license-file
45
45
 
46
46
  # paddypy
@@ -49,7 +49,6 @@ cwyodmodules/batch/utilities/helpers/env_helper.py
49
49
  cwyodmodules/batch/utilities/helpers/lightrag_helper.py
50
50
  cwyodmodules/batch/utilities/helpers/llm_helper.py
51
51
  cwyodmodules/batch/utilities/helpers/orchestrator_helper.py
52
- cwyodmodules/batch/utilities/helpers/secret_helper.py
53
52
  cwyodmodules/batch/utilities/helpers/config/agent_mode.py
54
53
  cwyodmodules/batch/utilities/helpers/config/assistant_strategy.py
55
54
  cwyodmodules/batch/utilities/helpers/config/config_helper.py
@@ -31,4 +31,4 @@ azure-search-documents==11.6.0b4
31
31
  semantic-kernel==1.3.0
32
32
  pydantic==2.7.4
33
33
  pandas>=2.2.3
34
- azpaddypy>=0.3.4
34
+ azpaddypy>=0.3.5
@@ -3,7 +3,7 @@ name = "cwyodmodules"
3
3
  authors = [
4
4
  { name="Patrik", email="patrikhartl@gmail.com" },
5
5
  ]
6
- version = '0.3.46'
6
+ version = '0.3.47'
7
7
  description = "Add your description here"
8
8
  readme = "README.md"
9
9
  requires-python = "==3.11.11"
@@ -44,7 +44,7 @@ dependencies = [
44
44
  "semantic-kernel==1.3.0",
45
45
  "pydantic==2.7.4",
46
46
  "pandas>=2.2.3",
47
- "azpaddypy>=0.3.4",
47
+ "azpaddypy>=0.3.5",
48
48
  ]
49
49
  [tool.setuptools.package-data]
50
50
  '*' = ['*.json','*.txt']
@@ -1,79 +0,0 @@
1
- from azure.keyvault.secrets import SecretClient
2
- from mgmt_config import logger, identity
3
-
4
-
5
- class SecretHelper:
6
- def __init__(self, keyvault_uri) -> None:
7
- """
8
- Initializes an instance of the SecretHelper class.
9
-
10
- The constructor sets the USE_KEY_VAULT attribute based on the value of the USE_KEY_VAULT environment variable.
11
- If USE_KEY_VAULT is set to "true" (case-insensitive), it initializes a SecretClient object using the
12
- AZURE_KEY_VAULT_ENDPOINT environment variable and the DefaultAzureCredential.
13
-
14
- Args:
15
- None
16
-
17
- Returns:
18
- None
19
- """
20
- self.USE_KEY_VAULT = True
21
- self.secret_client = None
22
- if self.USE_KEY_VAULT:
23
- credential = identity.get_credential()
24
- self.secret_client = SecretClient(
25
- vault_url=keyvault_uri,
26
- credential=credential,
27
- connection_verify=True,
28
- )
29
-
30
- @logger.trace_function(log_execution=True, log_args=False, log_result=False)
31
- def get_secret(self, secret_name: str) -> str:
32
- """
33
- Retrieves the value of a secret from the environment variables or Azure Key Vault.
34
-
35
- Args:
36
- secret_name (str): The name of the secret or "".
37
-
38
- Returns:
39
- str: The value of the secret.
40
-
41
- Raises:
42
- None
43
-
44
- """
45
- secret_value = self.secret_client.get_secret(name=secret_name).value
46
- return secret_value
47
-
48
- @logger.trace_function(log_execution=True, log_args=False, log_result=False)
49
- def set_secret(self, secret_name: str, secret_value: str) -> None:
50
- """
51
- Sets the value of a secret in Azure Key Vault only if it doesn't exist or has a different value.
52
-
53
- Args:
54
- secret_name (str): The name of the secret.
55
- secret_value (str): The value to be stored.
56
-
57
- Returns:
58
- None
59
-
60
- Raises:
61
- None
62
- """
63
- try:
64
- current_secret = self.secret_client.get_secret(name=secret_name)
65
- if current_secret.value != secret_value:
66
- self.secret_client.set_secret(name=secret_name, value=secret_value)
67
- else:
68
- logger.warning(
69
- f"Secret {secret_name} already has the same value, skipping update"
70
- )
71
- except Exception:
72
- self.secret_client.set_secret(name=secret_name, value=secret_value)
73
- logger.warning(f"Secret {secret_name} has been created")
74
-
75
-
76
- @logger.trace_function(log_execution=True, log_args=False, log_result=False)
77
- def get_secret_from_json(self, secret_name: str) -> str:
78
- secret_value = self.secret_client.get_secret(secret_name).value
79
- return secret_value
File without changes
File without changes
File without changes