quantalogic 0.2.2__py3-none-any.whl → 0.2.3__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/main.py CHANGED
@@ -7,30 +7,37 @@ from typing import Optional
7
7
 
8
8
  # Third-party imports
9
9
  import click
10
- from rich.console import Console
11
- from rich.panel import Panel
12
- from rich.prompt import Confirm
10
+ from loguru import logger
13
11
 
14
- from quantalogic.agent import Agent
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
- "task_complete",
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
 
quantalogic/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  def get_version() -> str:
4
4
  return VERSION
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantalogic
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: QuantaLogic ReAct Agents
5
5
  Author: Raphaël MANSUY
6
6
  Author-email: raphael.mansuy@gmail.com
@@ -5,7 +5,7 @@ quantalogic/coding_agent.py,sha256=ivHBn3hIDEt9V1LDXI4l-COeGXYVp_v_rrx9ng8sP2A,3
5
5
  quantalogic/event_emitter.py,sha256=jqot2g4JRXc88K6PW837Oqxbf7shZfO-xdPaUWmzupk,7901
6
6
  quantalogic/generative_model.py,sha256=JkZz7YBd-v9n5EURidKUddkCLNvNZaqMzo5PgE_ugmc,8398
7
7
  quantalogic/interactive_text_editor.py,sha256=kYeTA2qej5kxtPvAUHy_Dr2MhrGQAyenLFpW9mU9Rmw,6855
8
- quantalogic/main.py,sha256=lN2lOQeZSIFBZOkgJ8CmHA_TWrGj6OM_dB8OqNrIkhY,6317
8
+ quantalogic/main.py,sha256=PvSf_V-BSQpFSCKSgDIB6DaUCab8ECDd0QWgnWbw0Js,7564
9
9
  quantalogic/memory.py,sha256=zbtRuM05jaS2lJll-92dt5JfYVLERnF_m_9xqp2x-k0,6304
10
10
  quantalogic/model_names.py,sha256=UZlz25zG9B2dpfwdw_e1Gw5qFsKQ7iME9FJh9Ts4u6s,938
11
11
  quantalogic/print_event.py,sha256=-4qZmFI2BTkXuGE9DoKm6Vs-GzK1F9WJGt9GqpRQlQQ,2175
@@ -59,11 +59,11 @@ quantalogic/utils/get_quantalogic_rules_content.py,sha256=fnEFTyClXzpI0MLaM-gB9R
59
59
  quantalogic/utils/git_ls.py,sha256=_aXg2TwqYv9CoOrhQ1gqHCqu1j8wOVigQNWbGncSDlM,4361
60
60
  quantalogic/utils/read_file.py,sha256=tSRVHk8dIP4nNLL89v5kRki4hOTjVyjbmuEb2zwvwCY,2077
61
61
  quantalogic/utils/read_http_text_content.py,sha256=1nRLQ9DHP_fKrm0rIEJBF0ROmB78e4lct2hUzD2PAUk,4408
62
- quantalogic/version.py,sha256=KCMp_VO1Gh1okgz_ysyGPoR0Sw0FpFSFimW1hvAms6s,64
62
+ quantalogic/version.py,sha256=drydBT0J_qpHkpmCE8_x46mY98FpK0zY8R1huMWdpA4,64
63
63
  quantalogic/xml_parser.py,sha256=cTRorr5sVfkIzH72M0C-GQ9ROGPiz2FTT66U9ndjzhE,9538
64
64
  quantalogic/xml_tool_parser.py,sha256=lsVzClZBrZan7wjCuCKnGHWzksXI3VMy_vWthxu2_bo,3738
65
- quantalogic-0.2.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
66
- quantalogic-0.2.2.dist-info/METADATA,sha256=nK98IudCDiahREJnwwdiLI-B7flWMhYrpHtVTphpFYY,38601
67
- quantalogic-0.2.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
68
- quantalogic-0.2.2.dist-info/entry_points.txt,sha256=wgSq5SRU98yvlRHGEZD1Xn7sS5CSjH2RfUtTa6Qy28Q,52
69
- quantalogic-0.2.2.dist-info/RECORD,,
65
+ quantalogic-0.2.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
66
+ quantalogic-0.2.3.dist-info/METADATA,sha256=Vy2jq-b-nWZmFDYZFNjmemwaC9b2tEjKoftgCRV1H5k,38601
67
+ quantalogic-0.2.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
68
+ quantalogic-0.2.3.dist-info/entry_points.txt,sha256=wgSq5SRU98yvlRHGEZD1Xn7sS5CSjH2RfUtTa6Qy28Q,52
69
+ quantalogic-0.2.3.dist-info/RECORD,,