cwyodmodules 0.3.24__tar.gz → 0.3.26__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 (120) hide show
  1. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/PKG-INFO +1 -1
  2. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/chat_history/postgresdbservice.py +2 -4
  3. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_computer_vision_client.py +2 -2
  4. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_identity_helper.py +10 -2
  5. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_postgres_helper.py +3 -6
  6. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_postgres_helper_light_rag.py +3 -6
  7. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/env_helper.py +4 -3
  8. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/lightrag_helper.py +4 -7
  9. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/question_answer_tool.py +5 -1
  10. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules.egg-info/PKG-INFO +1 -1
  11. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/pyproject.toml +1 -1
  12. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/LICENSE +0 -0
  13. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/README.md +0 -0
  14. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/api/__init__.py +0 -0
  15. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/api/chat_history.py +0 -0
  16. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/__init__.py +0 -0
  17. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/__init__.py +0 -0
  18. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/chat_history/auth_utils.py +0 -0
  19. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/chat_history/cosmosdb.py +0 -0
  20. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/chat_history/database_client_base.py +0 -0
  21. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/chat_history/database_factory.py +0 -0
  22. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/chat_history/sample_user.py +0 -0
  23. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/common/__init__.py +0 -0
  24. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/common/answer.py +0 -0
  25. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/common/source_document.py +0 -0
  26. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/__init__.py +0 -0
  27. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/chunking_strategy.py +0 -0
  28. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/document_chunking_base.py +0 -0
  29. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/fixed_size_overlap.py +0 -0
  30. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/layout.py +0 -0
  31. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/page.py +0 -0
  32. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/paragraph.py +0 -0
  33. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_chunking/strategies.py +0 -0
  34. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/__init__.py +0 -0
  35. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/document_loading_base.py +0 -0
  36. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/layout.py +0 -0
  37. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/read.py +0 -0
  38. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/strategies.py +0 -0
  39. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/web.py +0 -0
  40. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/document_loading/word_document.py +0 -0
  41. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/__init__.py +0 -0
  42. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_blob_storage_client.py +0 -0
  43. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_form_recognizer_helper.py +0 -0
  44. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/azure_search_helper.py +0 -0
  45. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/assistant_strategy.py +0 -0
  46. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/config_helper.py +0 -0
  47. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/conversation_flow.py +0 -0
  48. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/database_type.py +0 -0
  49. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/default.json +0 -0
  50. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/default_contract_assistant_prompt.txt +0 -0
  51. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/default_employee_assistant_prompt.txt +0 -0
  52. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/config/embedding_config.py +0 -0
  53. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/document_chunking_helper.py +0 -0
  54. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/document_loading_helper.py +0 -0
  55. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/embedders/embedder_base.py +0 -0
  56. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/embedders/embedder_factory.py +0 -0
  57. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py +0 -0
  58. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/embedders/postgres_embedder.py +0 -0
  59. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/embedders/push_embedder.py +0 -0
  60. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/llm_helper.py +0 -0
  61. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/orchestrator_helper.py +0 -0
  62. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/helpers/secret_helper.py +0 -0
  63. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_datasource.py +0 -0
  64. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_index.py +0 -0
  65. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_indexer.py +0 -0
  66. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/integrated_vectorization/azure_search_skillset.py +0 -0
  67. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/loggers/conversation_logger.py +0 -0
  68. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/__init__.py +0 -0
  69. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/lang_chain_agent.py +0 -0
  70. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/open_ai_functions.py +0 -0
  71. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/orchestration_strategy.py +0 -0
  72. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/orchestrator_base.py +0 -0
  73. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/prompt_flow.py +0 -0
  74. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/semantic_kernel_orchestrator.py +0 -0
  75. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/orchestrator/strategies.py +0 -0
  76. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/parser/__init__.py +0 -0
  77. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/parser/output_parser_tool.py +0 -0
  78. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/parser/parser_base.py +0 -0
  79. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/plugins/chat_plugin.py +0 -0
  80. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/plugins/outlook_calendar_plugin.py +0 -0
  81. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/plugins/post_answering_plugin.py +0 -0
  82. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/azure_search_handler.py +0 -0
  83. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/azure_search_handler_light_rag.py +0 -0
  84. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/integrated_vectorization_search_handler.py +0 -0
  85. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/lightrag_search_handler.py +0 -0
  86. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/postgres_search_handler.py +0 -0
  87. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/postgres_search_handler_light_rag.py +0 -0
  88. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/search.py +0 -0
  89. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/search/search_handler_base.py +0 -0
  90. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/__init__.py +0 -0
  91. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/answer_processing_base.py +0 -0
  92. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/answering_tool_base.py +0 -0
  93. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/content_safety_checker.py +0 -0
  94. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/post_prompt_tool.py +0 -0
  95. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/batch/utilities/tools/text_processing_tool.py +0 -0
  96. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/__init__.py +0 -0
  97. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/config.py +0 -0
  98. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/database/__init__.py +0 -0
  99. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/database/base.py +0 -0
  100. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/database/models.py +0 -0
  101. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/indexing/__init__.py +0 -0
  102. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/indexing/chunking.py +0 -0
  103. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/indexing/extraction.py +0 -0
  104. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/indexing/types.py +0 -0
  105. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/indexing/upsert.py +0 -0
  106. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/indexing/utils.py +0 -0
  107. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/llm/__init__.py +0 -0
  108. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/llm/llm.py +0 -0
  109. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/llm/prompt.py +0 -0
  110. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/main.py +0 -0
  111. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/query/__init__.py +0 -0
  112. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/query/generate.py +0 -0
  113. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/query/graph_search.py +0 -0
  114. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/query/types.py +0 -0
  115. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules/graphrag/query/vector_search.py +0 -0
  116. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules.egg-info/SOURCES.txt +0 -0
  117. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules.egg-info/dependency_links.txt +0 -0
  118. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules.egg-info/requires.txt +0 -0
  119. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/cwyodmodules.egg-info/top_level.txt +0 -0
  120. {cwyodmodules-0.3.24 → cwyodmodules-0.3.26}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.24
3
+ Version: 0.3.26
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -28,10 +28,8 @@ class PostgresConversationClient(DatabaseClientBase):
28
28
  async def connect(self):
29
29
  with tracer.start_as_current_span("PostgresConversationClient.connect"):
30
30
  try:
31
- credential = self.azure_identity_helper.get_credential()
32
- token = credential.get_token(
33
- "https://ossrdbms-aad.database.windows.net/.default"
34
- ).token
31
+ access_information = self.azure_identity_helper.get_token(scopes="https://ossrdbms-aad.database.windows.net/.default")
32
+ token = access_information.token
35
33
  self.conn = await asyncpg.connect(
36
34
  user=self.user,
37
35
  host=self.host,
@@ -56,8 +56,8 @@ class AzureComputerVisionClient:
56
56
  if self.use_keys:
57
57
  headers["Ocp-Apim-Subscription-Key"] = self.key
58
58
  else:
59
- token_provider = self.azure_identity_helper.get_token_provider(url=self.__TOKEN_SCOPE)
60
- headers["Authorization"] = "Bearer " + token_provider()
59
+ access_information = self.azure_identity_helper.get_token_provider(scopes=self.__TOKEN_SCOPE)
60
+ headers["Authorization"] = "Bearer " + access_information()
61
61
 
62
62
  return requests.post(
63
63
  url=urljoin(self.host, path),
@@ -47,13 +47,21 @@ class AzureIdentityHelper:
47
47
  logger.info("Retrieving ChainedTokenCredential.")
48
48
  return self._credential
49
49
 
50
- def get_token_provider(self, url):
50
+ def get_token(self, scopes):
51
51
  """
52
52
  Returns the configured ChainedTokenCredential.
53
53
  """
54
54
  with tracer.start_as_current_span("AzureIdentityHelper.get_token_provider"):
55
55
  logger.info("Retrieving ChainedTokenCredential provider.")
56
- return get_bearer_token_provider(self._credential, url=url)
56
+ return self._credential.get_token(scopes=scopes)
57
+
58
+ def get_token_provider(self, scopes):
59
+ """
60
+ Returns the configured ChainedTokenCredential.
61
+ """
62
+ with tracer.start_as_current_span("AzureIdentityHelper.get_token_provider"):
63
+ logger.info("Retrieving ChainedTokenCredential provider.")
64
+ return get_bearer_token_provider(self._credential, scopes=scopes)
57
65
 
58
66
 
59
67
  # Example usage (optional, for testing or demonstration):
@@ -25,14 +25,11 @@ class AzurePostgresHelper:
25
25
  dbname = self.env_helper.POSTGRESQL_DATABASE
26
26
 
27
27
  # Acquire the access token
28
- credential = self.azure_identity_helper.get_credential()
29
- access_token = credential.get_token(
30
- "https://ossrdbms-aad.database.windows.net/.default"
31
- )
32
-
28
+ access_information = self.azure_identity_helper.get_token(scopes="https://ossrdbms-aad.database.windows.net/.default")
29
+ token = access_information.token
33
30
  # Use the token in the connection string
34
31
  conn_string = (
35
- f"host={host} user={user} dbname={dbname} password={access_token.token}"
32
+ f"host={host} user={user} dbname={dbname} password={token}"
36
33
  )
37
34
  keepalive_kwargs = {
38
35
  "keepalives": 1,
@@ -27,14 +27,11 @@ class AzurePostgresHelper:
27
27
  dbname = self.env_helper.POSTGRESQL_DATABASE
28
28
 
29
29
  # Acquire the access token
30
- credential = self.azure_identity_helper.get_credential()
31
- access_token = credential.get_token(
32
- "https://ossrdbms-aad.database.windows.net/.default"
33
- )
34
-
30
+ access_information = self.azure_identity_helper.get_token(scopes="https://ossrdbms-aad.database.windows.net/.default")
31
+ token = access_information.token
35
32
  # Use the token in the connection string
36
33
  conn_string = (
37
- f"host={host} user={user} dbname={dbname} password={access_token.token}"
34
+ f"host={host} user={user} dbname={dbname} password={token}"
38
35
  )
39
36
  keepalive_kwargs = {
40
37
  "keepalives": 1,
@@ -36,7 +36,7 @@ class EnvHelper:
36
36
  # load_dotenv()
37
37
 
38
38
  logger.info("Initializing EnvHelper")
39
-
39
+
40
40
  # Wrapper for Azure Key Vault
41
41
  os.environ["APPLICATIONINSIGHTS_ENABLED"] = "true"
42
42
 
@@ -73,8 +73,9 @@ class EnvHelper:
73
73
  f"psql-main-{self.PROJECT_CODE}-{self.AZURE_RESOURCE_ENVIRONMENT}"
74
74
  )
75
75
  self.AZURE_AUTH_TYPE = "rbac"
76
- self.AZURE_TOKEN_PROVIDER = AzureIdentityHelper.get_token_provider(url="https://cognitiveservices.azure.com/.default"
77
- )
76
+ azure_identity_helper = AzureIdentityHelper()# Extract context from the incoming request
77
+ access_information = azure_identity_helper.get_token_provider(scopes="https://cognitiveservices.azure.com/.default")
78
+ self.AZURE_TOKEN_PROVIDER = access_information
78
79
  self.AZURE_BLOB_ACCOUNT_NAME = (
79
80
  f"stqueue{self.PROJECT_CODE}{self.AZURE_RESOURCE_ENVIRONMENT}"
80
81
  )
@@ -8,7 +8,7 @@ logger = logging.getLogger(__name__ + ".base_package")
8
8
  class LightRAGHelper:
9
9
  def __init__(self, env_helper):
10
10
  self.env_helper = env_helper
11
- azure_identity_helper = AzureIdentityHelper()
11
+ self.azure_identity_helper = AzureIdentityHelper()
12
12
  self.conn = None
13
13
 
14
14
  def _create_connection(self):
@@ -21,14 +21,11 @@ class LightRAGHelper:
21
21
  dbname = self.env_helper.POSTGRESQL_DATABASE
22
22
 
23
23
  # Acquire the access token
24
- credential = self.azure_identity_helper.get_credential()
25
- access_token = credential.get_token(
26
- "https://ossrdbms-aad.database.windows.net/.default"
27
- )
28
-
24
+ access_information = self.azure_identity_helper.get_token(scopes="https://ossrdbms-aad.database.windows.net/.default")
25
+ token = access_information.token
29
26
  # Use the token in the connection string
30
27
  conn_string = (
31
- f"host={host} user={user} dbname={dbname} password={access_token.token}"
28
+ f"host={host} user={user} dbname={dbname} password={token}"
32
29
  )
33
30
  keepalive_kwargs = {
34
31
  "keepalives": 1,
@@ -325,7 +325,11 @@ class QuestionAnswerTool(AnsweringToolBase):
325
325
  logger.debug(f"Answer format_answer_from_response: {answer}")
326
326
 
327
327
  # Append document citations to the answer
328
- citations = "".join([f"[doc{i+1}]" for i in range(len(source_documents))])
328
+ citations = "".join([
329
+ f"[doc{i+1}]"
330
+ for i in range(len(source_documents))
331
+ if f"[doc{i+1}]" not in answer
332
+ ])
329
333
  answer_with_citations = f"{answer} {citations}"
330
334
  # Generate Answer Object
331
335
  clean_answer = Answer(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.24
3
+ Version: 0.3.26
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -3,7 +3,7 @@ name = "cwyodmodules"
3
3
  authors = [
4
4
  { name="Patrik", email="patrikhartl@gmail.com" },
5
5
  ]
6
- version = '0.3.24'
6
+ version = '0.3.26'
7
7
  description = "Add your description here"
8
8
  readme = "README.md"
9
9
  requires-python = "==3.11.11"
File without changes
File without changes
File without changes