quantalogic 0.31.0__py3-none-any.whl → 0.31.1__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 CHANGED
@@ -11,12 +11,12 @@ warnings.filterwarnings(
11
11
  )
12
12
 
13
13
  # Import public API
14
- from .llm import generate_completion, generate_image, count_tokens # noqa: E402
15
14
  from .agent import Agent # noqa: E402
16
- from .event_emitter import EventEmitter # noqa: E402
17
- from .memory import AgentMemory, VariableMemory # noqa: E402
18
15
  from .console_print_events import console_print_events # noqa: E402
19
16
  from .console_print_token import console_print_token # noqa: E402
17
+ from .event_emitter import EventEmitter # noqa: E402
18
+ from .llm import count_tokens, generate_completion, generate_image # noqa: E402
19
+ from .memory import AgentMemory, VariableMemory # noqa: E402
20
20
 
21
21
  __all__ = [
22
22
  "Agent",
quantalogic/agent.py CHANGED
@@ -412,6 +412,9 @@ class Agent(BaseModel):
412
412
 
413
413
  def _parse_tool_usage(self, content: str) -> dict:
414
414
  """Extract tool usage from the response content."""
415
+ if not content or not isinstance(content, str):
416
+ return {}
417
+
415
418
  xml_parser = ToleranceXMLParser()
416
419
  tool_names = self.tools.tool_names()
417
420
  return xml_parser.extract_elements(text=content, element_names=tool_names)
@@ -502,6 +505,7 @@ class Agent(BaseModel):
502
505
 
503
506
  # Format the response message
504
507
  formatted_response = (
508
+ f"Your next step: you Must now plan the next tool call to complete the based on this new observation\n"
505
509
  f"\n--- Observations for iteration {iteration} / max {self.max_iterations} ---\n"
506
510
  f"\n--- Tool execution result in ${variable_name}$ ---\n"
507
511
  f"<{variable_name}>\n{response_display}\n</{variable_name}>\n\n"
@@ -6,6 +6,8 @@ model_info = {
6
6
  "openrouter/deepseek/deepseek-r1": {"max_output_tokens": 8 * 1024, "max_input_tokens": 1024 * 128},
7
7
  "openrouter/mistralai/mistral-large-2411": {"max_output_tokens": 128 * 1024, "max_input_tokens": 1024 * 128},
8
8
  "mistralai/mistral-large-2411": {"max_output_tokens": 128 * 1024, "max_input_tokens": 1024 * 128},
9
+ "deepseek/deepseek-chat": {"max_output_tokens": 8* 1024, "max_input_tokens": 1024*64},
10
+ "deepseek/deepseek-reasoner": {"max_output_tokens": 8* 1024, "max_input_tokens": 1024*64, "max_cot_tokens": 1024*32 },
9
11
  }
10
12
 
11
13
 
@@ -11,7 +11,7 @@ from loguru import logger
11
11
 
12
12
  # Platform-specific imports
13
13
  try:
14
- if sys.platform != 'win32':
14
+ if sys.platform != "win32":
15
15
  import pty
16
16
  except ImportError as e:
17
17
  logger.warning(f"Could not import platform-specific module: {e}")
@@ -40,6 +40,7 @@ class ExecuteBashCommandTool(Tool):
40
40
  description="The working directory where the command will be executed. Defaults to the current directory.",
41
41
  required=False,
42
42
  example="/path/to/directory",
43
+ default=os.getcwd(),
43
44
  ),
44
45
  ToolArgument(
45
46
  name="timeout",
@@ -47,6 +48,7 @@ class ExecuteBashCommandTool(Tool):
47
48
  description="Maximum time in seconds to wait for the command to complete. Defaults to 60 seconds.",
48
49
  required=False,
49
50
  example="60",
51
+ default="60",
50
52
  ),
51
53
  ]
52
54
 
@@ -69,16 +71,16 @@ class ExecuteBashCommandTool(Tool):
69
71
  cwd=cwd,
70
72
  env=env_vars,
71
73
  text=True,
72
- encoding='utf-8'
74
+ encoding="utf-8",
73
75
  )
74
76
 
75
77
  try:
76
78
  stdout, stderr = process.communicate(timeout=timeout_seconds)
77
79
  return_code = process.returncode
78
-
80
+
79
81
  if return_code != 0 and stderr:
80
82
  logger.warning(f"Command failed with error: {stderr}")
81
-
83
+
82
84
  formatted_result = (
83
85
  "<command_output>"
84
86
  f" <stdout>{stdout.strip()}</stdout>"
@@ -86,11 +88,11 @@ class ExecuteBashCommandTool(Tool):
86
88
  f"</command_output>"
87
89
  )
88
90
  return formatted_result
89
-
91
+
90
92
  except subprocess.TimeoutExpired:
91
93
  process.kill()
92
94
  return f"Command timed out after {timeout_seconds} seconds."
93
-
95
+
94
96
  except Exception as e:
95
97
  return f"Unexpected error executing command: {str(e)}"
96
98
 
@@ -127,7 +129,7 @@ class ExecuteBashCommandTool(Tool):
127
129
  if proc.poll() is not None:
128
130
  break # Process completed but select timed out
129
131
  raise subprocess.TimeoutExpired(command, timeout_seconds)
130
-
132
+
131
133
  for fd in rlist:
132
134
  if fd == master:
133
135
  data = os.read(master, 1024).decode()
@@ -140,7 +142,7 @@ class ExecuteBashCommandTool(Tool):
140
142
  elif fd == sys.stdin:
141
143
  user_input = os.read(sys.stdin.fileno(), 1024)
142
144
  os.write(master, user_input)
143
-
145
+
144
146
  if break_loop or proc.poll() is not None:
145
147
  while True:
146
148
  data = os.read(master, 1024).decode()
@@ -160,7 +162,7 @@ class ExecuteBashCommandTool(Tool):
160
162
  os.close(master)
161
163
  proc.wait()
162
164
 
163
- stdout_content = ''.join(stdout_buffer)
165
+ stdout_content = "".join(stdout_buffer)
164
166
  return_code = proc.returncode
165
167
  formatted_result = (
166
168
  "<command_output>"
@@ -186,7 +188,7 @@ class ExecuteBashCommandTool(Tool):
186
188
  if env:
187
189
  env_vars.update(env)
188
190
 
189
- if sys.platform == 'win32':
191
+ if sys.platform == "win32":
190
192
  return self._execute_windows(command, cwd, timeout_seconds, env_vars)
191
193
  else:
192
194
  if not pty:
@@ -197,4 +199,4 @@ class ExecuteBashCommandTool(Tool):
197
199
 
198
200
  if __name__ == "__main__":
199
201
  tool = ExecuteBashCommandTool()
200
- print(tool.to_markdown())
202
+ print(tool.to_markdown())
quantalogic/xml_parser.py CHANGED
@@ -298,5 +298,6 @@ class ToleranceXMLParser:
298
298
 
299
299
  except Exception as e:
300
300
  error_msg = f"Error extracting XML elements: {str(e)}"
301
+ error_msg = error_msg + f"\n{text}\n"
301
302
  logger.error(error_msg)
302
303
  raise ValueError(error_msg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantalogic
3
- Version: 0.31.0
3
+ Version: 0.31.1
4
4
  Summary: QuantaLogic ReAct Agents
5
5
  Author: Raphaël MANSUY
6
6
  Author-email: raphael.mansuy@gmail.com
@@ -116,7 +116,7 @@ We created [QuantaLogic](https://www.quantalogic.app) because we saw a significa
116
116
 
117
117
  ## Usage
118
118
 
119
- **Usage:** `quantalogic [OPTIONS] COMMAND [ARGS]...`
119
+ **Usage:** `quantalogic [OPTIONS] COMMAND i[ARGS]...`
120
120
  **Environment Variables:** Set `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, and `DEEPSEEK_API_KEY` for API integration.
121
121
 
122
122
  **Options:**
@@ -131,6 +131,7 @@ We created [QuantaLogic](https://www.quantalogic.app) because we saw a significa
131
131
  - `--help`: Show help message
132
132
 
133
133
  **Commands:**
134
+
134
135
  - `task`: Execute a task with the QuantaLogic AI Assistant
135
136
  - `--file PATH`: Path to task file
136
137
  - `--model-name TEXT`: Specify model
@@ -143,6 +144,25 @@ We created [QuantaLogic](https://www.quantalogic.app) because we saw a significa
143
144
  - `--compact-every-n-iteration`: Memory optimization
144
145
  - `--no-stream`: Disable streaming
145
146
 
147
+
148
+ - `list-models`: List available models with optional filtering.
149
+ - `--search TEXT`: Filter models by name or description.
150
+ - `--help`: Show help message.
151
+
152
+ Example:
153
+ ```bash
154
+ quantalogic list-models --search qwen
155
+ ```
156
+
157
+ Output:
158
+ ```
159
+ Model Name Description
160
+ ------------------- -------------------------------------------------------
161
+ dashscope/qwen-max Alibaba's Qwen-Max model optimized for maximum performance
162
+ dashscope/qwen-plus Alibaba's Qwen-Plus model offering balanced performance
163
+ ```
164
+
165
+
146
166
  ## Release Notes
147
167
 
148
168
  See our [Release Notes](RELEASE_NOTES.MD) for detailed version history and changes.
@@ -1,5 +1,5 @@
1
- quantalogic/__init__.py,sha256=s8G7kW8JI_WP201l950vIHxtLHk0V7mERsHuIR--P9w,925
2
- quantalogic/agent.py,sha256=2qgx5mJGx12otW2KzPoM0ZSugVxSTP3sXnvilXcvnrQ,33020
1
+ quantalogic/__init__.py,sha256=Su8CnOEdqKu4zTytjiP9P5olg-oIDuUA3fMWM1WUdRY,925
2
+ quantalogic/agent.py,sha256=5TscD78hIQBaF9pfxIRysC3HjnTJ6e0nyKDwrZMXHak,33223
3
3
  quantalogic/agent_config.py,sha256=SIRVSF0kkrYfvtyHiMCJhnm_nYqJCD2p1pN-reMIy24,7868
4
4
  quantalogic/agent_factory.py,sha256=HWKwN_DN57EPmME-hoCD2uJE0DqsPCzGU_V7nq54XzI,5284
5
5
  quantalogic/coding_agent.py,sha256=Z7ik6LUvLKDnaW9Ax1iZGC7p1WMnlYEUIlE5lkBP414,4975
@@ -9,7 +9,7 @@ quantalogic/console_print_token.py,sha256=qSU-3kmoZk4T5-1ybrEBi8tIXDPcz7eyWKhGh3
9
9
  quantalogic/docs_cli.py,sha256=3giVbUpespB9ZdTSJ955A3BhcOaBl5Lwsn1AVy9XAeY,1663
10
10
  quantalogic/event_emitter.py,sha256=jqot2g4JRXc88K6PW837Oqxbf7shZfO-xdPaUWmzupk,7901
11
11
  quantalogic/generative_model.py,sha256=ut_BFy4BqDxNqUXVbM8e_C_CzwNuJkvGWRsbpbKaees,13423
12
- quantalogic/get_model_info.py,sha256=nAvb_x4MnZei9CvTxUwqFUtFKkTp4-qiKB7ZWZxLxp8,1762
12
+ quantalogic/get_model_info.py,sha256=f64GpkpzeWXKRMBGG9edfAVP1-S-TclmxSaQC91vglw,1976
13
13
  quantalogic/interactive_text_editor.py,sha256=1vW4poJl7SItRGEeGQgtCFcmRDXmfCM8PE-uBtDBJuE,16658
14
14
  quantalogic/llm.py,sha256=yhuC1b5TCXojDXZEJK_PMcWUUxzrpI-gwzlIszAdJMM,4677
15
15
  quantalogic/main.py,sha256=__-4pX2pgoSFvt-aLdp6Qlrq55_SrwP_l8u2uTaQbjg,9262
@@ -35,7 +35,7 @@ quantalogic/tools/download_http_file_tool.py,sha256=wTfanbXjIRi5-qrbluuLvNmDNhvm
35
35
  quantalogic/tools/duckduckgo_search_tool.py,sha256=xVaEb_SUK5NL3lwMQXj1rGQYYvNT-td-qaB9QCes27Q,7014
36
36
  quantalogic/tools/edit_whole_content_tool.py,sha256=nXmpAvojvqvAcqNMy1kUKZ1ocboky_ZcnCR4SNCSPgw,2360
37
37
  quantalogic/tools/elixir_tool.py,sha256=fzPPtAW-Koy9KB0r5k2zV1f1U0WphL-LXPPOBkeNkug,7652
38
- quantalogic/tools/execute_bash_command_tool.py,sha256=kl3RSOZCOc-U52dwd0h6BxXvjMlAX7D0Bo2-HkCOcxo,6908
38
+ quantalogic/tools/execute_bash_command_tool.py,sha256=YK_cMuODJDOYheZKGmlpZTxJdVbimFLCUlND2_zmyMg,6869
39
39
  quantalogic/tools/generate_database_report_tool.py,sha256=QbZjtmegGEOEZAIa-CSeBo5O9dYBZTk_PWrumyFUg1Q,1890
40
40
  quantalogic/tools/grep_app_tool.py,sha256=BDxygwx7WCbqbiP2jmSRnIsoIUVYG5A4SKzId524ys4,19957
41
41
  quantalogic/tools/input_question_tool.py,sha256=UoTlNhdmdr-eyiVtVCG2qJe_R4bU_ag-DzstSdmYkvM,1848
@@ -86,10 +86,10 @@ quantalogic/utils/read_http_text_content.py,sha256=n3IayT5KcqctIVVF2gOQQAMf3Ow6e
86
86
  quantalogic/version.py,sha256=ea_cRutaQk5_lwlLbUUvPFuOT7Of7-gAsDl7wdveS-g,107
87
87
  quantalogic/version_check.py,sha256=cttR1lR3OienGLl7NrK1Te1fhDkqSjCci7HC1vFUTSY,1627
88
88
  quantalogic/welcome_message.py,sha256=IXMhem8h7srzNUwvw8G_lmEkHU8PFfote021E_BXmVk,3039
89
- quantalogic/xml_parser.py,sha256=uMLQNHTRCg116FwcjRoquZmSwVtE4LEH-6V2E3RD-dA,11466
89
+ quantalogic/xml_parser.py,sha256=8yDxvKzAEnefNwUAR-wjerMDOj5T5cxak4WPIA83SBw,11516
90
90
  quantalogic/xml_tool_parser.py,sha256=Vz4LEgDbelJynD1siLOVkJ3gLlfHsUk65_gCwbYJyGc,3784
91
- quantalogic-0.31.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
92
- quantalogic-0.31.0.dist-info/METADATA,sha256=SQnNSbR3pqL1-i7F2dUruuLT650tM-qp35rktOO0FC8,22262
93
- quantalogic-0.31.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
94
- quantalogic-0.31.0.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
95
- quantalogic-0.31.0.dist-info/RECORD,,
91
+ quantalogic-0.31.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
92
+ quantalogic-0.31.1.dist-info/METADATA,sha256=pLu3KI4tGKodQWubeVQm1G2P7tC9yZp22ZpOl35N074,22789
93
+ quantalogic-0.31.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
94
+ quantalogic-0.31.1.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
95
+ quantalogic-0.31.1.dist-info/RECORD,,