octotoolkit 0.1.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.
- octotoolkit-0.1.0.dist-info/METADATA +427 -0
- octotoolkit-0.1.0.dist-info/RECORD +8 -0
- octotoolkit-0.1.0.dist-info/WHEEL +5 -0
- octotoolkit-0.1.0.dist-info/licenses/LICENSE +21 -0
- octotoolkit-0.1.0.dist-info/licenses/LICENSE-TASKS +395 -0
- octotoolkit-0.1.0.dist-info/top_level.txt +1 -0
- octotools/__init__.py +0 -0
- octotools/solver.py +231 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: octotoolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An effective and easy-to-use agentic framework with extendable tools for complex reasoning.
|
|
5
|
+
Author-email: Pan Lu <lupantech@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://octotools.github.io
|
|
8
|
+
Project-URL: Arxiv, https://arxiv.org/pdf/2502.11271
|
|
9
|
+
Project-URL: Demo, https://huggingface.co/spaces/OctoTools/octotools
|
|
10
|
+
Project-URL: Github, https://github.com/octotools/octotools
|
|
11
|
+
Project-URL: Issues, https://github.com/octotools/octotools/issues
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: LICENSE-TASKS
|
|
18
|
+
Requires-Dist: anthropic==0.40.0
|
|
19
|
+
Requires-Dist: openai==1.75.0
|
|
20
|
+
Requires-Dist: together==1.5.4
|
|
21
|
+
Requires-Dist: google-generativeai==0.8.5
|
|
22
|
+
Requires-Dist: diskcache==5.6.3
|
|
23
|
+
Requires-Dist: easyocr==1.7.2
|
|
24
|
+
Requires-Dist: metapub==0.5.12
|
|
25
|
+
Requires-Dist: pillow==11.1.0
|
|
26
|
+
Requires-Dist: platformdirs==4.3.6
|
|
27
|
+
Requires-Dist: pymed==0.8.9
|
|
28
|
+
Requires-Dist: python-dotenv==1.0.1
|
|
29
|
+
Requires-Dist: sympy==1.13.1
|
|
30
|
+
Requires-Dist: tenacity==9.0.0
|
|
31
|
+
Requires-Dist: transformers==4.49.0
|
|
32
|
+
Requires-Dist: wikipedia==1.4.0
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<a name="readme-top"></a>
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
<img src="https://raw.githubusercontent.com/octotools/octotools/refs/heads/main/assets/octotools.svg" alt="OctoTools Logo" width="100">
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
# OctoTools: An Agentic Framework with Extensible Tools for Complex Reasoning
|
|
43
|
+
|
|
44
|
+
<!-- # <span style="color: #d41544">Octo</span><span style="color: #2176bc">Tools</span>: An Agentic Framework with Extendable Tools for Complex Reasoning -->
|
|
45
|
+
|
|
46
|
+
<!-- <div align="center">
|
|
47
|
+
<h1>
|
|
48
|
+
<span style="display: inline-block;">
|
|
49
|
+
<span style="color: #d41544">Octo</span><span style="color: #2176bc">Tools</span>: An Agentic Framework with Extendable Tools for Complex Reasoning
|
|
50
|
+
</span>
|
|
51
|
+
</h1>
|
|
52
|
+
</div> -->
|
|
53
|
+
|
|
54
|
+
<!--- BADGES: START --->
|
|
55
|
+
[](https://lbesson.mit-license.org/)
|
|
56
|
+
[](https://arxiv.org/abs/2502.11271)
|
|
57
|
+
[](https://huggingface.co/spaces/OctoTools/octotools)
|
|
58
|
+
[](https://www.youtube.com/watch?v=4828sGfx7dk)
|
|
59
|
+
[](https://octotools.github.io/#tool-cards)
|
|
60
|
+
[](https://octotools.github.io/#visualization)
|
|
61
|
+
[](https://x.com/lupantech/status/1892260474320015861)
|
|
62
|
+
[](https://discord.gg/F4x9m7Cf)
|
|
63
|
+
|
|
64
|
+
<!--- BADGES: END --->
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## Updates
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### News
|
|
71
|
+
|
|
72
|
+
- **TBD**: We're excited to collaborate with the community to expand OctoTools to more tools, domains, and beyond! Join our [Discord](https://discord.gg/JQjpHDSM) to get started!
|
|
73
|
+
- **2025-04-17** 🚀: Support for a broader range of LLM engines is available now! See the full list of supported LLM engines [here](https://github.com/octotools/octotools?tab=readme-ov-file#supported-llm-engines).
|
|
74
|
+
- **2025-03-08** 📺: Thrilled to have OctoTools featured in a tutorial by [Discover AI](https://www.youtube.com/@code4AI) at YouTube! Watch the engaging video [here](https://www.youtube.com/watch?v=4828sGfx7dk).
|
|
75
|
+
- **2025-02-16** 📄: Our paper is now available as a preprint on ArXiv! Read it [here](https://arxiv.org/abs/2502.11271)!
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### TODO
|
|
79
|
+
|
|
80
|
+
Stay tuned, we're working on the following:
|
|
81
|
+
|
|
82
|
+
- [X] Add support for Anthropic LLM
|
|
83
|
+
- [X] Add support for Together AI LLM
|
|
84
|
+
- [X] Add support for DeepSeek LLM
|
|
85
|
+
- [X] Add support for Gemini LLM
|
|
86
|
+
- [X] Add support for Grok LLM
|
|
87
|
+
- [ ] Add support for vLLM LLM
|
|
88
|
+
- [ ] Release Python package on PyPI (coming soon!)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Get Started
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### YouTube Tutorial
|
|
95
|
+
|
|
96
|
+
Excited to have a tutorial video for OctoTools covered by [Discover AI](https://www.youtube.com/@code4AI) at YouTube!
|
|
97
|
+
|
|
98
|
+
<div align="center">
|
|
99
|
+
<a href="https://www.youtube.com/watch?v=4828sGfx7dk">
|
|
100
|
+
<img src="https://img.youtube.com/vi/4828sGfx7dk/maxresdefault.jpg" alt="OctoTools Tutorial" width="100%">
|
|
101
|
+
</a>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Introduction
|
|
106
|
+
|
|
107
|
+
We introduce **OctoTools**, a training-free, user-friendly, and easily extensible open-source agentic framework designed to tackle complex reasoning across diverse domains. **OctoTools** introduces standardized **tool cards** to encapsulate tool functionality, a **planner** for both high-level and low-level planning, and an **executor** to carry out tool usage.
|
|
108
|
+
|
|
109
|
+
**Tool cards** define tool-usage metadata and encapsulate heterogeneous tools, enabling training-free integration of new tools without additional training or framework refinement. (2) The **planner** governs both high-level and low-level planning to address the global objective and refine actions step by step. (3) The **executor** instantiates tool calls by generating executable commands and save structured results in the context. The final answer is summarized from the full trajectory in the context. Furthermore, the *task-specific toolset optimization algorithm* learns a beneficial subset of tools for downstream tasks.
|
|
110
|
+
|
|
111
|
+

|
|
112
|
+

|
|
113
|
+
|
|
114
|
+
We validate **OctoTools**’ generality across 16 diverse tasks (including MathVista, MMLU-Pro, MedQA, and GAIA-Text), achieving substantial average accuracy gains of 9.3% over GPT-4o. Furthermore, **OctoTools** also outperforms AutoGen, GPT-Functions and LangChain by up to 10.6% when given the same set of tools.
|
|
115
|
+
|
|
116
|
+
<p align="center">
|
|
117
|
+
<img src="https://raw.githubusercontent.com/octotools/octotools/refs/heads/main/assets/result/main_scores_bar_chart.png" width="50%">
|
|
118
|
+
<!-- Text. -->
|
|
119
|
+
</p>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Supported LLM Engines
|
|
123
|
+
|
|
124
|
+
We support a broad range of LLM engines, including GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro, and more.
|
|
125
|
+
|
|
126
|
+
| Model Family | Engines (Multi-modal) | Engines (Text-Only) | Official Model List |
|
|
127
|
+
|--------------|-------------------|--------------------| -------------------- |
|
|
128
|
+
| OpenAI | `gpt-4-turbo`, `gpt-4o`, `gpt-4o-mini`, `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `o1`, `o3`, `o1-pro`, `o4-mini` | `gpt-3.5-turbo`, `gpt-4`, `o1-mini`, `o3-mini` | [OpenAI Models](https://platform.openai.com/docs/models) |
|
|
129
|
+
| Anthropic | `claude-3-haiku-20240307`, `claude-3-sonnet-20240229`, `claude-3-opus-20240229`, `claude-3-5-sonnet-20240620`, `claude-3-5-sonnet-20241022`, `claude-3-5-haiku-20241022`, `claude-3-7-sonnet-20250219` | | [Anthropic Models](https://docs.anthropic.com/en/docs/about-claude/models/all-models) |
|
|
130
|
+
| TogetherAI | Most multi-modal models, including `meta-llama/Llama-4-Scout-17B-16E-Instruct`, `Qwen/QwQ-32B`, `Qwen/Qwen2-VL-72B-Instruct` | Most text-only models, including `meta-llama/Llama-3-70b-chat-hf`, `Qwen/Qwen2-72B-Instruct` | [TogetherAI Models](https://api.together.ai/models) |
|
|
131
|
+
| DeepSeek | | `deepseek-chat`, `deepseek-reasoner` | [DeepSeek Models](https://api-docs.deepseek.com/quick_start/pricing) |
|
|
132
|
+
| Gemini | `gemini-1.5-pro`, `gemini-1.5-flash-8b`, `gemini-1.5-flash`, `gemini-2.0-flash-lite`, `gemini-2.0-flash`, `gemini-2.5-pro-preview-03-25` | | [Gemini Models](https://ai.google.dev/gemini-api/docs/models) |
|
|
133
|
+
| Grok | `grok-2-vision-1212`, `grok-2-vision`, `grok-2-vision-latest` | `grok-3-mini-fast-beta`, `grok-3-mini-fast`, `grok-3-mini-fast-latest`, `grok-3-mini-beta`, `grok-3-mini`, `grok-3-mini-latest`, `grok-3-fast-beta`, `grok-3-fast`, `grok-3-fast-latest`, `grok-3-beta`, `grok-3`, `grok-3-latest` | [Grok Models](https://docs.x.ai/docs/models#models-and-pricing) |
|
|
134
|
+
<!-- | vllm | Models including | Models including | [vllm Models](https://docs.vllm.ai/en/latest/models/supported_models.html) | -->
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
## Installation
|
|
138
|
+
|
|
139
|
+
Currently, there are two ways to install OctoTools. For most use cases, standard installation would suffice. However, to replicate the [benchmarks](https://github.com/octotools/octotools/tree/main/tasks) mentioned in the original paper and to make your own edits to the code, you would need to several bash scripts from Github. An editable installation is recommended.
|
|
140
|
+
|
|
141
|
+
### 1. Standard Installation
|
|
142
|
+
|
|
143
|
+
Create a conda environment and install the dependencies:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
conda create -n octotools python=3.10
|
|
147
|
+
conda activate octotools
|
|
148
|
+
pip install <TODO: FIND A NAME>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Make `.env` file, and set `OPENAI_API_KEY`, `GOOGLE_API_KEY`, `GOOGLE_CX`, etc. For example:
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
# The content of the .env file
|
|
155
|
+
|
|
156
|
+
# Used for LLM-powered modules and tools
|
|
157
|
+
OPENAI_API_KEY=<your-api-key-here> # If you want to use OpenAI LLM
|
|
158
|
+
ANTHROPIC_API_KEY=<your-api-key-here> # If you want to use Anthropic LLM
|
|
159
|
+
TOGETHER_API_KEY=<your-api-key-here> # If you want to use TogetherAI LLM
|
|
160
|
+
DEEPSEEK_API_KEY=<your-api-key-here> # If you want to use DeepSeek LLM
|
|
161
|
+
GOOGLE_API_KEY=<your-api-key-here> # If you want to use Gemini LLM
|
|
162
|
+
XAI_API_KEY=<your-api-key-here> # If you want to use Grok LLM
|
|
163
|
+
|
|
164
|
+
# Used for the Google Search tool
|
|
165
|
+
GOOGLE_API_KEY=<your-api-key-here>
|
|
166
|
+
GOOGLE_CX=<your-cx-here>
|
|
167
|
+
|
|
168
|
+
# Used for the Advanced Object Detector tool (Optional)
|
|
169
|
+
DINO_KEY=<your-dino-key-here>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Obtain a Google API Key and Google CX according to the [Google Custom Search API](https://developers.google.com/custom-search/v1/overview) documation.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
### 2. Editable Installation
|
|
176
|
+
|
|
177
|
+
Start with a fresh new environment:
|
|
178
|
+
```sh
|
|
179
|
+
conda create -n octotools python=3.10
|
|
180
|
+
conda activate octotools
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Clone the [github repo](https://github.com/octotools/octotools):
|
|
184
|
+
```sh
|
|
185
|
+
git clone https://github.com/octotools/octotools.git
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
In the root directory (the directory that contains ``pyproject.toml``), run the following command:
|
|
189
|
+
```sh
|
|
190
|
+
pip install -e .
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
(Optional) Install `parallel` for running benchmark experiments in parallel:
|
|
194
|
+
|
|
195
|
+
```sh
|
|
196
|
+
sudo apt-get update
|
|
197
|
+
sudo apt-get install parallel
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Test the Default Solver
|
|
201
|
+
|
|
202
|
+
In a brand new folder, paste the following code:
|
|
203
|
+
```py
|
|
204
|
+
from octotools.solver import construct_solver
|
|
205
|
+
|
|
206
|
+
# remember to put your API keys in .env
|
|
207
|
+
import dotenv
|
|
208
|
+
dotenv.load_dotenv()
|
|
209
|
+
|
|
210
|
+
llm_engine_name = "gpt-4o"
|
|
211
|
+
solver = construct_solver(llm_engine_name=llm_engine_name)
|
|
212
|
+
|
|
213
|
+
print(solver.solve("What is the capital of France?"))
|
|
214
|
+
# similarly, you could pass in a photo
|
|
215
|
+
# print(solver.solve("What is the name of this item in French?", image_path="<PATH_TO_IMG>"))
|
|
216
|
+
```
|
|
217
|
+
You should be able to see the output at the end, along with all the intermediate content.
|
|
218
|
+
|
|
219
|
+
A more detailed jupyter notebook tutorial on the pipeline is coming soon. Stay tuned!
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## Test Tools in the Toolbox (Need Test Scripts from Github)
|
|
223
|
+
|
|
224
|
+
Using `Python_Code_Generator_Tool` as an example, test the availability of the tool by running the following:
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
cd src/octotools/tools/python_code_generator
|
|
228
|
+
python tool.py
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Expected output:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
Execution Result: {'printed_output': 'The sum of all the numbers in the list is: 15', 'variables': {'numbers': [1, 2, 3, 4, 5], 'total_sum': 15}}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
You can also test all tools available in the toolbox by running the following:
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
cd src/octotools/tools
|
|
241
|
+
source test_all_tools.sh
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Expected testing log:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
Testing advanced_object_detector...
|
|
248
|
+
✅ advanced_object_detector passed
|
|
249
|
+
|
|
250
|
+
Testing arxiv_paper_searcher...
|
|
251
|
+
✅ arxiv_paper_searcher passed
|
|
252
|
+
|
|
253
|
+
...
|
|
254
|
+
|
|
255
|
+
Testing wikipedia_knowledge_searcher...
|
|
256
|
+
✅ wikipedia_knowledge_searcher passed
|
|
257
|
+
|
|
258
|
+
Done testing all tools
|
|
259
|
+
Failed: 0
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Run Inference on Benchmarks (Need Bash Scripts from Github)
|
|
263
|
+
|
|
264
|
+
Using [CLEVR-Math](https://huggingface.co/datasets/dali-does/clevr-math) as an example, run inference on a benchmark by:
|
|
265
|
+
|
|
266
|
+
```sh
|
|
267
|
+
cd src/octotools/tasks
|
|
268
|
+
|
|
269
|
+
# Run inference from clevr-math using GPT-4 only
|
|
270
|
+
source clevr-math/run_gpt4o.sh
|
|
271
|
+
|
|
272
|
+
# Run inference from clevr-math using the base tool
|
|
273
|
+
source clevr-math/run_octotool_base.sh
|
|
274
|
+
|
|
275
|
+
# Run inference from clevr-math using Octotools with an optimized toolset
|
|
276
|
+
source clevr-math/run_octotools.sh
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
More benchmarks are available in the [tasks](https://octotools.github.io/#tasks).
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## Experiments
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
### Main results
|
|
286
|
+
|
|
287
|
+
To demonstrate the generality of our **OctoTools** framework, we conduct comprehensive evaluations on 16 diverse benchmarks spanning two modalities, five domains, and four reasoning types. These benchmarks encompass a wide range of complex reasoning tasks, including visual understanding, numerical calculation, knowledge retrieval, and multi-step reasoning.
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<p align="center">
|
|
291
|
+
<img src="https://raw.githubusercontent.com/octotools/octotools/refs/heads/main/assets/result/result_table_1.png" width="100%">
|
|
292
|
+
<!-- Text. -->
|
|
293
|
+
</p>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
More results are available in the [paper](https://arxiv.org/pdf/2502.11271) or at the [project page](https://octotools.github.io/).
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
### In-depth analysis
|
|
300
|
+
|
|
301
|
+
We provide a set of in-depth analyses to help you understand the framework. For instance, we visualize the tool usage of **OctoTools** and its baselines from 16 tasks. It turns out that **OctoTools** takes advantage of different external tools to address task-specific challenges. Explore more findings at our [paper](https://arxiv.org/pdf/2502.11271) or the [project page](https://octotools.github.io/#analysis).
|
|
302
|
+
|
|
303
|
+
<a align="center">
|
|
304
|
+
<img src="https://raw.githubusercontent.com/octotools/octotools/refs/heads/main/assets/result/tool_usage_ours_baselines.png" width="100%">
|
|
305
|
+
<!-- Text. -->
|
|
306
|
+
</a>
|
|
307
|
+
|
|
308
|
+
### Example visualizations
|
|
309
|
+
|
|
310
|
+
We provide a set of example visualizations to help you understand the framework. Explore them at the [project page](https://octotools.github.io/#visualization).
|
|
311
|
+
|
|
312
|
+
<p align="center">
|
|
313
|
+
<a href="https://octotools.github.io/#visualization">
|
|
314
|
+
<img src="https://raw.githubusercontent.com/octotools/octotools/refs/heads/main/assets/result/example_visualization.png" width="80%">
|
|
315
|
+
</a>
|
|
316
|
+
</p>
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
## Customize OctoTools
|
|
320
|
+
|
|
321
|
+
The design of each tool card is modular relative to the **OctoTools** framework, enabling users to integrate diverse tools without modifying the underlying framework or agent logic. New tool cards can be added, replaced, or updated with minimal effort, making **OctoTools** robust and extensible as tasks grow in complexity.
|
|
322
|
+
|
|
323
|
+
<p align="center">
|
|
324
|
+
<a href="https://octotools.github.io/#tool_cards">
|
|
325
|
+
<img src="https://raw.githubusercontent.com/octotools/octotools/refs/heads/main/assets/models/tool_cards.png" width="100%">
|
|
326
|
+
</a>
|
|
327
|
+
</p>
|
|
328
|
+
|
|
329
|
+
To customize **OctoTools** for your own tasks:
|
|
330
|
+
|
|
331
|
+
1. **Add a new tool card**: Implement your tool following the structure in [existing tools](https://github.com/OctoTools/OctoTools/tree/main/octotools/tools).
|
|
332
|
+
|
|
333
|
+
2. **Replace or update existing tools**: You can replace or update tools in the toolbox. For example, we provide the [`Object_Detector_Tool`](https://github.com/OctoTools/OctoTools/blob/main/octotools/tools/object_detector/tool.py) to detect objects in images using an open-source model. We also provide an alternative tool called the [`Advanced_Object_Detector_Tool`](https://github.com/OctoTools/OctoTools/blob/main/octotools/tools/advanced_object_detector/tool.py) to detect objects in images using API calls.
|
|
334
|
+
|
|
335
|
+
3. **Enable tools for your tasks**: You can enable the whole toolset or a subset of tools for your own tasks by setting the `enabled_tools` argument in [tasks/solve.py](https://github.com/OctoTools/OctoTools/blob/main/octotools/tasks/solve.py).
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## Resources
|
|
339
|
+
|
|
340
|
+
### Inspiration
|
|
341
|
+
|
|
342
|
+
This project draws inspiration from several remarkable projects:
|
|
343
|
+
|
|
344
|
+
- 📕 [Chameleon](https://github.com/lupantech/chameleon-llm) – Chameleon is an early attempt that augments LLMs with tools, which is a major source of inspiration. A journey of a thousand miles begins with a single step.
|
|
345
|
+
- 📘 [TextGrad](https://github.com/mert-y/textgrad) – We admire and appreciate TextGrad for its innovative and elegant framework design.
|
|
346
|
+
- 📗 [AutoGen](https://github.com/microsoft/autogen) – A trending project that excels in building agentic systems.
|
|
347
|
+
- 📙 [LangChain](https://github.com/langchain-ai/langchain) – A powerful framework for constructing agentic systems, known for its rich functionalities.
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
### Citation
|
|
351
|
+
```bibtex
|
|
352
|
+
@article{lu2025octotools,
|
|
353
|
+
title={OctoTools: An Agentic Framework with Extensible Tools for Complex Reasoning},
|
|
354
|
+
author={Lu, Pan and Chen, Bowen and Liu, Sheng and Thapa, Rahul and Boen, Joseph and Zou, James},
|
|
355
|
+
journal = {arXiv preprint arXiv:2502.11271},
|
|
356
|
+
year={2025}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Our Team
|
|
361
|
+
<table>
|
|
362
|
+
<tbody>
|
|
363
|
+
<tr>
|
|
364
|
+
<td align="center">
|
|
365
|
+
<a href="https://lupantech.github.io/">
|
|
366
|
+
<img src="https://avatars.githubusercontent.com/u/17663606?v=4" width="100;" alt="lupantech"/>
|
|
367
|
+
<br />
|
|
368
|
+
<sub><b>Pan Lu</b></sub>
|
|
369
|
+
</a>
|
|
370
|
+
</td>
|
|
371
|
+
<td align="center">
|
|
372
|
+
<a href="https://bowen118.github.io/">
|
|
373
|
+
<img src="https://bowen118.github.io/assets/img/prof_pic.jpg" width="100;" alt="bowen118"/>
|
|
374
|
+
<br />
|
|
375
|
+
<sub><b>Bowen Chen</b></sub>
|
|
376
|
+
</a>
|
|
377
|
+
</td>
|
|
378
|
+
<td align="center">
|
|
379
|
+
<a href="https://shengliu66.github.io/">
|
|
380
|
+
<img src="https://shengliu66.github.io/profile.jpg" width="100;" alt="shengliu66"/>
|
|
381
|
+
<br />
|
|
382
|
+
<sub><b>Sheng Liu</b></sub>
|
|
383
|
+
</a>
|
|
384
|
+
</td>
|
|
385
|
+
<td align="center">
|
|
386
|
+
<a href="https://rthapa84.github.io/">
|
|
387
|
+
<img src="https://media.licdn.com/dms/image/v2/D5603AQFc9Bdg5VEPxQ/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1683671172066?e=1744848000&v=beta&t=c8FL4wKP0ynJIcB4foStA4G3C4ffkakw9Nm4G8f7-ps" height="100;" alt="rthapa84"/>
|
|
388
|
+
<br />
|
|
389
|
+
<sub><b>Rahul Thapa</b></sub>
|
|
390
|
+
</a>
|
|
391
|
+
</td>
|
|
392
|
+
<td align="center">
|
|
393
|
+
<a href="https://dbds.stanford.edu/people/joseph-boen/">
|
|
394
|
+
<img src="https://dbds.stanford.edu/wp-content/uploads/2023/08/joseph-boen.jpg)" width="100;" alt="josephboen"/>
|
|
395
|
+
<br />
|
|
396
|
+
<sub><b>Joseph Boen</b></sub>
|
|
397
|
+
</a>
|
|
398
|
+
</td>
|
|
399
|
+
<td align="center">
|
|
400
|
+
<a href="https://www.james-zou.com/">
|
|
401
|
+
<img src="https://static.wixstatic.com/media/0f3e8f_cfa7e327b97745ddb8c4a66454b5eb3e~mv2.jpg/v1/fill/w_318,h_446,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/46824428A5822_ForWeb.jpg" height="100;" alt="jameszou"/>
|
|
402
|
+
<br />
|
|
403
|
+
<sub><b>James Zou</b></sub>
|
|
404
|
+
</a>
|
|
405
|
+
</td>
|
|
406
|
+
</tr>
|
|
407
|
+
<tbody>
|
|
408
|
+
</table>
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
### Contributors
|
|
413
|
+
|
|
414
|
+
We are trully looking forward to the open-source contributions to OctoTools! If you are interested in contributing, collaborating, or reporting issues, don't hesitate to contact us!
|
|
415
|
+
|
|
416
|
+
We are also looking forward to your feedback and suggestions!
|
|
417
|
+
|
|
418
|
+
<p align="right" style="font-size: 14px; color: #2176bc; margin-top: 20px;">
|
|
419
|
+
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
|
|
420
|
+
↑ Back to Top ↑
|
|
421
|
+
</a>
|
|
422
|
+
</p>
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
### Star History
|
|
426
|
+
|
|
427
|
+
[](https://www.star-history.com/#octotools/octotools&Date)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
octotoolkit-0.1.0.dist-info/licenses/LICENSE,sha256=7RNExKr4nElB2rvraqUsdG-ucKuapvDLpWekcQwYmZo,1131
|
|
2
|
+
octotoolkit-0.1.0.dist-info/licenses/LICENSE-TASKS,sha256=fnFw486_iKn2DHuEIUGDI8CTBNoa9NXpD02h3ByKJmE,18650
|
|
3
|
+
octotools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
octotools/solver.py,sha256=vdEt3dXlXstMn1EjuJGBYNAkiam_n-53HZcEjdjj7nI,8721
|
|
5
|
+
octotoolkit-0.1.0.dist-info/METADATA,sha256=Gb_uovdhsmAuxZGm3L7sFHwlp1OwEtgTCyT_PfmCmtE,19584
|
|
6
|
+
octotoolkit-0.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
7
|
+
octotoolkit-0.1.0.dist-info/top_level.txt,sha256=DkbKjE_FtQKc9Nk11yd4QgiC51ddKISGlr6bcSlO7Hw,10
|
|
8
|
+
octotoolkit-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Pan Lu.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
Attribution 4.0 International
|
|
2
|
+
|
|
3
|
+
=======================================================================
|
|
4
|
+
|
|
5
|
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
|
6
|
+
does not provide legal services or legal advice. Distribution of
|
|
7
|
+
Creative Commons public licenses does not create a lawyer-client or
|
|
8
|
+
other relationship. Creative Commons makes its licenses and related
|
|
9
|
+
information available on an "as-is" basis. Creative Commons gives no
|
|
10
|
+
warranties regarding its licenses, any material licensed under their
|
|
11
|
+
terms and conditions, or any related information. Creative Commons
|
|
12
|
+
disclaims all liability for damages resulting from their use to the
|
|
13
|
+
fullest extent possible.
|
|
14
|
+
|
|
15
|
+
Using Creative Commons Public Licenses
|
|
16
|
+
|
|
17
|
+
Creative Commons public licenses provide a standard set of terms and
|
|
18
|
+
conditions that creators and other rights holders may use to share
|
|
19
|
+
original works of authorship and other material subject to copyright
|
|
20
|
+
and certain other rights specified in the public license below. The
|
|
21
|
+
following considerations are for informational purposes only, are not
|
|
22
|
+
exhaustive, and do not form part of our licenses.
|
|
23
|
+
|
|
24
|
+
Considerations for licensors: Our public licenses are
|
|
25
|
+
intended for use by those authorized to give the public
|
|
26
|
+
permission to use material in ways otherwise restricted by
|
|
27
|
+
copyright and certain other rights. Our licenses are
|
|
28
|
+
irrevocable. Licensors should read and understand the terms
|
|
29
|
+
and conditions of the license they choose before applying it.
|
|
30
|
+
Licensors should also secure all rights necessary before
|
|
31
|
+
applying our licenses so that the public can reuse the
|
|
32
|
+
material as expected. Licensors should clearly mark any
|
|
33
|
+
material not subject to the license. This includes other CC-
|
|
34
|
+
licensed material, or material used under an exception or
|
|
35
|
+
limitation to copyright. More considerations for licensors:
|
|
36
|
+
wiki.creativecommons.org/Considerations_for_licensors
|
|
37
|
+
|
|
38
|
+
Considerations for the public: By using one of our public
|
|
39
|
+
licenses, a licensor grants the public permission to use the
|
|
40
|
+
licensed material under specified terms and conditions. If
|
|
41
|
+
the licensor's permission is not necessary for any reason--for
|
|
42
|
+
example, because of any applicable exception or limitation to
|
|
43
|
+
copyright--then that use is not regulated by the license. Our
|
|
44
|
+
licenses grant only permissions under copyright and certain
|
|
45
|
+
other rights that a licensor has authority to grant. Use of
|
|
46
|
+
the licensed material may still be restricted for other
|
|
47
|
+
reasons, including because others have copyright or other
|
|
48
|
+
rights in the material. A licensor may make special requests,
|
|
49
|
+
such as asking that all changes be marked or described.
|
|
50
|
+
Although not required by our licenses, you are encouraged to
|
|
51
|
+
respect those requests where reasonable. More_considerations
|
|
52
|
+
for the public:
|
|
53
|
+
wiki.creativecommons.org/Considerations_for_licensees
|
|
54
|
+
|
|
55
|
+
=======================================================================
|
|
56
|
+
|
|
57
|
+
Creative Commons Attribution 4.0 International Public License
|
|
58
|
+
|
|
59
|
+
By exercising the Licensed Rights (defined below), You accept and agree
|
|
60
|
+
to be bound by the terms and conditions of this Creative Commons
|
|
61
|
+
Attribution 4.0 International Public License ("Public License"). To the
|
|
62
|
+
extent this Public License may be interpreted as a contract, You are
|
|
63
|
+
granted the Licensed Rights in consideration of Your acceptance of
|
|
64
|
+
these terms and conditions, and the Licensor grants You such rights in
|
|
65
|
+
consideration of benefits the Licensor receives from making the
|
|
66
|
+
Licensed Material available under these terms and conditions.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Section 1 -- Definitions.
|
|
70
|
+
|
|
71
|
+
a. Adapted Material means material subject to Copyright and Similar
|
|
72
|
+
Rights that is derived from or based upon the Licensed Material
|
|
73
|
+
and in which the Licensed Material is translated, altered,
|
|
74
|
+
arranged, transformed, or otherwise modified in a manner requiring
|
|
75
|
+
permission under the Copyright and Similar Rights held by the
|
|
76
|
+
Licensor. For purposes of this Public License, where the Licensed
|
|
77
|
+
Material is a musical work, performance, or sound recording,
|
|
78
|
+
Adapted Material is always produced where the Licensed Material is
|
|
79
|
+
synched in timed relation with a moving image.
|
|
80
|
+
|
|
81
|
+
b. Adapter's License means the license You apply to Your Copyright
|
|
82
|
+
and Similar Rights in Your contributions to Adapted Material in
|
|
83
|
+
accordance with the terms and conditions of this Public License.
|
|
84
|
+
|
|
85
|
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
|
86
|
+
closely related to copyright including, without limitation,
|
|
87
|
+
performance, broadcast, sound recording, and Sui Generis Database
|
|
88
|
+
Rights, without regard to how the rights are labeled or
|
|
89
|
+
categorized. For purposes of this Public License, the rights
|
|
90
|
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
|
91
|
+
Rights.
|
|
92
|
+
|
|
93
|
+
d. Effective Technological Measures means those measures that, in the
|
|
94
|
+
absence of proper authority, may not be circumvented under laws
|
|
95
|
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
|
96
|
+
Treaty adopted on December 20, 1996, and/or similar international
|
|
97
|
+
agreements.
|
|
98
|
+
|
|
99
|
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
|
100
|
+
any other exception or limitation to Copyright and Similar Rights
|
|
101
|
+
that applies to Your use of the Licensed Material.
|
|
102
|
+
|
|
103
|
+
f. Licensed Material means the artistic or literary work, database,
|
|
104
|
+
or other material to which the Licensor applied this Public
|
|
105
|
+
License.
|
|
106
|
+
|
|
107
|
+
g. Licensed Rights means the rights granted to You subject to the
|
|
108
|
+
terms and conditions of this Public License, which are limited to
|
|
109
|
+
all Copyright and Similar Rights that apply to Your use of the
|
|
110
|
+
Licensed Material and that the Licensor has authority to license.
|
|
111
|
+
|
|
112
|
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
|
113
|
+
under this Public License.
|
|
114
|
+
|
|
115
|
+
i. Share means to provide material to the public by any means or
|
|
116
|
+
process that requires permission under the Licensed Rights, such
|
|
117
|
+
as reproduction, public display, public performance, distribution,
|
|
118
|
+
dissemination, communication, or importation, and to make material
|
|
119
|
+
available to the public including in ways that members of the
|
|
120
|
+
public may access the material from a place and at a time
|
|
121
|
+
individually chosen by them.
|
|
122
|
+
|
|
123
|
+
j. Sui Generis Database Rights means rights other than copyright
|
|
124
|
+
resulting from Directive 96/9/EC of the European Parliament and of
|
|
125
|
+
the Council of 11 March 1996 on the legal protection of databases,
|
|
126
|
+
as amended and/or succeeded, as well as other essentially
|
|
127
|
+
equivalent rights anywhere in the world.
|
|
128
|
+
|
|
129
|
+
k. You means the individual or entity exercising the Licensed Rights
|
|
130
|
+
under this Public License. Your has a corresponding meaning.
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Section 2 -- Scope.
|
|
134
|
+
|
|
135
|
+
a. License grant.
|
|
136
|
+
|
|
137
|
+
1. Subject to the terms and conditions of this Public License,
|
|
138
|
+
the Licensor hereby grants You a worldwide, royalty-free,
|
|
139
|
+
non-sublicensable, non-exclusive, irrevocable license to
|
|
140
|
+
exercise the Licensed Rights in the Licensed Material to:
|
|
141
|
+
|
|
142
|
+
a. reproduce and Share the Licensed Material, in whole or
|
|
143
|
+
in part; and
|
|
144
|
+
|
|
145
|
+
b. produce, reproduce, and Share Adapted Material.
|
|
146
|
+
|
|
147
|
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
|
148
|
+
Exceptions and Limitations apply to Your use, this Public
|
|
149
|
+
License does not apply, and You do not need to comply with
|
|
150
|
+
its terms and conditions.
|
|
151
|
+
|
|
152
|
+
3. Term. The term of this Public License is specified in Section
|
|
153
|
+
6(a).
|
|
154
|
+
|
|
155
|
+
4. Media and formats; technical modifications allowed. The
|
|
156
|
+
Licensor authorizes You to exercise the Licensed Rights in
|
|
157
|
+
all media and formats whether now known or hereafter created,
|
|
158
|
+
and to make technical modifications necessary to do so. The
|
|
159
|
+
Licensor waives and/or agrees not to assert any right or
|
|
160
|
+
authority to forbid You from making technical modifications
|
|
161
|
+
necessary to exercise the Licensed Rights, including
|
|
162
|
+
technical modifications necessary to circumvent Effective
|
|
163
|
+
Technological Measures. For purposes of this Public License,
|
|
164
|
+
simply making modifications authorized by this Section 2(a)
|
|
165
|
+
(4) never produces Adapted Material.
|
|
166
|
+
|
|
167
|
+
5. Downstream recipients.
|
|
168
|
+
|
|
169
|
+
a. Offer from the Licensor -- Licensed Material. Every
|
|
170
|
+
recipient of the Licensed Material automatically
|
|
171
|
+
receives an offer from the Licensor to exercise the
|
|
172
|
+
Licensed Rights under the terms and conditions of this
|
|
173
|
+
Public License.
|
|
174
|
+
|
|
175
|
+
b. No downstream restrictions. You may not offer or impose
|
|
176
|
+
any additional or different terms or conditions on, or
|
|
177
|
+
apply any Effective Technological Measures to, the
|
|
178
|
+
Licensed Material if doing so restricts exercise of the
|
|
179
|
+
Licensed Rights by any recipient of the Licensed
|
|
180
|
+
Material.
|
|
181
|
+
|
|
182
|
+
6. No endorsement. Nothing in this Public License constitutes or
|
|
183
|
+
may be construed as permission to assert or imply that You
|
|
184
|
+
are, or that Your use of the Licensed Material is, connected
|
|
185
|
+
with, or sponsored, endorsed, or granted official status by,
|
|
186
|
+
the Licensor or others designated to receive attribution as
|
|
187
|
+
provided in Section 3(a)(1)(A)(i).
|
|
188
|
+
|
|
189
|
+
b. Other rights.
|
|
190
|
+
|
|
191
|
+
1. Moral rights, such as the right of integrity, are not
|
|
192
|
+
licensed under this Public License, nor are publicity,
|
|
193
|
+
privacy, and/or other similar personality rights; however, to
|
|
194
|
+
the extent possible, the Licensor waives and/or agrees not to
|
|
195
|
+
assert any such rights held by the Licensor to the limited
|
|
196
|
+
extent necessary to allow You to exercise the Licensed
|
|
197
|
+
Rights, but not otherwise.
|
|
198
|
+
|
|
199
|
+
2. Patent and trademark rights are not licensed under this
|
|
200
|
+
Public License.
|
|
201
|
+
|
|
202
|
+
3. To the extent possible, the Licensor waives any right to
|
|
203
|
+
collect royalties from You for the exercise of the Licensed
|
|
204
|
+
Rights, whether directly or through a collecting society
|
|
205
|
+
under any voluntary or waivable statutory or compulsory
|
|
206
|
+
licensing scheme. In all other cases the Licensor expressly
|
|
207
|
+
reserves any right to collect such royalties.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Section 3 -- License Conditions.
|
|
211
|
+
|
|
212
|
+
Your exercise of the Licensed Rights is expressly made subject to the
|
|
213
|
+
following conditions.
|
|
214
|
+
|
|
215
|
+
a. Attribution.
|
|
216
|
+
|
|
217
|
+
1. If You Share the Licensed Material (including in modified
|
|
218
|
+
form), You must:
|
|
219
|
+
|
|
220
|
+
a. retain the following if it is supplied by the Licensor
|
|
221
|
+
with the Licensed Material:
|
|
222
|
+
|
|
223
|
+
i. identification of the creator(s) of the Licensed
|
|
224
|
+
Material and any others designated to receive
|
|
225
|
+
attribution, in any reasonable manner requested by
|
|
226
|
+
the Licensor (including by pseudonym if
|
|
227
|
+
designated);
|
|
228
|
+
|
|
229
|
+
ii. a copyright notice;
|
|
230
|
+
|
|
231
|
+
iii. a notice that refers to this Public License;
|
|
232
|
+
|
|
233
|
+
iv. a notice that refers to the disclaimer of
|
|
234
|
+
warranties;
|
|
235
|
+
|
|
236
|
+
v. a URI or hyperlink to the Licensed Material to the
|
|
237
|
+
extent reasonably practicable;
|
|
238
|
+
|
|
239
|
+
b. indicate if You modified the Licensed Material and
|
|
240
|
+
retain an indication of any previous modifications; and
|
|
241
|
+
|
|
242
|
+
c. indicate the Licensed Material is licensed under this
|
|
243
|
+
Public License, and include the text of, or the URI or
|
|
244
|
+
hyperlink to, this Public License.
|
|
245
|
+
|
|
246
|
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
|
247
|
+
reasonable manner based on the medium, means, and context in
|
|
248
|
+
which You Share the Licensed Material. For example, it may be
|
|
249
|
+
reasonable to satisfy the conditions by providing a URI or
|
|
250
|
+
hyperlink to a resource that includes the required
|
|
251
|
+
information.
|
|
252
|
+
|
|
253
|
+
3. If requested by the Licensor, You must remove any of the
|
|
254
|
+
information required by Section 3(a)(1)(A) to the extent
|
|
255
|
+
reasonably practicable.
|
|
256
|
+
|
|
257
|
+
4. If You Share Adapted Material You produce, the Adapter's
|
|
258
|
+
License You apply must not prevent recipients of the Adapted
|
|
259
|
+
Material from complying with this Public License.
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
Section 4 -- Sui Generis Database Rights.
|
|
263
|
+
|
|
264
|
+
Where the Licensed Rights include Sui Generis Database Rights that
|
|
265
|
+
apply to Your use of the Licensed Material:
|
|
266
|
+
|
|
267
|
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
|
268
|
+
to extract, reuse, reproduce, and Share all or a substantial
|
|
269
|
+
portion of the contents of the database;
|
|
270
|
+
|
|
271
|
+
b. if You include all or a substantial portion of the database
|
|
272
|
+
contents in a database in which You have Sui Generis Database
|
|
273
|
+
Rights, then the database in which You have Sui Generis Database
|
|
274
|
+
Rights (but not its individual contents) is Adapted Material; and
|
|
275
|
+
|
|
276
|
+
c. You must comply with the conditions in Section 3(a) if You Share
|
|
277
|
+
all or a substantial portion of the contents of the database.
|
|
278
|
+
|
|
279
|
+
For the avoidance of doubt, this Section 4 supplements and does not
|
|
280
|
+
replace Your obligations under this Public License where the Licensed
|
|
281
|
+
Rights include other Copyright and Similar Rights.
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
|
285
|
+
|
|
286
|
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
|
287
|
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
|
288
|
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
|
289
|
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
|
290
|
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
|
291
|
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
292
|
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
|
293
|
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
|
294
|
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
|
295
|
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
|
296
|
+
|
|
297
|
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
|
298
|
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
|
299
|
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
|
300
|
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
|
301
|
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
|
302
|
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
|
303
|
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
|
304
|
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
|
305
|
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
|
306
|
+
|
|
307
|
+
c. The disclaimer of warranties and limitation of liability provided
|
|
308
|
+
above shall be interpreted in a manner that, to the extent
|
|
309
|
+
possible, most closely approximates an absolute disclaimer and
|
|
310
|
+
waiver of all liability.
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
Section 6 -- Term and Termination.
|
|
314
|
+
|
|
315
|
+
a. This Public License applies for the term of the Copyright and
|
|
316
|
+
Similar Rights licensed here. However, if You fail to comply with
|
|
317
|
+
this Public License, then Your rights under this Public License
|
|
318
|
+
terminate automatically.
|
|
319
|
+
|
|
320
|
+
b. Where Your right to use the Licensed Material has terminated under
|
|
321
|
+
Section 6(a), it reinstates:
|
|
322
|
+
|
|
323
|
+
1. automatically as of the date the violation is cured, provided
|
|
324
|
+
it is cured within 30 days of Your discovery of the
|
|
325
|
+
violation; or
|
|
326
|
+
|
|
327
|
+
2. upon express reinstatement by the Licensor.
|
|
328
|
+
|
|
329
|
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
|
330
|
+
right the Licensor may have to seek remedies for Your violations
|
|
331
|
+
of this Public License.
|
|
332
|
+
|
|
333
|
+
c. For the avoidance of doubt, the Licensor may also offer the
|
|
334
|
+
Licensed Material under separate terms or conditions or stop
|
|
335
|
+
distributing the Licensed Material at any time; however, doing so
|
|
336
|
+
will not terminate this Public License.
|
|
337
|
+
|
|
338
|
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
|
339
|
+
License.
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
Section 7 -- Other Terms and Conditions.
|
|
343
|
+
|
|
344
|
+
a. The Licensor shall not be bound by any additional or different
|
|
345
|
+
terms or conditions communicated by You unless expressly agreed.
|
|
346
|
+
|
|
347
|
+
b. Any arrangements, understandings, or agreements regarding the
|
|
348
|
+
Licensed Material not stated herein are separate from and
|
|
349
|
+
independent of the terms and conditions of this Public License.
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
Section 8 -- Interpretation.
|
|
353
|
+
|
|
354
|
+
a. For the avoidance of doubt, this Public License does not, and
|
|
355
|
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
|
356
|
+
conditions on any use of the Licensed Material that could lawfully
|
|
357
|
+
be made without permission under this Public License.
|
|
358
|
+
|
|
359
|
+
b. To the extent possible, if any provision of this Public License is
|
|
360
|
+
deemed unenforceable, it shall be automatically reformed to the
|
|
361
|
+
minimum extent necessary to make it enforceable. If the provision
|
|
362
|
+
cannot be reformed, it shall be severed from this Public License
|
|
363
|
+
without affecting the enforceability of the remaining terms and
|
|
364
|
+
conditions.
|
|
365
|
+
|
|
366
|
+
c. No term or condition of this Public License will be waived and no
|
|
367
|
+
failure to comply consented to unless expressly agreed to by the
|
|
368
|
+
Licensor.
|
|
369
|
+
|
|
370
|
+
d. Nothing in this Public License constitutes or may be interpreted
|
|
371
|
+
as a limitation upon, or waiver of, any privileges and immunities
|
|
372
|
+
that apply to the Licensor or You, including from the legal
|
|
373
|
+
processes of any jurisdiction or authority.
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
=======================================================================
|
|
377
|
+
|
|
378
|
+
Creative Commons is not a party to its public
|
|
379
|
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
|
380
|
+
its public licenses to material it publishes and in those instances
|
|
381
|
+
will be considered the “Licensor.” The text of the Creative Commons
|
|
382
|
+
public licenses is dedicated to the public domain under the CC0 Public
|
|
383
|
+
Domain Dedication. Except for the limited purpose of indicating that
|
|
384
|
+
material is shared under a Creative Commons public license or as
|
|
385
|
+
otherwise permitted by the Creative Commons policies published at
|
|
386
|
+
creativecommons.org/policies, Creative Commons does not authorize the
|
|
387
|
+
use of the trademark "Creative Commons" or any other trademark or logo
|
|
388
|
+
of Creative Commons without its prior written consent including,
|
|
389
|
+
without limitation, in connection with any unauthorized modifications
|
|
390
|
+
to any of its public licenses or any other arrangements,
|
|
391
|
+
understandings, or agreements concerning use of licensed material. For
|
|
392
|
+
the avoidance of doubt, this paragraph does not form part of the
|
|
393
|
+
public licenses.
|
|
394
|
+
|
|
395
|
+
Creative Commons may be contacted at creativecommons.org.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
octotools
|
octotools/__init__.py
ADDED
|
File without changes
|
octotools/solver.py
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import json
|
|
4
|
+
import argparse
|
|
5
|
+
import time
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
from octotools.models.initializer import Initializer
|
|
9
|
+
from octotools.models.planner import Planner
|
|
10
|
+
from octotools.models.memory import Memory
|
|
11
|
+
from octotools.models.executor import Executor
|
|
12
|
+
from octotools.models.utils import make_json_serializable_truncated
|
|
13
|
+
|
|
14
|
+
class Solver:
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
planner,
|
|
18
|
+
memory,
|
|
19
|
+
executor,
|
|
20
|
+
output_types: str = "base,final,direct",
|
|
21
|
+
max_steps: int = 10,
|
|
22
|
+
max_time: int = 300,
|
|
23
|
+
max_tokens: int = 4000,
|
|
24
|
+
root_cache_dir: str = "cache"
|
|
25
|
+
):
|
|
26
|
+
self.planner = planner
|
|
27
|
+
self.memory = memory
|
|
28
|
+
self.executor = executor
|
|
29
|
+
self.max_steps = max_steps
|
|
30
|
+
self.max_time = max_time
|
|
31
|
+
self.max_tokens = max_tokens
|
|
32
|
+
self.root_cache_dir = root_cache_dir
|
|
33
|
+
|
|
34
|
+
self.output_types = output_types.lower().split(',')
|
|
35
|
+
assert all(output_type in ["base", "final", "direct"] for output_type in self.output_types), "Invalid output type. Supported types are 'base', 'final', 'direct'."
|
|
36
|
+
|
|
37
|
+
def solve(self, question: str, image_path: Optional[str] = None):
|
|
38
|
+
"""
|
|
39
|
+
Solve a single problem from the benchmark dataset.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
index (int): Index of the problem to solve
|
|
43
|
+
"""
|
|
44
|
+
# Update cache directory for the executor
|
|
45
|
+
self.executor.set_query_cache_dir(self.root_cache_dir)
|
|
46
|
+
|
|
47
|
+
# Initialize json_data with basic problem information
|
|
48
|
+
json_data = {
|
|
49
|
+
"query": question,
|
|
50
|
+
"image": image_path
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Generate base response if requested
|
|
54
|
+
if 'base' in self.output_types:
|
|
55
|
+
base_response = self.planner.generate_base_response(question, image_path, self.max_tokens)
|
|
56
|
+
json_data["base_response"] = base_response
|
|
57
|
+
|
|
58
|
+
# If only base response is needed, save and return
|
|
59
|
+
if set(self.output_types) == {'base'}:
|
|
60
|
+
return json_data
|
|
61
|
+
|
|
62
|
+
# Continue with query analysis and tool execution if final or direct responses are needed
|
|
63
|
+
if {'final', 'direct'} & set(self.output_types):
|
|
64
|
+
|
|
65
|
+
# Analyze query
|
|
66
|
+
query_analysis = self.planner.analyze_query(question, image_path)
|
|
67
|
+
json_data["query_analysis"] = query_analysis
|
|
68
|
+
|
|
69
|
+
start_time = time.time()
|
|
70
|
+
step_count = 0
|
|
71
|
+
action_times = []
|
|
72
|
+
|
|
73
|
+
# Main execution loop
|
|
74
|
+
while step_count < self.max_steps and (time.time() - start_time) < self.max_time:
|
|
75
|
+
step_count += 1
|
|
76
|
+
|
|
77
|
+
# Generate next step
|
|
78
|
+
start_time_step = time.time()
|
|
79
|
+
next_step = self.planner.generate_next_step(
|
|
80
|
+
question,
|
|
81
|
+
image_path,
|
|
82
|
+
query_analysis,
|
|
83
|
+
self.memory,
|
|
84
|
+
step_count,
|
|
85
|
+
self.max_steps
|
|
86
|
+
)
|
|
87
|
+
context, sub_goal, tool_name = self.planner.extract_context_subgoal_and_tool(next_step)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if tool_name is None or tool_name not in self.planner.available_tools:
|
|
91
|
+
print(f"Error: Tool '{tool_name}' is not available or not found.")
|
|
92
|
+
command = "Not command is generated due to the tool not found."
|
|
93
|
+
result = "Not result is generated due to the tool not found."
|
|
94
|
+
|
|
95
|
+
else:
|
|
96
|
+
# Generate the tool command
|
|
97
|
+
tool_command = self.executor.generate_tool_command(
|
|
98
|
+
question,
|
|
99
|
+
image_path,
|
|
100
|
+
context,
|
|
101
|
+
sub_goal,
|
|
102
|
+
tool_name,
|
|
103
|
+
self.planner.toolbox_metadata[tool_name]
|
|
104
|
+
)
|
|
105
|
+
explanation, command = self.executor.extract_explanation_and_command(tool_command)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# Execute the tool command
|
|
109
|
+
result = self.executor.execute_tool_command(tool_name, command)
|
|
110
|
+
print("!!! type of result: ", type(result))
|
|
111
|
+
|
|
112
|
+
result = make_json_serializable_truncated(result) # Convert to JSON serializable format
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# Track execution time
|
|
116
|
+
end_time_step = time.time()
|
|
117
|
+
execution_time_step = round(end_time_step - start_time_step, 2)
|
|
118
|
+
action_times.append(execution_time_step)
|
|
119
|
+
|
|
120
|
+
# Update memory
|
|
121
|
+
self.memory.add_action(step_count, tool_name, sub_goal, command, result)
|
|
122
|
+
memeory_actions = self.memory.get_actions()
|
|
123
|
+
|
|
124
|
+
# Verify memory
|
|
125
|
+
stop_verification = self.planner.verificate_context(
|
|
126
|
+
question,
|
|
127
|
+
image_path,
|
|
128
|
+
query_analysis,
|
|
129
|
+
self.memory
|
|
130
|
+
)
|
|
131
|
+
conclusion = self.planner.extract_conclusion(stop_verification)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
if conclusion == 'STOP':
|
|
135
|
+
break
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# Add memory and statistics to json_data
|
|
139
|
+
json_data.update({
|
|
140
|
+
"memory": memeory_actions,
|
|
141
|
+
"step_count": step_count,
|
|
142
|
+
"execution_time": round(time.time() - start_time, 2),
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
# Generate final output if requested
|
|
146
|
+
if 'final' in self.output_types:
|
|
147
|
+
final_output = self.planner.generate_final_output(question, image_path, self.memory)
|
|
148
|
+
json_data["final_output"] = final_output
|
|
149
|
+
|
|
150
|
+
# Generate direct output if requested
|
|
151
|
+
if 'direct' in self.output_types:
|
|
152
|
+
direct_output = self.planner.generate_direct_output(question, image_path, self.memory)
|
|
153
|
+
json_data["direct_output"] = direct_output
|
|
154
|
+
|
|
155
|
+
return json_data
|
|
156
|
+
|
|
157
|
+
def parse_arguments():
|
|
158
|
+
parser = argparse.ArgumentParser(description="Run the octotools demo with specified parameters.")
|
|
159
|
+
parser.add_argument("--llm_engine_name", default="gpt-4o", help="LLM engine name.")
|
|
160
|
+
parser.add_argument(
|
|
161
|
+
"--output_types",
|
|
162
|
+
default="base,final,direct",
|
|
163
|
+
help="Comma-separated list of required outputs (base,final,direct)"
|
|
164
|
+
)
|
|
165
|
+
parser.add_argument("--enabled_tools", default="Generalist_Solution_Generator_Tool", help="List of enabled tools.")
|
|
166
|
+
parser.add_argument("--root_cache_dir", default="solver_cache", help="Path to solver cache directory.")
|
|
167
|
+
parser.add_argument("--max_tokens", type=int, default=4000, help="Maximum tokens for LLM generation.")
|
|
168
|
+
parser.add_argument("--max_steps", type=int, default=10, help="Maximum number of steps to execute.")
|
|
169
|
+
parser.add_argument("--max_time", type=int, default=300, help="Maximum time allowed in seconds.")
|
|
170
|
+
parser.add_argument("--verbose", type=bool, default=True, help="Enable verbose output.")
|
|
171
|
+
return parser.parse_args()
|
|
172
|
+
|
|
173
|
+
def construct_solver(llm_engine_name : str = "gpt-4o",
|
|
174
|
+
enabled_tools : list[str] = ["all"],
|
|
175
|
+
output_types : str = "direct",
|
|
176
|
+
max_steps : int = 10,
|
|
177
|
+
max_time : int = 300,
|
|
178
|
+
max_tokens : int = 4000,
|
|
179
|
+
root_cache_dir : str = "solver_cache"
|
|
180
|
+
):
|
|
181
|
+
# Instantiate Initializer
|
|
182
|
+
initializer = Initializer(
|
|
183
|
+
enabled_tools=enabled_tools,
|
|
184
|
+
model_string=llm_engine_name
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# Instantiate Planner
|
|
188
|
+
planner = Planner(
|
|
189
|
+
llm_engine_name=llm_engine_name,
|
|
190
|
+
toolbox_metadata=initializer.toolbox_metadata,
|
|
191
|
+
available_tools=initializer.available_tools,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
# Instantiate Memory
|
|
195
|
+
memory = Memory()
|
|
196
|
+
|
|
197
|
+
# Instantiate Executor
|
|
198
|
+
executor = Executor(
|
|
199
|
+
llm_engine_name=llm_engine_name,
|
|
200
|
+
root_cache_dir=root_cache_dir
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# Instantiate Solver
|
|
205
|
+
solver = Solver(
|
|
206
|
+
planner=planner,
|
|
207
|
+
memory=memory,
|
|
208
|
+
executor=executor,
|
|
209
|
+
output_types=output_types,
|
|
210
|
+
max_steps=max_steps,
|
|
211
|
+
max_time=max_time,
|
|
212
|
+
max_tokens=max_tokens,
|
|
213
|
+
root_cache_dir=root_cache_dir
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
return solver
|
|
217
|
+
|
|
218
|
+
def main(args):
|
|
219
|
+
solver = construct_solver(llm_engine_name=args.llm_engine_name,
|
|
220
|
+
enabled_tools=args.enabled_tools,
|
|
221
|
+
output_types=args.output_types,
|
|
222
|
+
max_steps=args.max_steps,
|
|
223
|
+
max_time=args.max_time,
|
|
224
|
+
max_tokens=args.max_tokens,
|
|
225
|
+
root_cache_dir=args.root_cache_dir)
|
|
226
|
+
# Solve the task or problem
|
|
227
|
+
solver.solve("What is the capital of France?")
|
|
228
|
+
|
|
229
|
+
if __name__ == "__main__":
|
|
230
|
+
args = parse_arguments()
|
|
231
|
+
main(args)
|