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
@@ -29,7 +29,7 @@ def git_ls(
29
29
 
30
30
  # Expand paths and get absolute path
31
31
  path = Path(os.path.expanduser(directory_path)).absolute()
32
-
32
+
33
33
  # Verify access to base directory
34
34
  if not os.access(path, os.R_OK):
35
35
  return f"==== Error: No read access to directory {path} ====\n==== End of Block ===="
@@ -70,10 +70,10 @@ def generate_file_tree(
70
70
  ) -> Dict:
71
71
  """Generate file tree structure."""
72
72
  if current_depth > max_depth:
73
- return {}
73
+ return None
74
74
 
75
75
  if ignore_spec.match_file(path) or path.name == ".git":
76
- return {}
76
+ return None
77
77
 
78
78
  if path.is_file():
79
79
  try:
@@ -95,16 +95,18 @@ def generate_file_tree(
95
95
  except (PermissionError, OSError):
96
96
  tree["children"].append({"name": "no access", "type": "error"})
97
97
  return tree
98
+
98
99
  for child in children:
99
100
  if not ignore_spec.match_file(child):
100
101
  if child.is_file():
101
102
  child_tree = generate_file_tree(child, ignore_spec, recursive, max_depth, current_depth)
102
- tree["children"].append(child_tree)
103
+ if child_tree: # Only append if not None
104
+ tree["children"].append(child_tree)
103
105
  elif child.is_dir():
104
106
  # Always include directories
105
107
  child_tree = generate_file_tree(child, ignore_spec, recursive, max_depth, current_depth + 1)
106
108
  if recursive:
107
- if child_tree:
109
+ if child_tree: # Only append if not None
108
110
  tree["children"].append(child_tree)
109
111
  else:
110
112
  tree["children"].append({"name": child.name, "type": "directory", "children": []})
@@ -114,9 +116,16 @@ def generate_file_tree(
114
116
 
115
117
  def format_tree(tree: Dict, start: int, end: int) -> str:
116
118
  """Format tree structure into string output with line information."""
119
+ if not tree: # Handle empty or None tree
120
+ return "==== No files to display ===="
121
+
117
122
  lines = []
118
123
  _format_tree_recursive(tree, lines, 0)
119
124
  total_lines = len(lines)
125
+
126
+ if total_lines == 0: # Handle case with no valid lines
127
+ return "==== No files to display ===="
128
+
120
129
  is_last_block = end >= total_lines
121
130
  output = "\n".join(lines[start - 1 : end])
122
131
 
@@ -129,13 +138,18 @@ def format_tree(tree: Dict, start: int, end: int) -> str:
129
138
 
130
139
  def _format_tree_recursive(node: Dict, lines: List[str], depth: int):
131
140
  """Recursively format tree nodes."""
141
+ if not node or "type" not in node: # Skip invalid nodes
142
+ return
143
+
132
144
  indent = " " * depth
133
145
  if node["type"] == "file":
134
146
  lines.append(f"{indent}📄 {node['name']} ({node['size']})")
135
- else:
147
+ elif node["type"] == "directory":
136
148
  lines.append(f"{indent}📁 {node['name']}/")
137
- for child in node["children"]:
149
+ for child in node.get("children", []):
138
150
  _format_tree_recursive(child, lines, depth + 1)
151
+ elif node["type"] == "error":
152
+ lines.append(f"{indent}❌ {node['name']}")
139
153
 
140
154
 
141
155
  if __name__ == "__main__":
@@ -9,14 +9,17 @@ class ModelType(str, Enum):
9
9
  EMBEDDINGS = "embeddings"
10
10
  VLM = "vlm"
11
11
 
12
+
12
13
  class CompatibilityType(str, Enum):
13
14
  MLX = "mlx"
14
15
  GGUF = "gguf"
15
16
 
17
+
16
18
  class ModelState(str, Enum):
17
19
  LOADED = "loaded"
18
20
  NOT_LOADED = "not-loaded"
19
21
 
22
+
20
23
  class ModelInfo(BaseModel):
21
24
  id: str = Field(..., description="Unique model identifier in LM Studio's namespace")
22
25
  object: Literal["model"] = Field("model", description="Always 'model' for model objects")
@@ -28,21 +31,20 @@ class ModelInfo(BaseModel):
28
31
  state: ModelState = Field(..., description="Current loading state in LM Studio")
29
32
  max_context_length: int = Field(..., alias="max_context_length", ge=0)
30
33
  loaded_context_length: Optional[int] = Field(
31
- None,
32
- alias="loaded_context_length",
33
- description="Currently allocated context length (only when loaded)",
34
- ge=0
34
+ None, alias="loaded_context_length", description="Currently allocated context length (only when loaded)", ge=0
35
35
  )
36
36
 
37
+
37
38
  class ModelListResponse(BaseModel):
38
39
  data: List[ModelInfo] = Field(..., description="List of available models")
39
40
  object: Literal["list"] = Field("list", description="Always 'list' for list responses")
40
41
 
42
+
41
43
  def get_model_list() -> ModelListResponse:
42
44
  """Fetch and validate model information from LM Studio's API"""
43
45
  import requests
44
-
46
+
45
47
  response = requests.get("http://localhost:1234/api/v0/models")
46
48
  response.raise_for_status()
47
-
48
- return ModelListResponse(**response.json())
49
+
50
+ return ModelListResponse(**response.json())