quantalogic 0.2.2__tar.gz → 0.2.4__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.
- {quantalogic-0.2.2 → quantalogic-0.2.4}/PKG-INFO +1 -1
- {quantalogic-0.2.2 → quantalogic-0.2.4}/pyproject.toml +1 -1
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/agent.py +7 -8
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/main.py +46 -20
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/version.py +1 -1
- {quantalogic-0.2.2 → quantalogic-0.2.4}/LICENSE +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/README.md +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/__init__.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/agent_config.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/coding_agent.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/event_emitter.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/generative_model.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/interactive_text_editor.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/memory.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/model_names.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/print_event.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/prompts.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/__init__.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/agent_server.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/models.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/routes.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/state.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/static/js/event_visualizer.js +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/static/js/quantalogic.js +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/server/templates/index.html +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tool_manager.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/__init__.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/agent_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/download_http_file_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/edit_whole_content_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/elixir_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/execute_bash_command_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/input_question_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/__init__.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/c_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/cpp_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/go_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/java_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/javascript_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/python_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/rust_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/scala_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/typescript_handler.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/list_directory_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/llm_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/markitdown_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/nodejs_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/python_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/read_file_block_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/read_file_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/replace_in_file_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/ripgrep_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/search_definition_names.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/task_complete_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/unified_diff_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/write_file_tool.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/__init__.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/ask_user_validation.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/download_http_file.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/get_coding_environment.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/get_environment.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/get_quantalogic_rules_content.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/git_ls.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/read_file.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/utils/read_http_text_content.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/xml_parser.py +0 -0
- {quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/xml_tool_parser.py +0 -0
@@ -21,12 +21,6 @@ from quantalogic.utils.ask_user_validation import console_ask_for_user_validatio
|
|
21
21
|
from quantalogic.xml_parser import ToleranceXMLParser
|
22
22
|
from quantalogic.xml_tool_parser import ToolParser
|
23
23
|
|
24
|
-
# Configure logger based on environment variable
|
25
|
-
log_level = os.getenv("LOG_LEVEL", "ERROR")
|
26
|
-
logger.remove()
|
27
|
-
logger.add(sys.stderr, level=log_level)
|
28
|
-
|
29
|
-
|
30
24
|
# Maximum ratio occupancy of the occupied memory
|
31
25
|
MAX_OCCUPANCY = 90.0
|
32
26
|
|
@@ -81,7 +75,7 @@ class Agent(BaseModel):
|
|
81
75
|
|
82
76
|
def __init__(
|
83
77
|
self,
|
84
|
-
model_name: str = "
|
78
|
+
model_name: str = "",
|
85
79
|
memory: AgentMemory = AgentMemory(),
|
86
80
|
tools: list[Tool] = [TaskCompleteTool()],
|
87
81
|
ask_for_user_validation: Callable[[str], bool] = console_ask_for_user_validation,
|
@@ -91,6 +85,7 @@ class Agent(BaseModel):
|
|
91
85
|
):
|
92
86
|
"""Initialize the agent with model, memory, tools, and configurations."""
|
93
87
|
try:
|
88
|
+
logger.debug("Initializing agent...")
|
94
89
|
# Add TaskCompleteTool to the tools list if not already present
|
95
90
|
if TaskCompleteTool() not in tools:
|
96
91
|
tools.append(TaskCompleteTool())
|
@@ -119,7 +114,7 @@ class Agent(BaseModel):
|
|
119
114
|
task_to_solve=task_to_solve,
|
120
115
|
specific_expertise=specific_expertise,
|
121
116
|
)
|
122
|
-
logger.
|
117
|
+
logger.debug("Agent initialized successfully.")
|
123
118
|
except Exception as e:
|
124
119
|
logger.error(f"Failed to initialize agent: {str(e)}")
|
125
120
|
raise
|
@@ -135,6 +130,7 @@ class Agent(BaseModel):
|
|
135
130
|
Returns:
|
136
131
|
str: The final response after task completion.
|
137
132
|
"""
|
133
|
+
logger.debug(f"Solving task... {task}")
|
138
134
|
self._reset_session(task_to_solve=task, max_iterations=max_iterations)
|
139
135
|
|
140
136
|
# Add system prompt to memory
|
@@ -215,10 +211,13 @@ class Agent(BaseModel):
|
|
215
211
|
# Emit event: Task Solve End
|
216
212
|
self._emit_event("task_solve_end")
|
217
213
|
|
214
|
+
logger.debug(f"Task solved: {answer}")
|
215
|
+
|
218
216
|
return answer
|
219
217
|
|
220
218
|
def _reset_session(self, task_to_solve: str = "", max_iterations: int = 30):
|
221
219
|
"""Reset the agent's session."""
|
220
|
+
logger.debug("Resetting session...")
|
222
221
|
self.task_to_solve = task_to_solve
|
223
222
|
self.memory.reset()
|
224
223
|
self.variable_store.reset()
|
@@ -7,30 +7,37 @@ from typing import Optional
|
|
7
7
|
|
8
8
|
# Third-party imports
|
9
9
|
import click
|
10
|
-
from
|
11
|
-
from rich.panel import Panel
|
12
|
-
from rich.prompt import Confirm
|
10
|
+
from loguru import logger
|
13
11
|
|
14
|
-
|
12
|
+
# Configure logger
|
13
|
+
logger.remove() # Remove default logger
|
14
|
+
|
15
|
+
from rich.console import Console # noqa: E402
|
16
|
+
from rich.panel import Panel # noqa: E402
|
17
|
+
from rich.prompt import Confirm # noqa: E402
|
18
|
+
|
19
|
+
from quantalogic.agent import Agent # noqa: E402
|
15
20
|
|
16
21
|
# Local application imports
|
17
|
-
from quantalogic.agent_config import (
|
22
|
+
from quantalogic.agent_config import ( # noqa: E402
|
18
23
|
MODEL_NAME,
|
19
24
|
create_coding_agent,
|
20
25
|
create_full_agent,
|
21
26
|
create_interpreter_agent,
|
22
27
|
create_orchestrator_agent,
|
23
28
|
)
|
24
|
-
from quantalogic.interactive_text_editor import get_multiline_input
|
25
|
-
from quantalogic.print_event import console_print_events
|
26
|
-
from quantalogic.version import get_version
|
29
|
+
from quantalogic.interactive_text_editor import get_multiline_input # noqa: E402
|
30
|
+
from quantalogic.print_event import console_print_events # noqa: E402
|
31
|
+
from quantalogic.version import get_version # noqa: E402
|
27
32
|
|
28
33
|
AGENT_MODES = ["code", "basic", "interpreter", "full", "code-basic"]
|
29
34
|
|
30
35
|
|
31
36
|
def create_agent_for_mode(mode: str, model_name: str) -> Agent:
|
32
37
|
"""Create an agent based on the specified mode."""
|
38
|
+
logger.debug(f"Creating agent for mode: {mode} with model: {model_name}")
|
33
39
|
if mode == "code":
|
40
|
+
logger.debug("Creating code agent without basic mode")
|
34
41
|
return create_coding_agent(model_name, basic=False)
|
35
42
|
if mode == "code-basic":
|
36
43
|
return create_coding_agent(model_name, basic=True)
|
@@ -47,6 +54,13 @@ def create_agent_for_mode(mode: str, model_name: str) -> Agent:
|
|
47
54
|
def switch_verbose(verbose_mode: bool) -> None:
|
48
55
|
import litellm
|
49
56
|
|
57
|
+
if verbose_mode:
|
58
|
+
logger.add(sys.stderr, level="DEBUG", format="{time} | {level} | {message}")
|
59
|
+
logger.info("Verbose mode enabled.")
|
60
|
+
else:
|
61
|
+
logger.info("Verbose mode disabled.")
|
62
|
+
logger.remove()
|
63
|
+
|
50
64
|
litellm.set_verbose = verbose_mode
|
51
65
|
|
52
66
|
|
@@ -123,8 +137,11 @@ def task(file: Optional[str], model_name: str, verbose: bool, mode: str, task: O
|
|
123
137
|
task_content = task
|
124
138
|
else:
|
125
139
|
display_welcome_message(console, model_name)
|
140
|
+
logger.info("Waiting for user input...")
|
126
141
|
task_content = get_multiline_input(console).strip()
|
142
|
+
logger.info(f"User input received. Task content: {task_content}")
|
127
143
|
if not task_content:
|
144
|
+
logger.info("No task provided. Exiting...")
|
128
145
|
console.print("[yellow]No task provided. Exiting...[/yellow]")
|
129
146
|
sys.exit(2)
|
130
147
|
|
@@ -140,23 +157,31 @@ def task(file: Optional[str], model_name: str, verbose: bool, mode: str, task: O
|
|
140
157
|
console.print("[yellow]Task submission cancelled. Exiting...[/yellow]")
|
141
158
|
sys.exit(0)
|
142
159
|
|
160
|
+
logger.debug(f"Creating agent for mode: {mode} with model: {model_name}")
|
143
161
|
agent = create_agent_for_mode(mode, model_name)
|
162
|
+
logger.debug(f"Created agent for mode: {mode} with model: {model_name}")
|
163
|
+
|
164
|
+
events = [
|
165
|
+
"task_start",
|
166
|
+
"task_think_start",
|
167
|
+
"task_think_end",
|
168
|
+
"task_complete",
|
169
|
+
"tool_execution_start",
|
170
|
+
"tool_execution_end",
|
171
|
+
"error_max_iterations_reached",
|
172
|
+
"memory_full",
|
173
|
+
"memory_compacted",
|
174
|
+
"memory_summary",
|
175
|
+
]
|
144
176
|
agent.event_emitter.on(
|
145
|
-
|
146
|
-
|
147
|
-
"task_think_start",
|
148
|
-
"task_think_end",
|
149
|
-
"tool_execution_start",
|
150
|
-
"tool_execution_end",
|
151
|
-
"error_max_iterations_reached",
|
152
|
-
"memory_full",
|
153
|
-
"memory_compacted",
|
154
|
-
"memory_summary",
|
155
|
-
],
|
156
|
-
console_print_events,
|
177
|
+
event=events,
|
178
|
+
listener=console_print_events,
|
157
179
|
)
|
180
|
+
logger.debug("Registered event handlers for agent events with events: {events}")
|
158
181
|
|
182
|
+
logger.debug(f"Solving task with agent: {task_content}")
|
159
183
|
result = agent.solve_task(task=task_content, max_iterations=300)
|
184
|
+
logger.debug(f"Task solved with result: {result}")
|
160
185
|
|
161
186
|
console.print(
|
162
187
|
Panel.fit(
|
@@ -166,6 +191,7 @@ def task(file: Optional[str], model_name: str, verbose: bool, mode: str, task: O
|
|
166
191
|
|
167
192
|
except Exception as e:
|
168
193
|
console.print(f"[red]{str(e)}[/red]")
|
194
|
+
logger.error(f"Error in task execution: {e}", exc_info=True)
|
169
195
|
sys.exit(1)
|
170
196
|
|
171
197
|
|
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
|
{quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/javascript_handler.py
RENAMED
File without changes
|
{quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/python_handler.py
RENAMED
File without changes
|
File without changes
|
{quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/scala_handler.py
RENAMED
File without changes
|
{quantalogic-0.2.2 → quantalogic-0.2.4}/quantalogic/tools/language_handlers/typescript_handler.py
RENAMED
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
|