quantalogic 0.35.0__py3-none-any.whl → 0.50.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.
- quantalogic/__init__.py +0 -4
- quantalogic/agent.py +603 -363
- quantalogic/agent_config.py +233 -46
- quantalogic/agent_factory.py +34 -22
- quantalogic/coding_agent.py +16 -14
- quantalogic/config.py +2 -1
- quantalogic/console_print_events.py +4 -8
- quantalogic/console_print_token.py +2 -2
- quantalogic/docs_cli.py +15 -10
- quantalogic/event_emitter.py +258 -83
- quantalogic/flow/__init__.py +23 -0
- quantalogic/flow/flow.py +595 -0
- quantalogic/flow/flow_extractor.py +672 -0
- quantalogic/flow/flow_generator.py +89 -0
- quantalogic/flow/flow_manager.py +407 -0
- quantalogic/flow/flow_manager_schema.py +169 -0
- quantalogic/flow/flow_yaml.md +419 -0
- quantalogic/generative_model.py +109 -77
- quantalogic/get_model_info.py +5 -5
- quantalogic/interactive_text_editor.py +100 -73
- quantalogic/main.py +17 -21
- quantalogic/model_info_list.py +3 -3
- quantalogic/model_info_litellm.py +14 -14
- quantalogic/prompts.py +2 -1
- quantalogic/{llm.py → quantlitellm.py} +29 -39
- quantalogic/search_agent.py +4 -4
- quantalogic/server/models.py +4 -1
- quantalogic/task_file_reader.py +5 -5
- quantalogic/task_runner.py +20 -20
- quantalogic/tool_manager.py +10 -21
- quantalogic/tools/__init__.py +98 -68
- quantalogic/tools/composio/composio.py +416 -0
- quantalogic/tools/{generate_database_report_tool.py → database/generate_database_report_tool.py} +4 -9
- quantalogic/tools/database/sql_query_tool_advanced.py +261 -0
- quantalogic/tools/document_tools/markdown_to_docx_tool.py +620 -0
- quantalogic/tools/document_tools/markdown_to_epub_tool.py +438 -0
- quantalogic/tools/document_tools/markdown_to_html_tool.py +362 -0
- quantalogic/tools/document_tools/markdown_to_ipynb_tool.py +319 -0
- quantalogic/tools/document_tools/markdown_to_latex_tool.py +420 -0
- quantalogic/tools/document_tools/markdown_to_pdf_tool.py +623 -0
- quantalogic/tools/document_tools/markdown_to_pptx_tool.py +319 -0
- quantalogic/tools/duckduckgo_search_tool.py +2 -4
- quantalogic/tools/finance/alpha_vantage_tool.py +440 -0
- quantalogic/tools/finance/ccxt_tool.py +373 -0
- quantalogic/tools/finance/finance_llm_tool.py +387 -0
- quantalogic/tools/finance/google_finance.py +192 -0
- quantalogic/tools/finance/market_intelligence_tool.py +520 -0
- quantalogic/tools/finance/technical_analysis_tool.py +491 -0
- quantalogic/tools/finance/tradingview_tool.py +336 -0
- quantalogic/tools/finance/yahoo_finance.py +236 -0
- quantalogic/tools/git/bitbucket_clone_repo_tool.py +181 -0
- quantalogic/tools/git/bitbucket_operations_tool.py +326 -0
- quantalogic/tools/git/clone_repo_tool.py +189 -0
- quantalogic/tools/git/git_operations_tool.py +532 -0
- quantalogic/tools/google_packages/google_news_tool.py +480 -0
- quantalogic/tools/grep_app_tool.py +123 -186
- quantalogic/tools/{dalle_e.py → image_generation/dalle_e.py} +37 -27
- quantalogic/tools/jinja_tool.py +6 -10
- quantalogic/tools/language_handlers/__init__.py +22 -9
- quantalogic/tools/list_directory_tool.py +131 -42
- quantalogic/tools/llm_tool.py +45 -15
- quantalogic/tools/llm_vision_tool.py +59 -7
- quantalogic/tools/markitdown_tool.py +17 -5
- quantalogic/tools/nasa_packages/models.py +47 -0
- quantalogic/tools/nasa_packages/nasa_apod_tool.py +232 -0
- quantalogic/tools/nasa_packages/nasa_neows_tool.py +147 -0
- quantalogic/tools/nasa_packages/services.py +82 -0
- quantalogic/tools/presentation_tools/presentation_llm_tool.py +396 -0
- quantalogic/tools/product_hunt/product_hunt_tool.py +258 -0
- quantalogic/tools/product_hunt/services.py +63 -0
- quantalogic/tools/rag_tool/__init__.py +48 -0
- quantalogic/tools/rag_tool/document_metadata.py +15 -0
- quantalogic/tools/rag_tool/query_response.py +20 -0
- quantalogic/tools/rag_tool/rag_tool.py +566 -0
- quantalogic/tools/rag_tool/rag_tool_beta.py +264 -0
- quantalogic/tools/read_html_tool.py +24 -38
- quantalogic/tools/replace_in_file_tool.py +10 -10
- quantalogic/tools/safe_python_interpreter_tool.py +10 -24
- quantalogic/tools/search_definition_names.py +2 -2
- quantalogic/tools/sequence_tool.py +14 -23
- quantalogic/tools/sql_query_tool.py +17 -19
- quantalogic/tools/tool.py +39 -15
- quantalogic/tools/unified_diff_tool.py +1 -1
- quantalogic/tools/utilities/csv_processor_tool.py +234 -0
- quantalogic/tools/utilities/download_file_tool.py +179 -0
- quantalogic/tools/utilities/mermaid_validator_tool.py +661 -0
- quantalogic/tools/utils/__init__.py +1 -4
- quantalogic/tools/utils/create_sample_database.py +24 -38
- quantalogic/tools/utils/generate_database_report.py +74 -82
- quantalogic/tools/wikipedia_search_tool.py +17 -21
- quantalogic/utils/ask_user_validation.py +1 -1
- quantalogic/utils/async_utils.py +35 -0
- quantalogic/utils/check_version.py +3 -5
- quantalogic/utils/get_all_models.py +2 -1
- quantalogic/utils/git_ls.py +21 -7
- quantalogic/utils/lm_studio_model_info.py +9 -7
- quantalogic/utils/python_interpreter.py +113 -43
- quantalogic/utils/xml_utility.py +178 -0
- quantalogic/version_check.py +1 -1
- quantalogic/welcome_message.py +7 -7
- quantalogic/xml_parser.py +0 -1
- {quantalogic-0.35.0.dist-info → quantalogic-0.50.0.dist-info}/METADATA +40 -1
- quantalogic-0.50.0.dist-info/RECORD +148 -0
- quantalogic-0.35.0.dist-info/RECORD +0 -102
- {quantalogic-0.35.0.dist-info → quantalogic-0.50.0.dist-info}/LICENSE +0 -0
- {quantalogic-0.35.0.dist-info → quantalogic-0.50.0.dist-info}/WHEEL +0 -0
- {quantalogic-0.35.0.dist-info → quantalogic-0.50.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
|