cwyodmodules 0.3.30__py3-none-any.whl → 0.3.32__py3-none-any.whl
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.
- cwyodmodules/batch/utilities/helpers/azure_identity_helper.py +3 -34
- cwyodmodules/batch/utilities/helpers/env_helper.py +1 -1
- cwyodmodules/batch/utilities/plugins/outlook_calendar_plugin.py +4 -4
- {cwyodmodules-0.3.30.dist-info → cwyodmodules-0.3.32.dist-info}/METADATA +1 -1
- {cwyodmodules-0.3.30.dist-info → cwyodmodules-0.3.32.dist-info}/RECORD +8 -8
- {cwyodmodules-0.3.30.dist-info → cwyodmodules-0.3.32.dist-info}/WHEEL +0 -0
- {cwyodmodules-0.3.30.dist-info → cwyodmodules-0.3.32.dist-info}/licenses/LICENSE +0 -0
- {cwyodmodules-0.3.30.dist-info → cwyodmodules-0.3.32.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,4 @@
|
|
1
|
-
import os
|
2
1
|
from azure.identity import (
|
3
|
-
ChainedTokenCredential,
|
4
|
-
ManagedIdentityCredential,
|
5
|
-
EnvironmentCredential,
|
6
2
|
TokenCachePersistenceOptions,
|
7
3
|
get_bearer_token_provider,
|
8
4
|
DefaultAzureCredential
|
@@ -14,6 +10,7 @@ from opentelemetry.propagate import extract
|
|
14
10
|
|
15
11
|
logger = getLogger("__main__")
|
16
12
|
tracer = trace.get_tracer("__main__")
|
13
|
+
|
17
14
|
class AzureIdentityHelper:
|
18
15
|
"""
|
19
16
|
A helper class to provide a chained Azure token credential.
|
@@ -21,40 +18,12 @@ class AzureIdentityHelper:
|
|
21
18
|
Token caching is configured for in-memory persistence.
|
22
19
|
"""
|
23
20
|
def __init__(self):
|
24
|
-
# Configure in-memory token cache persistence
|
25
|
-
# For in-memory, unencrypted storage is typically allowed for simplicity during development.
|
26
|
-
# In production, especially with shared environments, consider the security implications.
|
27
|
-
client_secret_available = os.getenv("AZURE_CLIENT_SECRET") is not None
|
28
21
|
|
29
|
-
token_cache_options = TokenCachePersistenceOptions(allow_unencrypted_storage=True)
|
22
|
+
token_cache_options = TokenCachePersistenceOptions(allow_unencrypted_storage=True)
|
30
23
|
|
31
|
-
|
32
|
-
managed_identity_credential = ManagedIdentityCredential(
|
33
|
-
token_cache_persistence_options=token_cache_options
|
34
|
-
)
|
35
|
-
environment_credential = EnvironmentCredential(
|
24
|
+
self._credential = DefaultAzureCredential(
|
36
25
|
token_cache_persistence_options=token_cache_options
|
37
26
|
)
|
38
|
-
|
39
|
-
|
40
|
-
# Create a chain of credentials
|
41
|
-
# The chain will try credentials in the order they are provided.
|
42
|
-
if client_secret_available:
|
43
|
-
logger.info("Using Environment Credential first with token cache persistence.")
|
44
|
-
self._credential = ChainedTokenCredential(
|
45
|
-
environment_credential,
|
46
|
-
managed_identity_credential
|
47
|
-
)
|
48
|
-
else:
|
49
|
-
logger.info("Using Managed Identity Credential first with token cache persistence.")
|
50
|
-
# self._credential = ChainedTokenCredential(
|
51
|
-
|
52
|
-
# managed_identity_credential,
|
53
|
-
# environment_credential
|
54
|
-
# )
|
55
|
-
self._credential = DefaultAzureCredential(
|
56
|
-
token_cache_persistence_options=token_cache_options
|
57
|
-
)
|
58
27
|
|
59
28
|
def get_credential(self):
|
60
29
|
"""
|
@@ -164,7 +164,7 @@ class EnvHelper:
|
|
164
164
|
self.AZURE_OPENAI_VISION_MODEL = "gpt-4"
|
165
165
|
self.AZURE_OPENAI_TEMPERATURE = "0"
|
166
166
|
self.AZURE_OPENAI_TOP_P = "1.0"
|
167
|
-
self.AZURE_OPENAI_MAX_TOKENS = "
|
167
|
+
self.AZURE_OPENAI_MAX_TOKENS = "1500"
|
168
168
|
self.AZURE_OPENAI_STOP_SEQUENCE = ""
|
169
169
|
self.AZURE_OPENAI_SYSTEM_MESSAGE = (
|
170
170
|
"You are an AI assistant that helps people find information."
|
@@ -49,12 +49,12 @@ class OutlookCalendarPlugin:
|
|
49
49
|
end = (datetime.datetime.utcnow() + datetime.timedelta(days=days)).isoformat() + "Z"
|
50
50
|
url = f"https://graph.microsoft.com/v1.0/me/calendarview?startDateTime={now}&endDateTime={end}"
|
51
51
|
resp = requests.get(url, headers=headers)
|
52
|
-
logger.info("Calendar get results: %s", resp.text[0:
|
52
|
+
logger.info("Calendar get results: %s", resp.text[0:120])
|
53
53
|
if resp.status_code != 200:
|
54
54
|
answer = TextProcessingTool().answer_question(
|
55
55
|
question=self.question,
|
56
56
|
chat_history=self.chat_history,
|
57
|
-
text=f"Failed to fetch events: {resp.text[0:
|
57
|
+
text=f"Failed to fetch events: {resp.text[0:120]}",
|
58
58
|
operation=f"Explain the user in his language {language} that you failed to fetch calendar events due to an error.",
|
59
59
|
)
|
60
60
|
return answer
|
@@ -102,7 +102,7 @@ class OutlookCalendarPlugin:
|
|
102
102
|
"end": {"dateTime": end_time, "timeZone": "UTC"},
|
103
103
|
}
|
104
104
|
resp = requests.post(url, headers=headers, json=event)
|
105
|
-
logger.info("Calendar set results: %s", resp.text[0:
|
105
|
+
logger.info("Calendar set results: %s", resp.text[0:120])
|
106
106
|
if resp.status_code == 201:
|
107
107
|
answer = TextProcessingTool().answer_question(
|
108
108
|
question=self.question,
|
@@ -115,7 +115,7 @@ class OutlookCalendarPlugin:
|
|
115
115
|
answer = TextProcessingTool().answer_question(
|
116
116
|
question=self.question,
|
117
117
|
chat_history=self.chat_history,
|
118
|
-
text=f"Failed to schedule appointment: {resp.text[0:
|
118
|
+
text=f"Failed to schedule appointment: {resp.text[0:120]}",
|
119
119
|
operation=f"Explain to the user in his language {language} that the appointment scheduling failed.",
|
120
120
|
)
|
121
121
|
return answer
|
@@ -30,13 +30,13 @@ cwyodmodules/batch/utilities/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
30
30
|
cwyodmodules/batch/utilities/helpers/azure_blob_storage_client.py,sha256=FN2XnEThmtbWnwSi1sEfgekuPH7aJBOAU5n2DBmQ9ww,10315
|
31
31
|
cwyodmodules/batch/utilities/helpers/azure_computer_vision_client.py,sha256=5qhxriTEaKkRc8K4E9oKQjCOzV_JSkad37z1FskCpOg,3661
|
32
32
|
cwyodmodules/batch/utilities/helpers/azure_form_recognizer_helper.py,sha256=kN9pjanKj_IsGM0XQA8QwICuLaB0yBdtRMINmhSD_mU,6699
|
33
|
-
cwyodmodules/batch/utilities/helpers/azure_identity_helper.py,sha256=
|
33
|
+
cwyodmodules/batch/utilities/helpers/azure_identity_helper.py,sha256=aiYZH4F9aZBd5DDRuVvIn6jiIDgC0i-R-1-NqHqosnI,1806
|
34
34
|
cwyodmodules/batch/utilities/helpers/azure_postgres_helper.py,sha256=RV2jcqFuTofbz1gk8CDYdECPgl_ypH3K84Yeu3kjU7o,10823
|
35
35
|
cwyodmodules/batch/utilities/helpers/azure_postgres_helper_light_rag.py,sha256=DLgJ7KNK71qSUlRHTWgRgp6-4ufnC8frL_pOWE-oKgM,10915
|
36
36
|
cwyodmodules/batch/utilities/helpers/azure_search_helper.py,sha256=GniJ8JhRTBdzI1kN0yHtyR8ocZBav5C635uFfD1eHrc,10473
|
37
37
|
cwyodmodules/batch/utilities/helpers/document_chunking_helper.py,sha256=2MZOjW-fHXgYijP3m9O-nizOlk96Yg0axyxT0K6fTnM,725
|
38
38
|
cwyodmodules/batch/utilities/helpers/document_loading_helper.py,sha256=2HBEl3vW-_PKbX5pPntTC_R5eToTk2Qb-q3M4Mt6hCU,603
|
39
|
-
cwyodmodules/batch/utilities/helpers/env_helper.py,sha256=
|
39
|
+
cwyodmodules/batch/utilities/helpers/env_helper.py,sha256=Pl4vCi_t7FfpCV0lDjB8WUNDSu80afji-zhuaJCXJ8s,15893
|
40
40
|
cwyodmodules/batch/utilities/helpers/lightrag_helper.py,sha256=qk20zoqq42owNR97_aKjIYw4I4pcQcTHNeAvOexbtyc,3436
|
41
41
|
cwyodmodules/batch/utilities/helpers/llm_helper.py,sha256=o2lwUqiwydFi-owflnK8zbTVJGkHYPiH_pF-vI7kTYU,7474
|
42
42
|
cwyodmodules/batch/utilities/helpers/orchestrator_helper.py,sha256=mCcZyMFG0otnw9gzWd-PYocHmDdFDVg-RT9oDPiDZPk,897
|
@@ -71,7 +71,7 @@ cwyodmodules/batch/utilities/parser/__init__.py,sha256=ZGBxm1TX6cQAnFkMtKN6C2Fwn
|
|
71
71
|
cwyodmodules/batch/utilities/parser/output_parser_tool.py,sha256=ARKwshTeZlUlnWYreaUOVol6q9L1MAKKCT8CO5OKxTw,5831
|
72
72
|
cwyodmodules/batch/utilities/parser/parser_base.py,sha256=ZCYZEoa7-gGhoO_oMfeGCldR4OIuShf7U5lA0BuwNSY,419
|
73
73
|
cwyodmodules/batch/utilities/plugins/chat_plugin.py,sha256=-YcUzWhh8fTh44TI3lKEOQEN-8y-_pUrp-j1vikDxEk,2935
|
74
|
-
cwyodmodules/batch/utilities/plugins/outlook_calendar_plugin.py,sha256=
|
74
|
+
cwyodmodules/batch/utilities/plugins/outlook_calendar_plugin.py,sha256=3hkssbIBQK4hHZx0Pepgg5LjmBK-8VkTjHaYRMvK2D4,6646
|
75
75
|
cwyodmodules/batch/utilities/plugins/post_answering_plugin.py,sha256=U1zzf_ztxzl4y-9Qah_n7ylHDZfnDSp2ork5ctdkA5I,1117
|
76
76
|
cwyodmodules/batch/utilities/search/azure_search_handler.py,sha256=E1cPCPWVytvB5jhMkT6H-j1vfxIgLZw3h8nt0dHVTsQ,6863
|
77
77
|
cwyodmodules/batch/utilities/search/azure_search_handler_light_rag.py,sha256=fO61WaqZRRsOcjhzWeHBLrKIbigqzw_R28L95tvDxsM,2913
|
@@ -108,8 +108,8 @@ cwyodmodules/graphrag/query/generate.py,sha256=xBnZs2U9xFWtPk4AfAZgYKbHdcxNcIO6Q
|
|
108
108
|
cwyodmodules/graphrag/query/graph_search.py,sha256=95h3ecSWx4864XgKABtG0fh3Nk8HkqJVzoCrO8daJ-Y,7724
|
109
109
|
cwyodmodules/graphrag/query/types.py,sha256=1Iq1dp4I4a56_cuFjOZ0NTgd0A2_MpVFznp_czgt6cI,617
|
110
110
|
cwyodmodules/graphrag/query/vector_search.py,sha256=9Gwu9LPjtoAYUU8WKqCvbCHAIg3dpk71reoYd1scLnQ,1807
|
111
|
-
cwyodmodules-0.3.
|
112
|
-
cwyodmodules-0.3.
|
113
|
-
cwyodmodules-0.3.
|
114
|
-
cwyodmodules-0.3.
|
115
|
-
cwyodmodules-0.3.
|
111
|
+
cwyodmodules-0.3.32.dist-info/licenses/LICENSE,sha256=UqBDTipijsSW2ZSOXyTZnMsXmLoEHTgNEM0tL4g-Sso,1150
|
112
|
+
cwyodmodules-0.3.32.dist-info/METADATA,sha256=3q9b9xT2oTfuaNwVlF9KFffml5vpTTBDoDF4MWDLVvE,1969
|
113
|
+
cwyodmodules-0.3.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
114
|
+
cwyodmodules-0.3.32.dist-info/top_level.txt,sha256=99RENLbkdRX-qpJvsxZ5AfmTL5s6shSaKOWYpz1vwzg,13
|
115
|
+
cwyodmodules-0.3.32.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|