quantalogic 0.35.0__py3-none-any.whl → 0.40.0__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.
Files changed (107) hide show
  1. quantalogic/__init__.py +0 -4
  2. quantalogic/agent.py +603 -363
  3. quantalogic/agent_config.py +233 -46
  4. quantalogic/agent_factory.py +34 -22
  5. quantalogic/coding_agent.py +16 -14
  6. quantalogic/config.py +2 -1
  7. quantalogic/console_print_events.py +4 -8
  8. quantalogic/console_print_token.py +2 -2
  9. quantalogic/docs_cli.py +15 -10
  10. quantalogic/event_emitter.py +258 -83
  11. quantalogic/flow/__init__.py +23 -0
  12. quantalogic/flow/flow.py +595 -0
  13. quantalogic/flow/flow_extractor.py +672 -0
  14. quantalogic/flow/flow_generator.py +89 -0
  15. quantalogic/flow/flow_manager.py +407 -0
  16. quantalogic/flow/flow_manager_schema.py +169 -0
  17. quantalogic/flow/flow_yaml.md +419 -0
  18. quantalogic/generative_model.py +109 -77
  19. quantalogic/get_model_info.py +5 -5
  20. quantalogic/interactive_text_editor.py +100 -73
  21. quantalogic/main.py +17 -21
  22. quantalogic/model_info_list.py +3 -3
  23. quantalogic/model_info_litellm.py +14 -14
  24. quantalogic/prompts.py +2 -1
  25. quantalogic/{llm.py → quantlitellm.py} +29 -39
  26. quantalogic/search_agent.py +4 -4
  27. quantalogic/server/models.py +4 -1
  28. quantalogic/task_file_reader.py +5 -5
  29. quantalogic/task_runner.py +20 -20
  30. quantalogic/tool_manager.py +10 -21
  31. quantalogic/tools/__init__.py +98 -68
  32. quantalogic/tools/composio/composio.py +416 -0
  33. quantalogic/tools/{generate_database_report_tool.py → database/generate_database_report_tool.py} +4 -9
  34. quantalogic/tools/database/sql_query_tool_advanced.py +261 -0
  35. quantalogic/tools/document_tools/markdown_to_docx_tool.py +620 -0
  36. quantalogic/tools/document_tools/markdown_to_epub_tool.py +438 -0
  37. quantalogic/tools/document_tools/markdown_to_html_tool.py +362 -0
  38. quantalogic/tools/document_tools/markdown_to_ipynb_tool.py +319 -0
  39. quantalogic/tools/document_tools/markdown_to_latex_tool.py +420 -0
  40. quantalogic/tools/document_tools/markdown_to_pdf_tool.py +623 -0
  41. quantalogic/tools/document_tools/markdown_to_pptx_tool.py +319 -0
  42. quantalogic/tools/duckduckgo_search_tool.py +2 -4
  43. quantalogic/tools/finance/alpha_vantage_tool.py +440 -0
  44. quantalogic/tools/finance/ccxt_tool.py +373 -0
  45. quantalogic/tools/finance/finance_llm_tool.py +387 -0
  46. quantalogic/tools/finance/google_finance.py +192 -0
  47. quantalogic/tools/finance/market_intelligence_tool.py +520 -0
  48. quantalogic/tools/finance/technical_analysis_tool.py +491 -0
  49. quantalogic/tools/finance/tradingview_tool.py +336 -0
  50. quantalogic/tools/finance/yahoo_finance.py +236 -0
  51. quantalogic/tools/git/bitbucket_clone_repo_tool.py +181 -0
  52. quantalogic/tools/git/bitbucket_operations_tool.py +326 -0
  53. quantalogic/tools/git/clone_repo_tool.py +189 -0
  54. quantalogic/tools/git/git_operations_tool.py +532 -0
  55. quantalogic/tools/google_packages/google_news_tool.py +480 -0
  56. quantalogic/tools/grep_app_tool.py +123 -186
  57. quantalogic/tools/{dalle_e.py → image_generation/dalle_e.py} +37 -27
  58. quantalogic/tools/jinja_tool.py +6 -10
  59. quantalogic/tools/language_handlers/__init__.py +22 -9
  60. quantalogic/tools/list_directory_tool.py +131 -42
  61. quantalogic/tools/llm_tool.py +45 -15
  62. quantalogic/tools/llm_vision_tool.py +59 -7
  63. quantalogic/tools/markitdown_tool.py +17 -5
  64. quantalogic/tools/nasa_packages/models.py +47 -0
  65. quantalogic/tools/nasa_packages/nasa_apod_tool.py +232 -0
  66. quantalogic/tools/nasa_packages/nasa_neows_tool.py +147 -0
  67. quantalogic/tools/nasa_packages/services.py +82 -0
  68. quantalogic/tools/presentation_tools/presentation_llm_tool.py +396 -0
  69. quantalogic/tools/product_hunt/product_hunt_tool.py +258 -0
  70. quantalogic/tools/product_hunt/services.py +63 -0
  71. quantalogic/tools/rag_tool/__init__.py +48 -0
  72. quantalogic/tools/rag_tool/document_metadata.py +15 -0
  73. quantalogic/tools/rag_tool/query_response.py +20 -0
  74. quantalogic/tools/rag_tool/rag_tool.py +566 -0
  75. quantalogic/tools/rag_tool/rag_tool_beta.py +264 -0
  76. quantalogic/tools/read_html_tool.py +24 -38
  77. quantalogic/tools/replace_in_file_tool.py +10 -10
  78. quantalogic/tools/safe_python_interpreter_tool.py +10 -24
  79. quantalogic/tools/search_definition_names.py +2 -2
  80. quantalogic/tools/sequence_tool.py +14 -23
  81. quantalogic/tools/sql_query_tool.py +17 -19
  82. quantalogic/tools/tool.py +39 -15
  83. quantalogic/tools/unified_diff_tool.py +1 -1
  84. quantalogic/tools/utilities/csv_processor_tool.py +234 -0
  85. quantalogic/tools/utilities/download_file_tool.py +179 -0
  86. quantalogic/tools/utilities/mermaid_validator_tool.py +661 -0
  87. quantalogic/tools/utils/__init__.py +1 -4
  88. quantalogic/tools/utils/create_sample_database.py +24 -38
  89. quantalogic/tools/utils/generate_database_report.py +74 -82
  90. quantalogic/tools/wikipedia_search_tool.py +17 -21
  91. quantalogic/utils/ask_user_validation.py +1 -1
  92. quantalogic/utils/async_utils.py +35 -0
  93. quantalogic/utils/check_version.py +3 -5
  94. quantalogic/utils/get_all_models.py +2 -1
  95. quantalogic/utils/git_ls.py +21 -7
  96. quantalogic/utils/lm_studio_model_info.py +9 -7
  97. quantalogic/utils/python_interpreter.py +113 -43
  98. quantalogic/utils/xml_utility.py +178 -0
  99. quantalogic/version_check.py +1 -1
  100. quantalogic/welcome_message.py +7 -7
  101. quantalogic/xml_parser.py +0 -1
  102. {quantalogic-0.35.0.dist-info → quantalogic-0.40.0.dist-info}/METADATA +41 -1
  103. quantalogic-0.40.0.dist-info/RECORD +148 -0
  104. quantalogic-0.35.0.dist-info/RECORD +0 -102
  105. {quantalogic-0.35.0.dist-info → quantalogic-0.40.0.dist-info}/LICENSE +0 -0
  106. {quantalogic-0.35.0.dist-info → quantalogic-0.40.0.dist-info}/WHEEL +0 -0
  107. {quantalogic-0.35.0.dist-info → quantalogic-0.40.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,63 @@
1
+ """Product Hunt API services.
2
+
3
+ This module provides service functions for interacting with the Product Hunt GraphQL API.
4
+ """
5
+
6
+ import os
7
+ from typing import Any, Dict
8
+
9
+ import requests
10
+ from loguru import logger
11
+
12
+
13
+ class ProductHuntService:
14
+ """Service class for Product Hunt API interactions."""
15
+
16
+ def __init__(self):
17
+ """Initialize the Product Hunt API service."""
18
+ self.api_key = os.getenv("PRODUCT_HUNT_API_KEY")
19
+ self.api_secret = os.getenv("PRODUCT_HUNT_API_SECRET")
20
+ self.bearer_token = os.getenv("PRODUCT_HUNT_BEARER_TOKEN")
21
+ self.base_url = "https://api.producthunt.com/v2/api/graphql"
22
+
23
+ if not self.bearer_token:
24
+ raise ValueError("PRODUCT_HUNT_BEARER_TOKEN environment variable is required")
25
+
26
+ def execute_query(self, query: str, variables: Dict[str, Any] | None = None) -> Dict[str, Any]:
27
+ """Execute a GraphQL query against the Product Hunt API.
28
+
29
+ Args:
30
+ query: The GraphQL query string
31
+ variables: Optional variables for the GraphQL query
32
+
33
+ Returns:
34
+ The API response data
35
+
36
+ Raises:
37
+ RuntimeError: If the API request fails
38
+ """
39
+ headers = {
40
+ "Accept": "application/json",
41
+ "Content-Type": "application/json",
42
+ "Authorization": f"Bearer {self.bearer_token}",
43
+ "X-Product-Hunt-Api-Key": self.api_key,
44
+ "User-Agent": "QuantaLogic/1.0"
45
+ }
46
+ try:
47
+ response = requests.post(
48
+ self.base_url,
49
+ json={"query": query, "variables": variables or {}},
50
+ headers=headers
51
+ )
52
+
53
+ if response.status_code == 200:
54
+ data = response.json()
55
+ if "errors" in data:
56
+ raise RuntimeError(f"GraphQL query failed: {data['errors']}")
57
+ return data
58
+ else:
59
+ raise RuntimeError(f"API request failed with status {response.status_code}: {response.text}")
60
+
61
+ except Exception as e:
62
+ logger.error(f"Failed to execute Product Hunt API query: {str(e)}")
63
+ raise RuntimeError(f"Failed to execute Product Hunt API query: {str(e)}")
@@ -0,0 +1,48 @@
1
+ """RAG Tool and related components."""
2
+
3
+ import importlib
4
+ import sys
5
+ from typing import Any
6
+
7
+
8
+ class LazyLoader:
9
+ """
10
+ Lazily import a module only when its attributes are accessed.
11
+ This helps reduce startup time by deferring imports until needed.
12
+ """
13
+ def __init__(self, module_path: str):
14
+ self.module_path = module_path
15
+ self._module = None
16
+
17
+ def __getattr__(self, name: str) -> Any:
18
+ if self._module is None:
19
+ self._module = importlib.import_module(self.module_path)
20
+ return getattr(self._module, name)
21
+
22
+
23
+ # Map of class names to their import paths
24
+ _IMPORTS = {
25
+ "DocumentMetadata": ".document_metadata",
26
+ "QueryResponse": ".query_response",
27
+ "RagTool": ".rag_tool"
28
+ }
29
+
30
+ # Create lazy loaders for each module
31
+ _lazy_modules = {}
32
+ for cls_name, path in _IMPORTS.items():
33
+ full_path = f"{__package__}{path}"
34
+ if (full_path not in _lazy_modules):
35
+ _lazy_modules[full_path] = LazyLoader(full_path)
36
+
37
+ # Map each class to its lazy module
38
+ _class_to_lazy_module = {}
39
+ for cls_name, path in _IMPORTS.items():
40
+ full_path = f"{__package__}{path}"
41
+ _class_to_lazy_module[cls_name] = _lazy_modules[full_path]
42
+
43
+ # Define __all__ so that import * works properly
44
+ __all__ = list(_IMPORTS.keys())
45
+
46
+ # Set up lazy loading for each class
47
+ for cls_name, lazy_module in _class_to_lazy_module.items():
48
+ setattr(sys.modules[__name__], cls_name, getattr(lazy_module, cls_name))
@@ -0,0 +1,15 @@
1
+ from datetime import datetime
2
+ from typing import Any, Dict
3
+
4
+ from pydantic import BaseModel, Field
5
+
6
+
7
+ class DocumentMetadata(BaseModel):
8
+ """Metadata for indexed documents."""
9
+ source_path: str
10
+ file_type: str
11
+ creation_date: datetime
12
+ last_modified: datetime
13
+ chunk_size: int
14
+ overlap: int
15
+ custom_metadata: Dict[str, Any] = Field(default_factory=dict)
@@ -0,0 +1,20 @@
1
+ from typing import Any, Dict, List
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class QueryResponse(BaseModel):
7
+ """Structured query response with source attribution."""
8
+ answer: str
9
+ sources: List[Dict[str, Any]]
10
+ relevance_scores: List[float]
11
+ total_chunks_searched: int
12
+ query_time_ms: float
13
+
14
+ def __len__(self) -> int:
15
+ """Support len() operation by returning length of the answer."""
16
+ return len(self.answer)
17
+
18
+ def __str__(self) -> str:
19
+ """String representation of the response."""
20
+ return self.answer