quantalogic 0.80__py3-none-any.whl → 0.93__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/flow/__init__.py +16 -34
- quantalogic/main.py +11 -6
- quantalogic/tools/tool.py +8 -922
- quantalogic-0.93.dist-info/METADATA +475 -0
- {quantalogic-0.80.dist-info → quantalogic-0.93.dist-info}/RECORD +8 -54
- quantalogic/codeact/TODO.md +0 -14
- quantalogic/codeact/__init__.py +0 -0
- quantalogic/codeact/agent.py +0 -478
- quantalogic/codeact/cli.py +0 -50
- quantalogic/codeact/cli_commands/__init__.py +0 -0
- quantalogic/codeact/cli_commands/create_toolbox.py +0 -45
- quantalogic/codeact/cli_commands/install_toolbox.py +0 -20
- quantalogic/codeact/cli_commands/list_executor.py +0 -15
- quantalogic/codeact/cli_commands/list_reasoners.py +0 -15
- quantalogic/codeact/cli_commands/list_toolboxes.py +0 -47
- quantalogic/codeact/cli_commands/task.py +0 -215
- quantalogic/codeact/cli_commands/tool_info.py +0 -24
- quantalogic/codeact/cli_commands/uninstall_toolbox.py +0 -43
- quantalogic/codeact/config.yaml +0 -21
- quantalogic/codeact/constants.py +0 -9
- quantalogic/codeact/events.py +0 -85
- quantalogic/codeact/examples/README.md +0 -342
- quantalogic/codeact/examples/agent_sample.yaml +0 -29
- quantalogic/codeact/executor.py +0 -186
- quantalogic/codeact/history_manager.py +0 -94
- quantalogic/codeact/llm_util.py +0 -57
- quantalogic/codeact/plugin_manager.py +0 -92
- quantalogic/codeact/prompts/error_format.j2 +0 -11
- quantalogic/codeact/prompts/generate_action.j2 +0 -77
- quantalogic/codeact/prompts/generate_program.j2 +0 -52
- quantalogic/codeact/prompts/response_format.j2 +0 -11
- quantalogic/codeact/react_agent.py +0 -318
- quantalogic/codeact/reasoner.py +0 -185
- quantalogic/codeact/templates/toolbox/README.md.j2 +0 -10
- quantalogic/codeact/templates/toolbox/pyproject.toml.j2 +0 -16
- quantalogic/codeact/templates/toolbox/tools.py.j2 +0 -6
- quantalogic/codeact/templates.py +0 -7
- quantalogic/codeact/tools_manager.py +0 -258
- quantalogic/codeact/utils.py +0 -62
- quantalogic/codeact/xml_utils.py +0 -126
- quantalogic/flow/flow.py +0 -1070
- quantalogic/flow/flow_extractor.py +0 -783
- quantalogic/flow/flow_generator.py +0 -322
- quantalogic/flow/flow_manager.py +0 -676
- quantalogic/flow/flow_manager_schema.py +0 -287
- quantalogic/flow/flow_mermaid.py +0 -365
- quantalogic/flow/flow_validator.py +0 -479
- quantalogic/flow/flow_yaml.linkedin.md +0 -31
- quantalogic/flow/flow_yaml.md +0 -767
- quantalogic/flow/templates/prompt_check_inventory.j2 +0 -1
- quantalogic/flow/templates/system_check_inventory.j2 +0 -1
- quantalogic-0.80.dist-info/METADATA +0 -900
- {quantalogic-0.80.dist-info → quantalogic-0.93.dist-info}/LICENSE +0 -0
- {quantalogic-0.80.dist-info → quantalogic-0.93.dist-info}/WHEEL +0 -0
- {quantalogic-0.80.dist-info → quantalogic-0.93.dist-info}/entry_points.txt +0 -0
@@ -1,900 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: quantalogic
|
3
|
-
Version: 0.80
|
4
|
-
Summary: QuantaLogic ReAct Agents
|
5
|
-
Author: Raphaël MANSUY
|
6
|
-
Author-email: raphael.mansuy@gmail.com
|
7
|
-
Requires-Python: >=3.10,<4.0
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
13
|
-
Requires-Dist: aiofiles (>=24.1.0,<25.0.0)
|
14
|
-
Requires-Dist: beautifulsoup4 (>=4.12.3,<5.0.0)
|
15
|
-
Requires-Dist: boto3 (>=1.34.0,<2.0.0)
|
16
|
-
Requires-Dist: botocore (>=1.29.123,<2.0.0)
|
17
|
-
Requires-Dist: click (>=8.1.8,<9.0.0)
|
18
|
-
Requires-Dist: duckduckgo-search (>=7.2.1,<8.0.0)
|
19
|
-
Requires-Dist: faker (>=36.1.1,<37.0.0)
|
20
|
-
Requires-Dist: fuzzywuzzy (>=0.18.0,<0.19.0)
|
21
|
-
Requires-Dist: google-search-results (>=2.4.2,<3.0.0)
|
22
|
-
Requires-Dist: html2text (>=2024.2.26,<2025.0.0)
|
23
|
-
Requires-Dist: instructor (>=1.7.2,<2.0.0)
|
24
|
-
Requires-Dist: jinja2 (>=3.1.5,<4.0.0)
|
25
|
-
Requires-Dist: litellm (>=1.63.14,<2.0.0)
|
26
|
-
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
27
|
-
Requires-Dist: markdownify (>=0.14.1,<0.15.0)
|
28
|
-
Requires-Dist: markitdown (>=0.0.1a3,<0.0.2)
|
29
|
-
Requires-Dist: networkx (>=3.2.1,<4.0.0)
|
30
|
-
Requires-Dist: openai (>=1.68.0,<2.0.0)
|
31
|
-
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
32
|
-
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
33
|
-
Requires-Dist: psutil (>=7.0.0,<8.0.0)
|
34
|
-
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
35
|
-
Requires-Dist: pytest-asyncio (>=0.25.3,<0.26.0)
|
36
|
-
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
37
|
-
Requires-Dist: quantalogic-pythonbox (>=0.9.7,<0.10.0)
|
38
|
-
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
39
|
-
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
40
|
-
Requires-Dist: serpapi (>=0.1.5,<0.2.0)
|
41
|
-
Requires-Dist: sqlalchemy (>=2.0.25,<3.0.0)
|
42
|
-
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
43
|
-
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
44
|
-
Requires-Dist: tree-sitter-c (>=0.23.4,<0.24.0)
|
45
|
-
Requires-Dist: tree-sitter-cpp (>=0.23.4,<0.24.0)
|
46
|
-
Requires-Dist: tree-sitter-go (>=0.23.4,<0.24.0)
|
47
|
-
Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
|
48
|
-
Requires-Dist: tree-sitter-javascript (>=0.23.1,<0.24.0)
|
49
|
-
Requires-Dist: tree-sitter-python (>=0.23.6,<0.24.0)
|
50
|
-
Requires-Dist: tree-sitter-rust (>=0.23.2,<0.24.0)
|
51
|
-
Requires-Dist: tree-sitter-scala (>=0.23.4,<0.24.0)
|
52
|
-
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
|
53
|
-
Requires-Dist: types-pyyaml (>=6.0.12.20241230,<7.0.0.0)
|
54
|
-
Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
|
55
|
-
Description-Content-Type: text/markdown
|
56
|
-
|
57
|
-
|
58
|
-
[](https://quantalogic.github.io/quantalogic/)
|
59
|
-
|
60
|
-
Hey there, welcome to **QuantaLogic**—your cosmic toolkit for crafting AI agents and workflows that shine! Whether you’re coding up a storm, automating a business process, chatting with a clever assistant, or dreaming up something wild, QuantaLogic is here to make it happen. We’re talking **large language models (LLMs)** fused with a stellar toolset, featuring three powerhouse approaches: the **ReAct framework** for dynamic problem-solving, the dazzling new **Flow module** for structured brilliance, and a shiny **Chat mode** for conversational magic with tool-calling capabilities.
|
61
|
-
|
62
|
-
Picture this: a CLI that’s as easy as a snap, a Python API that’s pure magic, and a framework that scales from quick hacks to galactic enterprises. Ready to launch? Let’s blast off!
|
63
|
-
|
64
|
-
[ Full Docs](https://quantalogic.github.io/quantalogic/) | [ How-To Guide](./docs/howto/howto.md)
|
65
|
-
|
66
|
-

|
67
|
-
|
68
|
-
---
|
69
|
-
[Chinese Version](./README_CN.md)
|
70
|
-
[French Version](./README_FR.md)
|
71
|
-
[German Version](./README_DE.md)
|
72
|
-
|
73
|
-
## Why QuantaLogic?
|
74
|
-
|
75
|
-
At [QuantaLogic](https://www.quantalogic.app), we spotted a black hole: amazing AI models from OpenAI, Anthropic, and DeepSeek weren’t fully lighting up real-world tasks. Our mission? Ignite that spark! We’re here to make generative AI a breeze for developers, businesses, and dreamers alike—turning ideas into action, one brilliant solution at a time, whether through task-solving, structured workflows, or natural conversation.
|
76
|
-
|
77
|
-
> "AI should be your co-pilot, not a puzzle. QuantaLogic makes it happen—fast, fun, and fearless!"
|
78
|
-
|
79
|
-
---
|
80
|
-
|
81
|
-
## Key Features
|
82
|
-
|
83
|
-
- **ReAct Framework**: Reasoning + action = unstoppable agents!
|
84
|
-
- **Flow Module**: Structured workflows that flow like a river.
|
85
|
-
- **Chat Mode**: Conversational brilliance with tool-calling powers.
|
86
|
-
- **LLM Galaxy**: Tap into OpenAI, DeepSeek, and more via LiteLLM.
|
87
|
-
- **Secure Tools**: Docker-powered safety for code and files.
|
88
|
-
- **Live Monitoring**: Watch it unfold with a web interface and SSE.
|
89
|
-
- **Memory Magic**: Smart context keeps things snappy.
|
90
|
-
- **Enterprise-Ready**: Logs, error handling, and validation—rock solid.
|
91
|
-
|
92
|
-
---
|
93
|
-
|
94
|
-
## Table of Contents
|
95
|
-
|
96
|
-
- [Why QuantaLogic?](#why-quantalogic)
|
97
|
-
- [Key Features](#key-features)
|
98
|
-
- [Installation](#installation)
|
99
|
-
- [Quick Start](#quick-start)
|
100
|
-
- [ReAct Framework: Dynamic Agents](#react-framework-dynamic-agents)
|
101
|
-
- [Flow Module: Structured Workflows](#flow-module-structured-workflows)
|
102
|
-
- 📘 **[Workflow YAML DSL Specification](./quantalogic/flow/flow_yaml.md)**: Comprehensive guide to defining powerful, structured workflows using our Domain-Specific Language
|
103
|
-
- 📚 **[Flow YAML Documentation](./quantalogic/flow/flow_yaml)**: Dive into the official documentation for a deeper understanding of Flow YAML and its applications
|
104
|
-
- [Chat Mode: Conversational Power](#chat-mode-conversational-power)
|
105
|
-
- [ReAct vs. Flow vs. Chat: Pick Your Power](#react-vs-flow-vs-chat-pick-your-power)
|
106
|
-
- [Using the CLI](#using-the-cli)
|
107
|
-
- [Examples That Spark Joy](#examples-that-spark-joy)
|
108
|
-
- [Core Components](#core-components)
|
109
|
-
- [Developing with QuantaLogic](#developing-with-quantalogic)
|
110
|
-
- [Contributing](#contributing)
|
111
|
-
- [License](#license)
|
112
|
-
- [Project Growth](#project-growth)
|
113
|
-
- [API Keys and Environment Configuration](#api-keys-and-environment-configuration)
|
114
|
-
|
115
|
-
---
|
116
|
-
|
117
|
-
## Installation
|
118
|
-
|
119
|
-
Let’s get QuantaLogic orbiting your system—it’s as easy as 1-2-3!
|
120
|
-
|
121
|
-
### What You’ll Need
|
122
|
-
- **Python 3.12+**: The fuel for our rocket.
|
123
|
-
- **Docker** (optional): Locks down code execution in a safe pod.
|
124
|
-
|
125
|
-
### Option 1: pip—Fast and Simple
|
126
|
-
```bash
|
127
|
-
pip install quantalogic
|
128
|
-
```
|
129
|
-
|
130
|
-
### Option 2: pipx—Isolated Stardust
|
131
|
-
```bash
|
132
|
-
pipx install quantalogic
|
133
|
-
```
|
134
|
-
|
135
|
-
### Option 3: Source—For Space Explorers
|
136
|
-
```bash
|
137
|
-
git clone https://github.com/quantalogic/quantalogic.git
|
138
|
-
cd quantalogic
|
139
|
-
python -m venv .venv
|
140
|
-
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
141
|
-
poetry install
|
142
|
-
```
|
143
|
-
> **Tip**: No Poetry? Grab it with `pip install poetry` and join the crew!
|
144
|
-
|
145
|
-
---
|
146
|
-
|
147
|
-
## Quick Start
|
148
|
-
|
149
|
-
Ready to see the magic? Here’s your launchpad:
|
150
|
-
|
151
|
-
### CLI: Instant Action
|
152
|
-
```bash
|
153
|
-
quantalogic task "Write a Python function for Fibonacci numbers"
|
154
|
-
```
|
155
|
-
> Boom! ReAct whips up a solution in seconds.
|
156
|
-
|
157
|
-
### CLI: Chat Mode
|
158
|
-
```bash
|
159
|
-
quantalogic chat --persona "You are a witty space explorer" "Tell me about Mars with a search"
|
160
|
-
```
|
161
|
-
> Chat mode engages, uses tools if needed, and delivers a conversational response!
|
162
|
-
|
163
|
-
### Python: ReAct Agent
|
164
|
-
```python
|
165
|
-
from quantalogic import Agent
|
166
|
-
|
167
|
-
agent = Agent(model_name="deepseek/deepseek-chat")
|
168
|
-
result = agent.solve_task("Code a Fibonacci function")
|
169
|
-
print(result)
|
170
|
-
# Output: "def fib(n): return [0, 1] if n <= 2 else fib(n-1) + [fib(n-1)[-1] + fib(n-1)[-2]]"
|
171
|
-
```
|
172
|
-
|
173
|
-
### Python: Chat Mode
|
174
|
-
```python
|
175
|
-
from quantalogic import Agent
|
176
|
-
|
177
|
-
agent = Agent(model_name="gpt-4o", chat_system_prompt="You are a friendly guide")
|
178
|
-
response = agent.chat("What's the weather like in Tokyo?")
|
179
|
-
print(response)
|
180
|
-
# Engages in conversation, potentially calling a weather tool if configured
|
181
|
-
```
|
182
|
-
|
183
|
-
### Synchronous Agent Example
|
184
|
-
```python
|
185
|
-
from quantalogic import Agent
|
186
|
-
|
187
|
-
# Create a synchronous agent
|
188
|
-
agent = Agent(model_name="gpt-4o")
|
189
|
-
|
190
|
-
# Solve a task synchronously
|
191
|
-
result = agent.solve_task(
|
192
|
-
task="Write a Python function to calculate Fibonacci numbers",
|
193
|
-
max_iterations=10 # Optional: limit iterations
|
194
|
-
)
|
195
|
-
|
196
|
-
print(result)
|
197
|
-
```
|
198
|
-
|
199
|
-
### Async Agent Example 🌊
|
200
|
-
```python
|
201
|
-
import asyncio
|
202
|
-
from quantalogic import Agent
|
203
|
-
|
204
|
-
async def main():
|
205
|
-
# Create an async agent
|
206
|
-
agent = Agent(model_name="gpt-4o")
|
207
|
-
|
208
|
-
# Solve a task asynchronously with streaming
|
209
|
-
result = await agent.async_solve_task(
|
210
|
-
task="Write a Python script to scrape top GitHub repositories",
|
211
|
-
max_iterations=15, # Optional: limit iterations
|
212
|
-
streaming=True # Optional: stream the response
|
213
|
-
)
|
214
|
-
|
215
|
-
print(result)
|
216
|
-
|
217
|
-
# Run the async function
|
218
|
-
asyncio.run(main())
|
219
|
-
```
|
220
|
-
|
221
|
-
### Event Monitoring Examples 🔍
|
222
|
-
|
223
|
-
#### Synchronous Event Monitoring with Finance Tools
|
224
|
-
```python
|
225
|
-
from quantalogic import Agent
|
226
|
-
from quantalogic.console_print_events import console_print_events
|
227
|
-
from quantalogic.console_print_token import console_print_token
|
228
|
-
from quantalogic.tools import (
|
229
|
-
DuckDuckGoSearchTool,
|
230
|
-
TechnicalAnalysisTool,
|
231
|
-
YFinanceTool
|
232
|
-
)
|
233
|
-
|
234
|
-
# Create an agent with finance-related tools
|
235
|
-
agent = Agent(
|
236
|
-
model_name="gpt-4o",
|
237
|
-
tools=[
|
238
|
-
DuckDuckGoSearchTool(), # Web search tool
|
239
|
-
TechnicalAnalysisTool(), # Stock technical analysis
|
240
|
-
YFinanceTool() # Stock data retrieval
|
241
|
-
]
|
242
|
-
)
|
243
|
-
|
244
|
-
# Set up comprehensive event listeners
|
245
|
-
agent.event_emitter.on(
|
246
|
-
event=[
|
247
|
-
"task_complete",
|
248
|
-
"task_think_start",
|
249
|
-
"task_think_end",
|
250
|
-
"tool_execution_start",
|
251
|
-
"tool_execution_end",
|
252
|
-
"error_max_iterations_reached",
|
253
|
-
"memory_full",
|
254
|
-
"memory_compacted"
|
255
|
-
],
|
256
|
-
listener=console_print_events
|
257
|
-
)
|
258
|
-
|
259
|
-
# Optional: Monitor streaming tokens
|
260
|
-
agent.event_emitter.on(
|
261
|
-
event=["stream_chunk"],
|
262
|
-
listener=console_print_token
|
263
|
-
)
|
264
|
-
|
265
|
-
# Execute a multi-step financial analysis task
|
266
|
-
result = agent.solve_task(
|
267
|
-
"1. Find the top 3 tech stocks for Q3 2024 "
|
268
|
-
"2. Retrieve historical stock data for each "
|
269
|
-
"3. Calculate 50-day and 200-day moving averages "
|
270
|
-
"4. Provide a brief investment recommendation",
|
271
|
-
streaming=True # Enable streaming for detailed output
|
272
|
-
)
|
273
|
-
print(result)
|
274
|
-
```
|
275
|
-
|
276
|
-
#### Async Event Monitoring with Finance Tools
|
277
|
-
```python
|
278
|
-
import asyncio
|
279
|
-
from quantalogic import Agent
|
280
|
-
from quantalogic.console_print_events import console_print_events
|
281
|
-
from quantalogic.console_print_token import console_print_token
|
282
|
-
from quantalogic.tools import (
|
283
|
-
DuckDuckGoSearchTool,
|
284
|
-
TechnicalAnalysisTool,
|
285
|
-
YFinanceTool
|
286
|
-
)
|
287
|
-
|
288
|
-
async def main():
|
289
|
-
# Create an async agent with finance-related tools
|
290
|
-
agent = Agent(
|
291
|
-
model_name="gpt-4o",
|
292
|
-
tools=[
|
293
|
-
DuckDuckGoSearchTool(), # Web search tool
|
294
|
-
TechnicalAnalysisTool(), # Stock technical analysis
|
295
|
-
YFinanceTool() # Stock data retrieval
|
296
|
-
]
|
297
|
-
)
|
298
|
-
|
299
|
-
# Set up comprehensive event listeners
|
300
|
-
agent.event_emitter.on(
|
301
|
-
event=[
|
302
|
-
"task_complete",
|
303
|
-
"task_think_start",
|
304
|
-
"task_think_end",
|
305
|
-
"tool_execution_start",
|
306
|
-
"tool_execution_end",
|
307
|
-
"error_max_iterations_reached",
|
308
|
-
"memory_full",
|
309
|
-
"memory_compacted"
|
310
|
-
],
|
311
|
-
listener=console_print_events
|
312
|
-
)
|
313
|
-
|
314
|
-
# Optional: Monitor streaming tokens
|
315
|
-
agent.event_emitter.on(
|
316
|
-
event=["stream_chunk"],
|
317
|
-
listener=console_print_token
|
318
|
-
)
|
319
|
-
|
320
|
-
# Execute a multi-step financial analysis task asynchronously
|
321
|
-
result = await agent.async_solve_task(
|
322
|
-
"1. Find emerging AI technology startups "
|
323
|
-
"2. Analyze their recent funding rounds "
|
324
|
-
"3. Compare market potential and growth indicators "
|
325
|
-
"4. Provide an investment trend report",
|
326
|
-
streaming=True # Enable streaming for detailed output
|
327
|
-
)
|
328
|
-
print(result)
|
329
|
-
|
330
|
-
# Run the async function
|
331
|
-
asyncio.run(main())
|
332
|
-
```
|
333
|
-
|
334
|
-
### Python: Flow Workflow
|
335
|
-
```python
|
336
|
-
from quantalogic.flow import Workflow, Nodes
|
337
|
-
|
338
|
-
@Nodes.define(output="greeting")
|
339
|
-
def greet(name: str) -> str:
|
340
|
-
return f"Hello, {name}!"
|
341
|
-
|
342
|
-
workflow = Workflow("greet").build()
|
343
|
-
result = await workflow.run({"name": "Luna"})
|
344
|
-
print(result["greeting"]) # "Hello, Luna!"
|
345
|
-
```
|
346
|
-
|
347
|
-
---
|
348
|
-
|
349
|
-
## ReAct Framework: Dynamic Agents
|
350
|
-
|
351
|
-
The **ReAct** framework is your AI sidekick—think fast, act smart. It pairs LLM reasoning with tool-powered action, perfect for tasks that need a bit of improvisation.
|
352
|
-
|
353
|
-
### How It Rolls
|
354
|
-
1. **You Say**: "Write me a script."
|
355
|
-
2. **It Thinks**: LLM plots the course.
|
356
|
-
3. **It Acts**: Tools like `PythonTool` get to work.
|
357
|
-
4. **It Loops**: Keeps going until it’s done.
|
358
|
-
|
359
|
-
Check this out:
|
360
|
-
|
361
|
-
```mermaid
|
362
|
-
graph TD
|
363
|
-
A[You: 'Write a script'] --> B[ReAct Agent]
|
364
|
-
B --> C{Reason with LLM}
|
365
|
-
C --> D[Call Tools]
|
366
|
-
D --> E[Get Results]
|
367
|
-
E --> F{Task Done?}
|
368
|
-
F -->|No| C
|
369
|
-
F -->|Yes| G[Deliver Answer]
|
370
|
-
G --> H[You: Happy!]
|
371
|
-
style A fill:#f9f,stroke:#333
|
372
|
-
style H fill:#bbf,stroke:#333
|
373
|
-
```
|
374
|
-
|
375
|
-
### Example: Code Generator
|
376
|
-
```bash
|
377
|
-
quantalogic task "Create a Python script to sort a list"
|
378
|
-
```
|
379
|
-
> ReAct figures it out, writes the code, and hands it over—smooth as silk!
|
380
|
-
|
381
|
-
### Why It’s Cool
|
382
|
-
Perfect for coding, debugging, or answering wild questions on the fly.
|
383
|
-
|
384
|
-
---
|
385
|
-
|
386
|
-
## Flow Module: Structured Workflows
|
387
|
-
|
388
|
-
The **Flow module** is your architect—building workflows that hum with precision. It's all about nodes, transitions, and a steady rhythm, ideal for repeatable missions.
|
389
|
-
|
390
|
-
🔍 **Want to dive deeper?** Check out our comprehensive [Workflow YAML DSL Specification](./quantalogic/flow/flow_yaml.md), a detailed guide that walks you through defining powerful, structured workflows. From basic node configurations to complex transition logic, this documentation is your roadmap to mastering workflow design with QuantaLogic.
|
391
|
-
|
392
|
-
📚 **For a deeper understanding of Flow YAML and its applications, please refer to the official [Flow YAMAL Documentation](./quantalogic/flow/flow_yaml.md).**
|
393
|
-
|
394
|
-
The Flow YAML documentation provides a comprehensive overview of the Flow YAML language, including its syntax, features, and best practices. It's a valuable resource for anyone looking to create complex workflows with QuantaLogic.
|
395
|
-
|
396
|
-
Additionally, the Flow YAML documentation includes a number of examples and tutorials to help you get started with creating your own workflows. These examples cover a range of topics, from simple workflows to more complex scenarios, and are designed to help you understand how to use Flow YAML to create powerful and flexible workflows.
|
397
|
-
|
398
|
-
### The Building Blocks
|
399
|
-
- **Nodes**: Tasks like functions or LLM calls.
|
400
|
-
- **Transitions**: Paths with optional conditions.
|
401
|
-
- **Engine**: Runs the show with flair.
|
402
|
-
- **Observers**: Peek at progress with events.
|
403
|
-
|
404
|
-
### Example: Story Weaver
|
405
|
-
```python
|
406
|
-
from quantalogic.flow import Workflow, Nodes
|
407
|
-
|
408
|
-
@Nodes.llm_node(model="openai/gpt-4o-mini", output="chapter")
|
409
|
-
async def write_chapter(ctx: dict) -> str:
|
410
|
-
return f"Chapter 1: {ctx['theme']}"
|
411
|
-
|
412
|
-
workflow = (
|
413
|
-
Workflow("write_chapter")
|
414
|
-
.then("end", condition="lambda ctx: True")
|
415
|
-
.add_observer(lambda e: print(f" {e.event_type}"))
|
416
|
-
)
|
417
|
-
engine = workflow.build()
|
418
|
-
result = await engine.run({"theme": "Cosmic Quest"})
|
419
|
-
print(result["chapter"])
|
420
|
-
```
|
421
|
-
|
422
|
-
### Example: Story Generator Agent
|
423
|
-
```python
|
424
|
-
from typing import List
|
425
|
-
import anyio
|
426
|
-
from loguru import logger
|
427
|
-
from quantalogic.flow import Nodes, Workflow
|
428
|
-
|
429
|
-
# Define node functions with decorators
|
430
|
-
@Nodes.validate_node(output="validation_result")
|
431
|
-
async def validate_input(genre: str, num_chapters: int) -> str:
|
432
|
-
"""Validate input parameters."""
|
433
|
-
if not (1 <= num_chapters <= 20 and genre.lower() in ["science fiction", "fantasy", "mystery", "romance"]):
|
434
|
-
raise ValueError("Invalid input: genre must be one of science fiction, fantasy, mystery, romance")
|
435
|
-
return "Input validated"
|
436
|
-
|
437
|
-
@Nodes.llm_node(
|
438
|
-
model="gemini/gemini-2.0-flash",
|
439
|
-
system_prompt="You are a creative writer specializing in story titles.",
|
440
|
-
prompt_template="Generate a creative title for a {{ genre }} story. Output only the title.",
|
441
|
-
output="title",
|
442
|
-
)
|
443
|
-
async def generate_title(genre: str) -> str:
|
444
|
-
"""Generate a title based on the genre (handled by llm_node)."""
|
445
|
-
pass # Logic handled by llm_node decorator
|
446
|
-
|
447
|
-
@Nodes.define(output="manuscript")
|
448
|
-
async def compile_book(title: str, outline: str, chapters: List[str]) -> str:
|
449
|
-
"""Compile the full manuscript from title, outline, and chapters."""
|
450
|
-
return f"Title: {title}\n\nOutline:\n{outline}\n\n" + "\n\n".join(
|
451
|
-
f"Chapter {i}:\n{chap}" for i, chap in enumerate(chapters, 1)
|
452
|
-
)
|
453
|
-
|
454
|
-
# Define the workflow with conditional branching
|
455
|
-
workflow = (
|
456
|
-
Workflow("validate_input")
|
457
|
-
.then("generate_title")
|
458
|
-
.then("generate_outline")
|
459
|
-
.then("generate_chapter")
|
460
|
-
.then("update_chapter_progress")
|
461
|
-
.then("generate_chapter", condition=lambda ctx: ctx["completed_chapters"] < ctx["num_chapters"])
|
462
|
-
.then("compile_book", condition=lambda ctx: ctx["completed_chapters"] >= ctx["num_chapters"])
|
463
|
-
.then("quality_check")
|
464
|
-
.then("end")
|
465
|
-
)
|
466
|
-
|
467
|
-
# Run the workflow
|
468
|
-
async def main():
|
469
|
-
initial_context = {
|
470
|
-
"genre": "science fiction",
|
471
|
-
"num_chapters": 3,
|
472
|
-
"chapters": [],
|
473
|
-
"completed_chapters": 0,
|
474
|
-
}
|
475
|
-
engine = workflow.build()
|
476
|
-
result = await engine.run(initial_context)
|
477
|
-
```
|
478
|
-
|
479
|
-
This example demonstrates:
|
480
|
-
- Input validation with `@Nodes.validate_node`
|
481
|
-
- LLM integration with `@Nodes.llm_node`
|
482
|
-
- Custom processing with `@Nodes.define`
|
483
|
-
- Conditional branching for iterative chapter generation
|
484
|
-
- Context management for tracking progress
|
485
|
-
|
486
|
-
The full example is available at [examples/flow/story_generator/story_generator_agent.py](./examples/flow/story_generator/story_generator_agent.py).
|
487
|
-
|
488
|
-
### Flow Visualized
|
489
|
-
```mermaid
|
490
|
-
graph LR
|
491
|
-
A[Start] --> B[WriteChapter]
|
492
|
-
B -->|Condition: True| C[End]
|
493
|
-
subgraph WriteChapter
|
494
|
-
D[Call LLM] --> E[Save Chapter]
|
495
|
-
end
|
496
|
-
A -->|Observer| F[Log: NODE_STARTED]
|
497
|
-
B -->|Observer| G[Log: NODE_COMPLETED]
|
498
|
-
style A fill:#dfd,stroke:#333
|
499
|
-
style C fill:#dfd,stroke:#333
|
500
|
-
style B fill:#ffb,stroke:#333
|
501
|
-
```
|
502
|
-
|
503
|
-
### Example: Data Pipeline
|
504
|
-
```python
|
505
|
-
@Nodes.define(output="processed")
|
506
|
-
def clean_data(data: str) -> str:
|
507
|
-
return data.strip().upper()
|
508
|
-
|
509
|
-
workflow = Workflow("clean_data").build()
|
510
|
-
result = await workflow.run({"data": " hello "})
|
511
|
-
print(result["processed"]) # "HELLO"
|
512
|
-
```
|
513
|
-
|
514
|
-
### Why It Rocks
|
515
|
-
Think content pipelines, automation flows, or any multi-step task that needs order.
|
516
|
-
|
517
|
-
---
|
518
|
-
|
519
|
-
## Chat Mode: Conversational Power
|
520
|
-
|
521
|
-
The **Chat mode** is your conversational companion—engaging, flexible, and tool-savvy. Built on the same robust ReAct foundation, it lets you chat naturally with an AI persona while seamlessly integrating tool calls when needed. Perfect for interactive dialogues or quick queries with a dash of utility.
|
522
|
-
|
523
|
-
### How It Works
|
524
|
-
1. **You Chat**: "What’s the weather like today?"
|
525
|
-
2. **It Responds**: Engages conversationally, deciding if a tool (like a weather lookup) is needed.
|
526
|
-
3. **Tool Magic**: If required, it calls tools using the same XML-based system as ReAct, then weaves the results into the conversation.
|
527
|
-
4. **Keeps Going**: Maintains context for a smooth, flowing chat.
|
528
|
-
|
529
|
-
### Example: CLI Chat with Tool Call
|
530
|
-
```bash
|
531
|
-
quantalogic chat --persona "You are a helpful travel guide" "Find me flights to Paris"
|
532
|
-
```
|
533
|
-
> The agent chats back: "Looking up flights to Paris… Here are some options from a search tool: [flight details]. Anything else I can help with?"
|
534
|
-
|
535
|
-
### Example: Python Chat with Tool Call
|
536
|
-
```python
|
537
|
-
from quantalogic import Agent
|
538
|
-
from quantalogic.tools import DuckDuckGoSearchTool
|
539
|
-
|
540
|
-
agent = Agent(
|
541
|
-
model_name="gpt-4o",
|
542
|
-
chat_system_prompt="You are a curious explorer",
|
543
|
-
tools=[DuckDuckGoSearchTool()]
|
544
|
-
)
|
545
|
-
response = agent.chat("Tell me about the tallest mountain")
|
546
|
-
print(response)
|
547
|
-
# Might output: "I’ll look that up! The tallest mountain is Mount Everest, standing at 8,848 meters, according to a quick search."
|
548
|
-
```
|
549
|
-
|
550
|
-
### Tool Integration
|
551
|
-
Chat mode uses the same tool-calling mechanism as ReAct:
|
552
|
-
```xml
|
553
|
-
<action>
|
554
|
-
<duckduckgo_tool>
|
555
|
-
<query>tallest mountain</query>
|
556
|
-
<max_results>5</max_results>
|
557
|
-
</duckduckgo_tool>
|
558
|
-
</action>
|
559
|
-
```
|
560
|
-
- Tools are auto-executed (configurable with `--auto-tool-call`) and results are formatted naturally.
|
561
|
-
- Prioritize specific tools with `--tool-mode` (e.g., `search` or `code`).
|
562
|
-
|
563
|
-
### Why It’s Awesome
|
564
|
-
Ideal for casual chats, quick info lookups, or interactive assistance with tool-powered precision—without the rigid task-solving structure of ReAct.
|
565
|
-
|
566
|
-
---
|
567
|
-
|
568
|
-
## ReAct vs. Flow vs. Chat: Pick Your Power
|
569
|
-
|
570
|
-
All three modes are stellar, but here’s the scoop:
|
571
|
-
|
572
|
-
| Feature | ReAct Framework | Flow Module | Chat Mode |
|
573
|
-
|---------------------|--------------------------|--------------------------|--------------------------|
|
574
|
-
| **Vibe** | Free-spirited, adaptive | Organized, predictable | Conversational, flexible |
|
575
|
-
| **Flow** | Loops ‘til it’s solved | Follows a roadmap | Flows with the chat |
|
576
|
-
| **Sweet Spot** | Creative chaos (coding, Q&A) | Steady workflows (pipelines) | Casual chats, quick queries |
|
577
|
-
| **State** | Memory keeps it loose | Nodes lock it down | Context keeps it flowing |
|
578
|
-
| **Tools** | Grabbed as needed | Baked into nodes | Called when relevant |
|
579
|
-
| **Watch It** | Events like `task_complete` | Observers like `NODE_STARTED` | Events like `chat_response` |
|
580
|
-
|
581
|
-
### When to Choose
|
582
|
-
- **ReAct**: Code on-the-fly, explore answers, debug like a pro.
|
583
|
-
- **Flow**: Build a pipeline, automate a process, keep it tight.
|
584
|
-
- **Chat**: Converse naturally, get quick answers, use tools on demand.
|
585
|
-
|
586
|
-
---
|
587
|
-
|
588
|
-
## Using the CLI
|
589
|
-
|
590
|
-
The CLI is your command center—fast, flexible, and fun!
|
591
|
-
|
592
|
-
### Syntax
|
593
|
-
```bash
|
594
|
-
quantalogic [OPTIONS] COMMAND [ARGS]...
|
595
|
-
```
|
596
|
-
|
597
|
-
### Description
|
598
|
-
QuantaLogic AI Assistant - A powerful AI tool for various tasks.
|
599
|
-
|
600
|
-
### Environment Variables
|
601
|
-
- **OpenAI**: Set `OPENAI_API_KEY` to your OpenAI API key
|
602
|
-
- **Anthropic**: Set `ANTHROPIC_API_KEY` to your Anthropic API key
|
603
|
-
- **DeepSeek**: Set `DEEPSEEK_API_KEY` to your DeepSeek API key
|
604
|
-
|
605
|
-
Use a `.env` file or export these variables in your shell for seamless integration.
|
606
|
-
|
607
|
-
### Commands
|
608
|
-
- **`task`**: Kick off a mission.
|
609
|
-
```bash
|
610
|
-
quantalogic task "Summarize this file" --file notes.txt
|
611
|
-
```
|
612
|
-
- **`chat`**: Start a conversation.
|
613
|
-
```bash
|
614
|
-
quantalogic chat --persona "You are a tech guru" "What’s new in AI?"
|
615
|
-
```
|
616
|
-
- **`list-models`**: List supported LiteLLM models with optional fuzzy search.
|
617
|
-
```bash
|
618
|
-
quantalogic list-models --search "gpt"
|
619
|
-
```
|
620
|
-
|
621
|
-
### Options
|
622
|
-
- **`--model-name TEXT`**: Specify the model to use (litellm format). Examples:
|
623
|
-
- `openai/gpt-4o-mini`
|
624
|
-
- `openai/gpt-4o`
|
625
|
-
- `anthropic/claude-3.5-sonnet`
|
626
|
-
- `deepseek/deepseek-chat`
|
627
|
-
- `deepseek/deepseek-reasoner`
|
628
|
-
- `openrouter/deepseek/deepseek-r1`
|
629
|
-
- `openrouter/openai/gpt-4o`
|
630
|
-
- **`--mode [code|basic|interpreter|full|code-basic|search|search-full|chat]`**: Agent mode
|
631
|
-
- **`--vision-model-name TEXT`**: Specify the vision model to use (litellm format)
|
632
|
-
- **`--log [info|debug|warning]`**: Set logging level
|
633
|
-
- **`--verbose`**: Enable verbose output
|
634
|
-
- **`--max-iterations INTEGER`**: Maximum number of iterations (default: 30, task mode only)
|
635
|
-
- **`--max-tokens-working-memory INTEGER`**: Set the maximum tokens allowed in working memory
|
636
|
-
- **`--compact-every-n-iteration INTEGER`**: Set the frequency of memory compaction
|
637
|
-
- **`--thinking-model TEXT`**: The thinking model to use
|
638
|
-
- **`--persona TEXT`**: Set the chat persona (chat mode only)
|
639
|
-
- **`--tool-mode TEXT`**: Prioritize a tool or toolset (chat mode only)
|
640
|
-
- **`--auto-tool-call`**: Enable/disable auto tool execution (chat mode only, default: True)
|
641
|
-
- **`--version`**: Show version information
|
642
|
-
|
643
|
-
> **Tip**: Run `quantalogic --help` for the complete command reference!
|
644
|
-
|
645
|
-
---
|
646
|
-
|
647
|
-
## Examples That Spark Joy
|
648
|
-
|
649
|
-
Explore our collection of examples to see QuantaLogic in action:
|
650
|
-
|
651
|
-
- [Flow Examples](./examples/flow/README.md): Discover practical workflows showcasing Quantalogic Flow capabilities
|
652
|
-
- [Agent Examples](./examples/agent/README.md): See dynamic agents in action with the ReAct framework
|
653
|
-
- [Tool Examples](./examples/tools/README.md): Explore our powerful tool integrations
|
654
|
-
|
655
|
-
Each example comes with detailed documentation and ready-to-run code.
|
656
|
-
|
657
|
-
### Video Magic
|
658
|
-
[](./examples/generated_tutorials/python/quantalogic_long.mp4)
|
659
|
-
|
660
|
-
### Hands-On Examples
|
661
|
-
| Name | What’s It Do? | File |
|
662
|
-
|-------------------|------------------------------------|--------------------------------------------|
|
663
|
-
| Simple Agent | Basic ReAct agent demo | [01-simple-agent.py](./examples/01-simple-agent.py) |
|
664
|
-
| Event Monitoring | Agent with event tracking | [02-agent-with-event-monitoring.py](./examples/02-agent-with-event-monitoring.py) |
|
665
|
-
| Interpreter Mode | Agent with interpreter | [03-agent-with-interpreter.py](./examples/03-agent-with-interpreter.py) |
|
666
|
-
| Agent Summary | Task summary generation | [04-agent-summary-task.py](./examples/04-agent-summary-task.py) |
|
667
|
-
| Code Generation | Basic code generation | [05-code.py](./examples/05-code.py) |
|
668
|
-
| Code Screen | Advanced code generation | [06-code-screen.py](./examples/06-code-screen.py) |
|
669
|
-
| Tutorial Writer | Write technical tutorials | [07-write-tutorial.py](./examples/07-write-tutorial.py) |
|
670
|
-
| PRD Writer | Product Requirements Document | [08-prd-writer.py](./examples/08-prd-writer.py) |
|
671
|
-
| Story Generator | Flow-based story creation | [story_generator_agent.py](./examples/flow/story_generator/story_generator_agent.py) |
|
672
|
-
| SQL Query | Database query generation | [09-sql-query.py](./examples/09-sql-query.py) |
|
673
|
-
| Finance Agent | Financial analysis and tasks | [10-finance-agent.py](./examples/10-finance-agent.py) |
|
674
|
-
| Textual Interface | Agent with textual UI | [11-textual-agent-interface.py](./examples/11-textual-agent-interface.py) |
|
675
|
-
| Composio Test | Composio integration demo | [12-composio-test.py](./examples/12-composio-test.py) |
|
676
|
-
| Synchronous Agent | Synchronous agent demo | [13-synchronous-agent.py](./examples/13-synchronous-agent.py) |
|
677
|
-
| Async Agent | Async agent demo | [14-async-agent.py](./examples/14-async-agent.py) |
|
678
|
-
|
679
|
-
### Bonus: Math Whiz
|
680
|
-
```bash
|
681
|
-
quantalogic task "Solve 2x + 5 = 15"
|
682
|
-
```
|
683
|
-
> Output: "Let’s solve it! 2x + 5 = 15 → 2x = 10 → x = 5. Done!"
|
684
|
-
|
685
|
-
### Bonus: Chat Query
|
686
|
-
```bash
|
687
|
-
quantalogic chat "Search for the latest AI breakthroughs"
|
688
|
-
```
|
689
|
-
> Output: "I’ll dig into that! Here’s what I found with a search: [latest AI news]. Pretty cool, right?"
|
690
|
-
|
691
|
-
---
|
692
|
-
|
693
|
-
## Core Components
|
694
|
-
|
695
|
-
### ReAct Agents
|
696
|
-
- **Brain**: LLMs power the thinking.
|
697
|
-
- **Hands**: Tools like `PythonTool` do the work.
|
698
|
-
- **Memory**: Ties it all together.
|
699
|
-
|
700
|
-
### Flow Workflows
|
701
|
-
- **Nodes**: Your task blocks.
|
702
|
-
- **Engine**: The maestro of execution.
|
703
|
-
|
704
|
-
### Chat Mode
|
705
|
-
- **Persona**: Customizable conversational style.
|
706
|
-
- **Tools**: Integrated seamlessly via ReAct’s system.
|
707
|
-
- **Context**: Keeps the conversation flowing.
|
708
|
-
|
709
|
-
### Tools Arsenal
|
710
|
-
- **Code**: `PythonTool`, `NodeJsTool`.
|
711
|
-
- **Files**: `ReadFileTool`, `WriteFileTool`.
|
712
|
-
- More in [REFERENCE_TOOLS.md](./REFERENCE_TOOLS.md).
|
713
|
-
|
714
|
-
---
|
715
|
-
|
716
|
-
## Developing with QuantaLogic
|
717
|
-
|
718
|
-
### Setup Your Lab
|
719
|
-
```bash
|
720
|
-
git clone https://github.com/quantalogic/quantalogic.git
|
721
|
-
cd quantalogic
|
722
|
-
python -m venv venv
|
723
|
-
source venv/bin/activate
|
724
|
-
poetry install
|
725
|
-
```
|
726
|
-
|
727
|
-
### Test the Cosmos
|
728
|
-
```bash
|
729
|
-
pytest --cov=quantalogic
|
730
|
-
```
|
731
|
-
|
732
|
-
### Polish It Up
|
733
|
-
```bash
|
734
|
-
ruff format # Shine that code
|
735
|
-
mypy quantalogic # Check types
|
736
|
-
ruff check quantalogic # Lint it
|
737
|
-
```
|
738
|
-
|
739
|
-
### Create Custom Tools
|
740
|
-
The `create_tool()` function transforms any Python function into a reusable Tool:
|
741
|
-
|
742
|
-
```python
|
743
|
-
from quantalogic.tools import create_tool
|
744
|
-
|
745
|
-
def weather_lookup(city: str, country: str = "US") -> dict:
|
746
|
-
"""Retrieve current weather for a given location.
|
747
|
-
|
748
|
-
Args:
|
749
|
-
city: Name of the city to look up
|
750
|
-
country: Two-letter country code (default: US)
|
751
|
-
|
752
|
-
Returns:
|
753
|
-
Dictionary with weather information
|
754
|
-
"""
|
755
|
-
# Implement weather lookup logic here
|
756
|
-
return {"temperature": 22, "condition": "Sunny"}
|
757
|
-
|
758
|
-
# Convert the function to a Tool
|
759
|
-
weather_tool = create_tool(weather_lookup)
|
760
|
-
|
761
|
-
# Now you can use it as a Tool
|
762
|
-
print(weather_tool.to_markdown()) # Generate tool documentation
|
763
|
-
result = weather_tool.execute(city="New York") # Execute as a tool
|
764
|
-
```
|
765
|
-
|
766
|
-
#### Using Custom Tools with ReAct Agent
|
767
|
-
```python
|
768
|
-
from quantalogic import Agent
|
769
|
-
from quantalogic.tools import create_tool, PythonTool
|
770
|
-
|
771
|
-
# Create a custom stock price lookup tool
|
772
|
-
def get_stock_price(symbol: str) -> str:
|
773
|
-
"""Get the current price of a stock by its ticker symbol.
|
774
|
-
|
775
|
-
Args:
|
776
|
-
symbol: Stock ticker symbol (e.g., AAPL, MSFT)
|
777
|
-
|
778
|
-
Returns:
|
779
|
-
Current stock price information
|
780
|
-
"""
|
781
|
-
# In a real implementation, you would fetch from an API
|
782
|
-
prices = {"AAPL": 185.92, "MSFT": 425.27, "GOOGL": 175.43}
|
783
|
-
if symbol in prices:
|
784
|
-
return f"{symbol} is currently trading at ${prices[symbol]}"
|
785
|
-
return f"Could not find price for {symbol}"
|
786
|
-
|
787
|
-
# Create an agent with standard and custom tools
|
788
|
-
agent = Agent(
|
789
|
-
model_name="gpt-4o",
|
790
|
-
tools=[
|
791
|
-
PythonTool(), # Standard Python execution tool
|
792
|
-
create_tool(get_stock_price) # Custom stock price tool
|
793
|
-
]
|
794
|
-
)
|
795
|
-
|
796
|
-
# The agent can now use both tools to solve tasks
|
797
|
-
result = agent.solve_task(
|
798
|
-
"Write a Python function to calculate investment growth, "
|
799
|
-
"then analyze Apple stock's current price"
|
800
|
-
)
|
801
|
-
|
802
|
-
print(result)
|
803
|
-
```
|
804
|
-
|
805
|
-
#### Using Custom Tools in Chat Mode
|
806
|
-
```python
|
807
|
-
from quantalogic import Agent
|
808
|
-
from quantalogic.tools import create_tool
|
809
|
-
|
810
|
-
# Reuse the stock price tool
|
811
|
-
stock_tool = create_tool(get_stock_price)
|
812
|
-
|
813
|
-
# Create a chat agent
|
814
|
-
agent = Agent(
|
815
|
-
model_name="gpt-4o",
|
816
|
-
chat_system_prompt="You are a financial advisor",
|
817
|
-
tools=[stock_tool]
|
818
|
-
)
|
819
|
-
|
820
|
-
# Chat with tool usage
|
821
|
-
response = agent.chat("What’s the price of Microsoft stock?")
|
822
|
-
print(response)
|
823
|
-
# Might output: "Let me check that for you! MSFT is currently trading at $425.27."
|
824
|
-
```
|
825
|
-
|
826
|
-
Key features of `create_tool()`:
|
827
|
-
- 🔧 Automatically converts functions to Tools
|
828
|
-
- 📝 Extracts metadata from function signature and docstring
|
829
|
-
- 🔍 Supports both synchronous and asynchronous functions
|
830
|
-
- 🛠️ Generates tool documentation and validation
|
831
|
-
|
832
|
-
---
|
833
|
-
|
834
|
-
## Contributing
|
835
|
-
|
836
|
-
Join the QuantaLogic galaxy!
|
837
|
-
1. Fork it.
|
838
|
-
2. Branch: `git checkout -b feature/epic-thing`.
|
839
|
-
3. Code + test.
|
840
|
-
4. PR it!
|
841
|
-
|
842
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the full scoop.
|
843
|
-
|
844
|
-
---
|
845
|
-
|
846
|
-
## License
|
847
|
-
|
848
|
-
2024 QuantaLogic Contributors. **Apache 2.0**—free and open. Check [LICENSE](./LICENSE).
|
849
|
-
|
850
|
-
Dreamed up by Raphaël MANSUY, founder of [QuantaLogic](https://www.quantalogic.app).
|
851
|
-
|
852
|
-
---
|
853
|
-
|
854
|
-
## Project Growth
|
855
|
-
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
856
|
-
|
857
|
-
---
|
858
|
-
|
859
|
-
## API Keys and Environment Configuration
|
860
|
-
|
861
|
-
QuantaLogic links to LLMs via API keys—here’s your guide to unlocking the universe!
|
862
|
-
|
863
|
-
### Setting Up Keys
|
864
|
-
Store keys in a `.env` file or export them:
|
865
|
-
```bash
|
866
|
-
echo "OPENAI_API_KEY=sk-your-openai-key" > .env
|
867
|
-
echo "DEEPSEEK_API_KEY=ds-your-deepseek-key" >> .env
|
868
|
-
source .env
|
869
|
-
```
|
870
|
-
|
871
|
-
### The Key Vault: Supported Models
|
872
|
-
| Model Name | Key Variable | What’s It Good For? |
|
873
|
-
|-----------------------------------------|--------------------------|-----------------------------------------------|
|
874
|
-
| `openai/gpt-4o-mini` | `OPENAI_API_KEY` | Speedy, budget-friendly tasks |
|
875
|
-
| `openai/gpt-4o` | `OPENAI_API_KEY` | Heavy-duty reasoning |
|
876
|
-
| `anthropic/claude-3.5-sonnet` | `ANTHROPIC_API_KEY` | Balanced brilliance |
|
877
|
-
| `deepseek/deepseek-chat` | `DEEPSEEK_API_KEY` | Chatty and versatile |
|
878
|
-
| `deepseek/deepseek-reasoner` | `DEEPSEEK_API_KEY` | Deep problem-solving |
|
879
|
-
| `openrouter/deepseek/deepseek-r1` | `OPENROUTER_API_KEY` | Research-grade via OpenRouter |
|
880
|
-
| `mistral/mistral-large-2407` | `MISTRAL_API_KEY` | Multilingual mastery |
|
881
|
-
| `dashscope/qwen-max` | `DASHSCOPE_API_KEY` | Alibaba’s power player |
|
882
|
-
| `lm_studio/mistral-small-24b-instruct-2501` | `LM_STUDIO_API_KEY` | Local LLM action |
|
883
|
-
|
884
|
-
### Local Setup (e.g., LM Studio)
|
885
|
-
```bash
|
886
|
-
export LM_STUDIO_API_BASE="http://localhost:1234/v1"
|
887
|
-
export LM_STUDIO_API_KEY="lm-your-key"
|
888
|
-
```
|
889
|
-
|
890
|
-
### Pro Tips
|
891
|
-
- **Security**: Keep keys in `.env`, not code!
|
892
|
-
- **Extras**: Add `OPENROUTER_REFERRER` for OpenRouter flair.
|
893
|
-
- **More**: Dig into [LiteLLM Docs](https://docs.litellm.ai/docs/).
|
894
|
-
|
895
|
-
---
|
896
|
-
|
897
|
-
## Final Boost
|
898
|
-
|
899
|
-
QuantaLogic is your ticket to AI awesomeness. Install it, play with it—whether solving tasks, crafting workflows, or chatting up a storm—and let’s build something unforgettable together!
|
900
|
-
|