OpenRAG 0.3.1__tar.gz → 0.3.3__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 (152) hide show
  1. {openrag-0.3.1/src/openrag.egg-info → openrag-0.3.3}/PKG-INFO +4 -2
  2. {openrag-0.3.1 → openrag-0.3.3}/pyproject.toml +5 -3
  3. {openrag-0.3.1 → openrag-0.3.3}/src/api/search.py +3 -0
  4. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/search.py +4 -0
  5. {openrag-0.3.1 → openrag-0.3.3}/src/config/config_manager.py +4 -0
  6. {openrag-0.3.1 → openrag-0.3.3}/src/config/settings.py +2 -5
  7. {openrag-0.3.1 → openrag-0.3.3/src/openrag.egg-info}/PKG-INFO +4 -2
  8. {openrag-0.3.1 → openrag-0.3.3}/src/openrag.egg-info/requires.txt +3 -1
  9. {openrag-0.3.1 → openrag-0.3.3}/src/services/search_service.py +21 -2
  10. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/docker-compose.yml +0 -1
  11. {openrag-0.3.1 → openrag-0.3.3}/src/utils/opensearch_utils.py +41 -0
  12. {openrag-0.3.1 → openrag-0.3.3}/LICENSE +0 -0
  13. {openrag-0.3.1 → openrag-0.3.3}/MANIFEST.in +0 -0
  14. {openrag-0.3.1 → openrag-0.3.3}/README.md +0 -0
  15. {openrag-0.3.1 → openrag-0.3.3}/setup.cfg +0 -0
  16. {openrag-0.3.1 → openrag-0.3.3}/src/agent.py +0 -0
  17. {openrag-0.3.1 → openrag-0.3.3}/src/api/__init__.py +0 -0
  18. {openrag-0.3.1 → openrag-0.3.3}/src/api/auth.py +0 -0
  19. {openrag-0.3.1 → openrag-0.3.3}/src/api/chat.py +0 -0
  20. {openrag-0.3.1 → openrag-0.3.3}/src/api/connector_router.py +0 -0
  21. {openrag-0.3.1 → openrag-0.3.3}/src/api/connectors.py +0 -0
  22. {openrag-0.3.1 → openrag-0.3.3}/src/api/docling.py +0 -0
  23. {openrag-0.3.1 → openrag-0.3.3}/src/api/documents.py +0 -0
  24. {openrag-0.3.1 → openrag-0.3.3}/src/api/flows.py +0 -0
  25. {openrag-0.3.1 → openrag-0.3.3}/src/api/keys.py +0 -0
  26. {openrag-0.3.1 → openrag-0.3.3}/src/api/knowledge_filter.py +0 -0
  27. {openrag-0.3.1 → openrag-0.3.3}/src/api/langflow_files.py +0 -0
  28. {openrag-0.3.1 → openrag-0.3.3}/src/api/models.py +0 -0
  29. {openrag-0.3.1 → openrag-0.3.3}/src/api/nudges.py +0 -0
  30. {openrag-0.3.1 → openrag-0.3.3}/src/api/oidc.py +0 -0
  31. {openrag-0.3.1 → openrag-0.3.3}/src/api/provider_health.py +0 -0
  32. {openrag-0.3.1 → openrag-0.3.3}/src/api/provider_validation.py +0 -0
  33. {openrag-0.3.1 → openrag-0.3.3}/src/api/router.py +0 -0
  34. {openrag-0.3.1 → openrag-0.3.3}/src/api/settings.py +0 -0
  35. {openrag-0.3.1 → openrag-0.3.3}/src/api/tasks.py +0 -0
  36. {openrag-0.3.1 → openrag-0.3.3}/src/api/upload.py +0 -0
  37. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/__init__.py +0 -0
  38. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/chat.py +0 -0
  39. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/documents.py +0 -0
  40. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/knowledge_filters.py +0 -0
  41. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/models.py +0 -0
  42. {openrag-0.3.1 → openrag-0.3.3}/src/api/v1/settings.py +0 -0
  43. {openrag-0.3.1 → openrag-0.3.3}/src/auth_context.py +0 -0
  44. {openrag-0.3.1 → openrag-0.3.3}/src/config/__init__.py +0 -0
  45. {openrag-0.3.1 → openrag-0.3.3}/src/config/model_constants.py +0 -0
  46. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/__init__.py +0 -0
  47. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/base.py +0 -0
  48. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/connection_manager.py +0 -0
  49. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/google_drive/__init__.py +0 -0
  50. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/google_drive/connector.py +0 -0
  51. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/google_drive/oauth.py +0 -0
  52. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/langflow_connector_service.py +0 -0
  53. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/onedrive/__init__.py +0 -0
  54. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/onedrive/connector.py +0 -0
  55. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/onedrive/oauth.py +0 -0
  56. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/service.py +0 -0
  57. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/sharepoint/__init__.py +0 -0
  58. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/sharepoint/connector.py +0 -0
  59. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/sharepoint/oauth.py +0 -0
  60. {openrag-0.3.1 → openrag-0.3.3}/src/connectors/sharepoint/utils.py +0 -0
  61. {openrag-0.3.1 → openrag-0.3.3}/src/dependencies.py +0 -0
  62. {openrag-0.3.1 → openrag-0.3.3}/src/main.py +0 -0
  63. {openrag-0.3.1 → openrag-0.3.3}/src/models/__init__.py +0 -0
  64. {openrag-0.3.1 → openrag-0.3.3}/src/models/processors.py +0 -0
  65. {openrag-0.3.1 → openrag-0.3.3}/src/models/tasks.py +0 -0
  66. {openrag-0.3.1 → openrag-0.3.3}/src/models/url.py +0 -0
  67. {openrag-0.3.1 → openrag-0.3.3}/src/openrag.egg-info/SOURCES.txt +0 -0
  68. {openrag-0.3.1 → openrag-0.3.3}/src/openrag.egg-info/dependency_links.txt +0 -0
  69. {openrag-0.3.1 → openrag-0.3.3}/src/openrag.egg-info/entry_points.txt +0 -0
  70. {openrag-0.3.1 → openrag-0.3.3}/src/openrag.egg-info/top_level.txt +0 -0
  71. {openrag-0.3.1 → openrag-0.3.3}/src/services/__init__.py +0 -0
  72. {openrag-0.3.1 → openrag-0.3.3}/src/services/api_key_service.py +0 -0
  73. {openrag-0.3.1 → openrag-0.3.3}/src/services/auth_service.py +0 -0
  74. {openrag-0.3.1 → openrag-0.3.3}/src/services/chat_service.py +0 -0
  75. {openrag-0.3.1 → openrag-0.3.3}/src/services/conversation_persistence_service.py +0 -0
  76. {openrag-0.3.1 → openrag-0.3.3}/src/services/document_service.py +0 -0
  77. {openrag-0.3.1 → openrag-0.3.3}/src/services/flows_service.py +0 -0
  78. {openrag-0.3.1 → openrag-0.3.3}/src/services/knowledge_filter_service.py +0 -0
  79. {openrag-0.3.1 → openrag-0.3.3}/src/services/langflow_file_service.py +0 -0
  80. {openrag-0.3.1 → openrag-0.3.3}/src/services/langflow_history_service.py +0 -0
  81. {openrag-0.3.1 → openrag-0.3.3}/src/services/langflow_mcp_service.py +0 -0
  82. {openrag-0.3.1 → openrag-0.3.3}/src/services/models_service.py +0 -0
  83. {openrag-0.3.1 → openrag-0.3.3}/src/services/monitor_service.py +0 -0
  84. {openrag-0.3.1 → openrag-0.3.3}/src/services/session_ownership_service.py +0 -0
  85. {openrag-0.3.1 → openrag-0.3.3}/src/services/task_service.py +0 -0
  86. {openrag-0.3.1 → openrag-0.3.3}/src/session_manager.py +0 -0
  87. {openrag-0.3.1 → openrag-0.3.3}/src/tui/__init__.py +0 -0
  88. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/docker-compose.gpu.yml +0 -0
  89. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/components/ollama_embedding.json +0 -0
  90. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/components/ollama_llm.json +0 -0
  91. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/components/ollama_llm_text.json +0 -0
  92. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/components/watsonx_embedding.json +0 -0
  93. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/components/watsonx_llm.json +0 -0
  94. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/components/watsonx_llm_text.json +0 -0
  95. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/ingestion_flow.json +0 -0
  96. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/openrag_agent.json +0 -0
  97. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/openrag_nudges.json +0 -0
  98. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/flows/openrag_url_mcp.json +0 -0
  99. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/openrag-documents/docling.pdf +0 -0
  100. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/openrag-documents/ibm_anthropic.pdf +0 -0
  101. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/openrag-documents/openrag-documentation.pdf +0 -0
  102. {openrag-0.3.1 → openrag-0.3.3}/src/tui/_assets/openrag-documents/warmup_ocr.pdf +0 -0
  103. {openrag-0.3.1 → openrag-0.3.3}/src/tui/cli.py +0 -0
  104. {openrag-0.3.1 → openrag-0.3.3}/src/tui/config_fields.py +0 -0
  105. {openrag-0.3.1 → openrag-0.3.3}/src/tui/main.py +0 -0
  106. {openrag-0.3.1 → openrag-0.3.3}/src/tui/managers/__init__.py +0 -0
  107. {openrag-0.3.1 → openrag-0.3.3}/src/tui/managers/container_manager.py +0 -0
  108. {openrag-0.3.1 → openrag-0.3.3}/src/tui/managers/docling_manager.py +0 -0
  109. {openrag-0.3.1 → openrag-0.3.3}/src/tui/managers/env_manager.py +0 -0
  110. {openrag-0.3.1 → openrag-0.3.3}/src/tui/screens/__init__.py +0 -0
  111. {openrag-0.3.1 → openrag-0.3.3}/src/tui/screens/config.py +0 -0
  112. {openrag-0.3.1 → openrag-0.3.3}/src/tui/screens/diagnostics.py +0 -0
  113. {openrag-0.3.1 → openrag-0.3.3}/src/tui/screens/logs.py +0 -0
  114. {openrag-0.3.1 → openrag-0.3.3}/src/tui/screens/monitor.py +0 -0
  115. {openrag-0.3.1 → openrag-0.3.3}/src/tui/screens/welcome.py +0 -0
  116. {openrag-0.3.1 → openrag-0.3.3}/src/tui/utils/__init__.py +0 -0
  117. {openrag-0.3.1 → openrag-0.3.3}/src/tui/utils/clipboard.py +0 -0
  118. {openrag-0.3.1 → openrag-0.3.3}/src/tui/utils/platform.py +0 -0
  119. {openrag-0.3.1 → openrag-0.3.3}/src/tui/utils/startup_checks.py +0 -0
  120. {openrag-0.3.1 → openrag-0.3.3}/src/tui/utils/validation.py +0 -0
  121. {openrag-0.3.1 → openrag-0.3.3}/src/tui/utils/version_check.py +0 -0
  122. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/__init__.py +0 -0
  123. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/command_modal.py +0 -0
  124. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/diagnostics_notification.py +0 -0
  125. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/error_notification.py +0 -0
  126. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/factory_reset_warning_modal.py +0 -0
  127. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/flow_backup_warning_modal.py +0 -0
  128. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/prune_options_modal.py +0 -0
  129. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/upgrade_instructions_modal.py +0 -0
  130. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/version_mismatch_warning_modal.py +0 -0
  131. {openrag-0.3.1 → openrag-0.3.3}/src/tui/widgets/waves.py +0 -0
  132. {openrag-0.3.1 → openrag-0.3.3}/src/utils/__init__.py +0 -0
  133. {openrag-0.3.1 → openrag-0.3.3}/src/utils/acl_utils.py +0 -0
  134. {openrag-0.3.1 → openrag-0.3.3}/src/utils/container_utils.py +0 -0
  135. {openrag-0.3.1 → openrag-0.3.3}/src/utils/docling_client.py +0 -0
  136. {openrag-0.3.1 → openrag-0.3.3}/src/utils/document_processing.py +0 -0
  137. {openrag-0.3.1 → openrag-0.3.3}/src/utils/embedding_fields.py +0 -0
  138. {openrag-0.3.1 → openrag-0.3.3}/src/utils/embeddings.py +0 -0
  139. {openrag-0.3.1 → openrag-0.3.3}/src/utils/env_utils.py +0 -0
  140. {openrag-0.3.1 → openrag-0.3.3}/src/utils/file_utils.py +0 -0
  141. {openrag-0.3.1 → openrag-0.3.3}/src/utils/gpu_detection.py +0 -0
  142. {openrag-0.3.1 → openrag-0.3.3}/src/utils/hash_utils.py +0 -0
  143. {openrag-0.3.1 → openrag-0.3.3}/src/utils/langflow_headers.py +0 -0
  144. {openrag-0.3.1 → openrag-0.3.3}/src/utils/langflow_utils.py +0 -0
  145. {openrag-0.3.1 → openrag-0.3.3}/src/utils/logging_config.py +0 -0
  146. {openrag-0.3.1 → openrag-0.3.3}/src/utils/opensearch_queries.py +0 -0
  147. {openrag-0.3.1 → openrag-0.3.3}/src/utils/paths.py +0 -0
  148. {openrag-0.3.1 → openrag-0.3.3}/src/utils/telemetry/__init__.py +0 -0
  149. {openrag-0.3.1 → openrag-0.3.3}/src/utils/telemetry/category.py +0 -0
  150. {openrag-0.3.1 → openrag-0.3.3}/src/utils/telemetry/client.py +0 -0
  151. {openrag-0.3.1 → openrag-0.3.3}/src/utils/telemetry/message_id.py +0 -0
  152. {openrag-0.3.1 → openrag-0.3.3}/src/utils/version_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openrag
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: OpenRAG is a comprehensive Retrieval-Augmented Generation platform that enables intelligent document search and AI-powered conversations.
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Environment :: Console
@@ -15,7 +15,6 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
15
  Requires-Python: >=3.13
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: agentd>=0.2.2
19
18
  Requires-Dist: aiofiles>=24.1.0
20
19
  Requires-Dist: cryptography>=45.0.6
21
20
  Requires-Dist: google-api-python-client>=2.143.0
@@ -36,6 +35,9 @@ Requires-Dist: python-dotenv>=1.0.0
36
35
  Requires-Dist: textual-fspicker>=0.6.0
37
36
  Requires-Dist: structlog>=25.4.0
38
37
  Requires-Dist: zxcvbn>=4.5.0
38
+ Requires-Dist: openai>=1.0.0
39
+ Requires-Dist: pyyaml>=6.0
40
+ Requires-Dist: tiktoken>=0.7.0
39
41
  Dynamic: license-file
40
42
 
41
43
  <div align="center">
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "openrag"
7
- version = "0.3.1"
7
+ version = "0.3.3"
8
8
  description = "OpenRAG is a comprehensive Retrieval-Augmented Generation platform that enables intelligent document search and AI-powered conversations."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -21,7 +21,6 @@ classifiers = [
21
21
  "Topic :: Software Development :: Libraries :: Python Modules",
22
22
  ]
23
23
  dependencies = [
24
- "agentd>=0.2.2",
25
24
  "aiofiles>=24.1.0",
26
25
  "cryptography>=45.0.6",
27
26
  "google-api-python-client>=2.143.0",
@@ -41,7 +40,10 @@ dependencies = [
41
40
  "python-dotenv>=1.0.0",
42
41
  "textual-fspicker>=0.6.0",
43
42
  "structlog>=25.4.0",
44
- "zxcvbn>=4.5.0"
43
+ "zxcvbn>=4.5.0",
44
+ "openai>=1.0.0",
45
+ "pyyaml>=6.0",
46
+ "tiktoken>=0.7.0"
45
47
  ]
46
48
 
47
49
  [dependency-groups]
@@ -4,6 +4,7 @@ from fastapi import Depends
4
4
  from pydantic import BaseModel, Field
5
5
  from fastapi.responses import JSONResponse
6
6
  from utils.logging_config import get_logger
7
+ from utils.opensearch_utils import OpenSearchDiskSpaceError, DISK_SPACE_ERROR_MESSAGE
7
8
 
8
9
  from dependencies import get_search_service, get_session_manager, get_current_user
9
10
  from session_manager import User
@@ -50,6 +51,8 @@ async def search(
50
51
  score_threshold=body.scoreThreshold,
51
52
  )
52
53
  return JSONResponse(result, status_code=200)
54
+ except OpenSearchDiskSpaceError:
55
+ return JSONResponse({"error": DISK_SPACE_ERROR_MESSAGE}, status_code=507)
53
56
  except Exception as e:
54
57
  error_msg = str(e)
55
58
  if (
@@ -10,6 +10,7 @@ from fastapi import Depends
10
10
  from pydantic import BaseModel
11
11
  from fastapi.responses import JSONResponse
12
12
  from utils.logging_config import get_logger
13
+ from utils.opensearch_utils import OpenSearchDiskSpaceError, DISK_SPACE_ERROR_MESSAGE
13
14
  from dependencies import get_search_service, get_api_key_user_async
14
15
  from session_manager import User
15
16
 
@@ -65,6 +66,9 @@ async def search_endpoint(
65
66
 
66
67
  return JSONResponse({"results": results})
67
68
 
69
+ except OpenSearchDiskSpaceError as e:
70
+ logger.error("Search blocked by disk space constraint", error=str(e), user_id=user.user_id)
71
+ return JSONResponse({"error": DISK_SPACE_ERROR_MESSAGE}, status_code=507)
68
72
  except Exception as e:
69
73
  error_msg = str(e)
70
74
  logger.error("Search failed", error=error_msg, user_id=user.user_id)
@@ -49,6 +49,10 @@ class ProvidersConfig:
49
49
  watsonx: WatsonXConfig
50
50
  ollama: OllamaConfig
51
51
 
52
+ def any_configured(self) -> bool:
53
+ """Return True if at least one provider is marked as configured."""
54
+ return any(p.configured for p in (self.openai, self.anthropic, self.watsonx, self.ollama))
55
+
52
56
  def get_provider_config(self, provider: str):
53
57
  """Get configuration for a specific provider."""
54
58
  provider_lower = provider.lower()
@@ -3,7 +3,6 @@ import os
3
3
  from utils.env_utils import get_env_int, get_env_float
4
4
 
5
5
  import httpx
6
- from agentd.patch import patch_openai_with_mcp
7
6
  from dotenv import load_dotenv
8
7
  from openai import AsyncOpenAI
9
8
  from opensearchpy import AsyncOpenSearch
@@ -535,16 +534,14 @@ class AppClients:
535
534
  use_http2 = future.result(timeout=15)
536
535
 
537
536
  if use_http2:
538
- self._patched_async_client = patch_openai_with_mcp(AsyncOpenAI())
537
+ self._patched_async_client = AsyncOpenAI()
539
538
  logger.info("OpenAI client initialized with HTTP/2")
540
539
  else:
541
540
  http_client = httpx.AsyncClient(
542
541
  http2=False,
543
542
  timeout=httpx.Timeout(60.0, connect=10.0)
544
543
  )
545
- self._patched_async_client = patch_openai_with_mcp(
546
- AsyncOpenAI(http_client=http_client)
547
- )
544
+ self._patched_async_client = AsyncOpenAI(http_client=http_client)
548
545
  logger.info("OpenAI client initialized with HTTP/1.1 (fallback)")
549
546
  logger.info("Successfully initialized OpenAI client")
550
547
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openrag
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: OpenRAG is a comprehensive Retrieval-Augmented Generation platform that enables intelligent document search and AI-powered conversations.
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Environment :: Console
@@ -15,7 +15,6 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
15
  Requires-Python: >=3.13
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: agentd>=0.2.2
19
18
  Requires-Dist: aiofiles>=24.1.0
20
19
  Requires-Dist: cryptography>=45.0.6
21
20
  Requires-Dist: google-api-python-client>=2.143.0
@@ -36,6 +35,9 @@ Requires-Dist: python-dotenv>=1.0.0
36
35
  Requires-Dist: textual-fspicker>=0.6.0
37
36
  Requires-Dist: structlog>=25.4.0
38
37
  Requires-Dist: zxcvbn>=4.5.0
38
+ Requires-Dist: openai>=1.0.0
39
+ Requires-Dist: pyyaml>=6.0
40
+ Requires-Dist: tiktoken>=0.7.0
39
41
  Dynamic: license-file
40
42
 
41
43
  <div align="center">
@@ -1,4 +1,3 @@
1
- agentd>=0.2.2
2
1
  aiofiles>=24.1.0
3
2
  cryptography>=45.0.6
4
3
  google-api-python-client>=2.143.0
@@ -19,3 +18,6 @@ python-dotenv>=1.0.0
19
18
  textual-fspicker>=0.6.0
20
19
  structlog>=25.4.0
21
20
  zxcvbn>=4.5.0
21
+ openai>=1.0.0
22
+ pyyaml>=6.0
23
+ tiktoken>=0.7.0
@@ -1,7 +1,6 @@
1
1
  import copy
2
2
  import json
3
3
  from typing import Any, Dict
4
- from agentd.tool_decorator import tool
5
4
  from config.settings import EMBED_MODEL, clients, get_embedding_model, get_index_name, WATSONX_EMBEDDING_DIMENSIONS
6
5
  from auth_context import get_auth_context
7
6
  from utils.logging_config import get_logger
@@ -17,7 +16,6 @@ class SearchService:
17
16
  def __init__(self, session_manager=None):
18
17
  self.session_manager = session_manager
19
18
 
20
- @tool
21
19
  async def search_tool(self, query: str, embedding_model: str = None) -> Dict[str, Any]:
22
20
  """
23
21
  Use this tool to search for documents relevant to the query.
@@ -392,6 +390,7 @@ class SearchService:
392
390
  )
393
391
 
394
392
  from opensearchpy.exceptions import RequestError
393
+ from utils.opensearch_utils import OpenSearchDiskSpaceError, is_disk_space_error, DISK_SPACE_ERROR_MESSAGE
395
394
 
396
395
  search_params = {"terminate_after": 0}
397
396
 
@@ -403,6 +402,12 @@ class SearchService:
403
402
  )
404
403
  except RequestError as e:
405
404
  error_message = str(e)
405
+ if is_disk_space_error(e):
406
+ logger.error(
407
+ "OpenSearch query blocked by disk space constraint",
408
+ error=error_message,
409
+ )
410
+ raise OpenSearchDiskSpaceError(DISK_SPACE_ERROR_MESSAGE) from e
406
411
  if (
407
412
  fallback_search_body is not None
408
413
  and "unknown field [num_candidates]" in error_message.lower()
@@ -417,6 +422,12 @@ class SearchService:
417
422
  params=search_params,
418
423
  )
419
424
  except RequestError as retry_error:
425
+ if is_disk_space_error(retry_error):
426
+ logger.error(
427
+ "OpenSearch retry blocked by disk space constraint",
428
+ error=str(retry_error),
429
+ )
430
+ raise OpenSearchDiskSpaceError(DISK_SPACE_ERROR_MESSAGE) from retry_error
420
431
  logger.error(
421
432
  "OpenSearch retry without num_candidates failed",
422
433
  error=str(retry_error),
@@ -428,7 +439,15 @@ class SearchService:
428
439
  "OpenSearch query failed", error=error_message, search_body=search_body
429
440
  )
430
441
  raise
442
+ except OpenSearchDiskSpaceError:
443
+ raise
431
444
  except Exception as e:
445
+ if is_disk_space_error(e):
446
+ logger.error(
447
+ "OpenSearch query blocked by disk space constraint",
448
+ error=str(e),
449
+ )
450
+ raise OpenSearchDiskSpaceError(DISK_SPACE_ERROR_MESSAGE) from e
432
451
  logger.error(
433
452
  "OpenSearch query failed", error=str(e), search_body=search_body
434
453
  )
@@ -49,7 +49,6 @@ services:
49
49
  context: .
50
50
  dockerfile: Dockerfile.backend
51
51
  container_name: openrag-backend
52
- user: "${OPENRAG_UID:-103000}:${OPENRAG_GID:-103000}"
53
52
  depends_on:
54
53
  - langflow
55
54
  environment:
@@ -5,9 +5,50 @@ from utils.logging_config import get_logger
5
5
 
6
6
  logger = get_logger(__name__)
7
7
 
8
+ DISK_SPACE_ERROR_MESSAGE = (
9
+ "OpenSearch has run out of available disk space. "
10
+ "Search and indexing operations are blocked. "
11
+ "Please free up disk space to restore OpenRAG functionality."
12
+ )
13
+
14
+ # Error strings emitted by OpenSearch when disk watermark thresholds are breached
15
+ _DISK_SPACE_INDICATORS = [
16
+ "disk watermark",
17
+ "flood_stage",
18
+ "flood stage",
19
+ "disk usage exceeded",
20
+ "index read-only",
21
+ "no space left on device",
22
+ "cluster_block_exception",
23
+ "forbidden/12",
24
+ "too_many_requests/12",
25
+ ]
26
+
27
+
8
28
  class OpenSearchNotReadyError(Exception):
9
29
  """Raised when OpenSearch fails to become ready within the retry limit."""
10
30
 
31
+
32
+ class OpenSearchDiskSpaceError(Exception):
33
+ """Raised when OpenSearch operations fail due to insufficient disk space."""
34
+
35
+
36
+ def is_disk_space_error(error: Exception) -> bool:
37
+ """Check whether an exception is caused by OpenSearch disk space constraints.
38
+
39
+ OpenSearch blocks write and search operations when disk usage crosses
40
+ the high-watermark or flood-stage watermark thresholds.
41
+ This function detects those error signatures.
42
+
43
+ Args:
44
+ error: The exception to inspect.
45
+
46
+ Returns:
47
+ True if the error is disk-space related, False otherwise.
48
+ """
49
+ error_str = str(error).lower()
50
+ return any(indicator in error_str for indicator in _DISK_SPACE_INDICATORS)
51
+
11
52
  async def wait_for_opensearch(
12
53
  opensearch_client: AsyncOpenSearch,
13
54
  max_retries: int = 15,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes