flowllm 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.
- flowllm-0.1.0.dist-info/METADATA +597 -0
- flowllm-0.1.0.dist-info/RECORD +66 -0
- flowllm-0.1.0.dist-info/WHEEL +5 -0
- flowllm-0.1.0.dist-info/entry_points.txt +3 -0
- flowllm-0.1.0.dist-info/licenses/LICENSE +201 -0
- flowllm-0.1.0.dist-info/top_level.txt +1 -0
- llmflow/__init__.py +0 -0
- llmflow/app.py +53 -0
- llmflow/config/__init__.py +0 -0
- llmflow/config/config_parser.py +80 -0
- llmflow/config/mock_config.yaml +58 -0
- llmflow/embedding_model/__init__.py +5 -0
- llmflow/embedding_model/base_embedding_model.py +104 -0
- llmflow/embedding_model/openai_compatible_embedding_model.py +95 -0
- llmflow/enumeration/__init__.py +0 -0
- llmflow/enumeration/agent_state.py +8 -0
- llmflow/enumeration/chunk_enum.py +9 -0
- llmflow/enumeration/http_enum.py +9 -0
- llmflow/enumeration/role.py +8 -0
- llmflow/llm/__init__.py +5 -0
- llmflow/llm/base_llm.py +138 -0
- llmflow/llm/openai_compatible_llm.py +283 -0
- llmflow/mcp_server.py +110 -0
- llmflow/op/__init__.py +10 -0
- llmflow/op/base_op.py +125 -0
- llmflow/op/mock_op.py +40 -0
- llmflow/op/prompt_mixin.py +74 -0
- llmflow/op/react/__init__.py +0 -0
- llmflow/op/react/react_v1_op.py +88 -0
- llmflow/op/react/react_v1_prompt.yaml +28 -0
- llmflow/op/vector_store/__init__.py +13 -0
- llmflow/op/vector_store/recall_vector_store_op.py +48 -0
- llmflow/op/vector_store/update_vector_store_op.py +28 -0
- llmflow/op/vector_store/vector_store_action_op.py +46 -0
- llmflow/pipeline/__init__.py +0 -0
- llmflow/pipeline/pipeline.py +94 -0
- llmflow/pipeline/pipeline_context.py +37 -0
- llmflow/schema/__init__.py +0 -0
- llmflow/schema/app_config.py +69 -0
- llmflow/schema/experience.py +144 -0
- llmflow/schema/message.py +68 -0
- llmflow/schema/request.py +32 -0
- llmflow/schema/response.py +29 -0
- llmflow/schema/vector_node.py +11 -0
- llmflow/service/__init__.py +0 -0
- llmflow/service/llmflow_service.py +96 -0
- llmflow/tool/__init__.py +9 -0
- llmflow/tool/base_tool.py +80 -0
- llmflow/tool/code_tool.py +43 -0
- llmflow/tool/dashscope_search_tool.py +162 -0
- llmflow/tool/mcp_tool.py +77 -0
- llmflow/tool/tavily_search_tool.py +109 -0
- llmflow/tool/terminate_tool.py +23 -0
- llmflow/utils/__init__.py +0 -0
- llmflow/utils/common_utils.py +17 -0
- llmflow/utils/file_handler.py +25 -0
- llmflow/utils/http_client.py +156 -0
- llmflow/utils/op_utils.py +102 -0
- llmflow/utils/registry.py +33 -0
- llmflow/utils/singleton.py +9 -0
- llmflow/utils/timer.py +53 -0
- llmflow/vector_store/__init__.py +7 -0
- llmflow/vector_store/base_vector_store.py +136 -0
- llmflow/vector_store/chroma_vector_store.py +188 -0
- llmflow/vector_store/es_vector_store.py +227 -0
- llmflow/vector_store/file_vector_store.py +163 -0
@@ -0,0 +1,597 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: flowllm
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: build llm flow
|
5
|
+
License: Apache License
|
6
|
+
Version 2.0, January 2004
|
7
|
+
http://www.apache.org/licenses/
|
8
|
+
|
9
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
10
|
+
|
11
|
+
1. Definitions.
|
12
|
+
|
13
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
14
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
15
|
+
|
16
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
17
|
+
the copyright owner that is granting the License.
|
18
|
+
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
20
|
+
other entities that control, are controlled by, or are under common
|
21
|
+
control with that entity. For the purposes of this definition,
|
22
|
+
"control" means (i) the power, direct or indirect, to cause the
|
23
|
+
direction or management of such entity, whether by contract or
|
24
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
25
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
26
|
+
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
28
|
+
exercising permissions granted by this License.
|
29
|
+
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
31
|
+
including but not limited to software source code, documentation
|
32
|
+
source, and configuration files.
|
33
|
+
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
35
|
+
transformation or translation of a Source form, including but
|
36
|
+
not limited to compiled object code, generated documentation,
|
37
|
+
and conversions to other media types.
|
38
|
+
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or
|
40
|
+
Object form, made available under the License, as indicated by a
|
41
|
+
copyright notice that is included in or attached to the work
|
42
|
+
(an example is provided in the Appendix below).
|
43
|
+
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
47
|
+
represent, as a whole, an original work of authorship. For the purposes
|
48
|
+
of this License, Derivative Works shall not include works that remain
|
49
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
50
|
+
the Work and Derivative Works thereof.
|
51
|
+
|
52
|
+
"Contribution" shall mean any work of authorship, including
|
53
|
+
the original version of the Work and any modifications or additions
|
54
|
+
to that Work or Derivative Works thereof, that is intentionally
|
55
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
56
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
57
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
58
|
+
means any form of electronic, verbal, or written communication sent
|
59
|
+
to the Licensor or its representatives, including but not limited to
|
60
|
+
communication on electronic mailing lists, source code control systems,
|
61
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
62
|
+
Licensor for the purpose of discussing and improving the Work, but
|
63
|
+
excluding communication that is conspicuously marked or otherwise
|
64
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
65
|
+
|
66
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
67
|
+
on behalf of whom a Contribution has been received by Licensor and
|
68
|
+
subsequently incorporated within the Work.
|
69
|
+
|
70
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
73
|
+
copyright license to reproduce, prepare Derivative Works of,
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the
|
75
|
+
Work and such Derivative Works in Source or Object form.
|
76
|
+
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
82
|
+
where such license applies only to those patent claims licensable
|
83
|
+
by such Contributor that are necessarily infringed by their
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
86
|
+
institute patent litigation against any entity (including a
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
88
|
+
or a Contribution incorporated within the Work constitutes direct
|
89
|
+
or contributory patent infringement, then any patent licenses
|
90
|
+
granted to You under this License for that Work shall terminate
|
91
|
+
as of the date such litigation is filed.
|
92
|
+
|
93
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
94
|
+
Work or Derivative Works thereof in any medium, with or without
|
95
|
+
modifications, and in Source or Object form, provided that You
|
96
|
+
meet the following conditions:
|
97
|
+
|
98
|
+
(a) You must give any other recipients of the Work or
|
99
|
+
Derivative Works a copy of this License; and
|
100
|
+
|
101
|
+
(b) You must cause any modified files to carry prominent notices
|
102
|
+
stating that You changed the files; and
|
103
|
+
|
104
|
+
(c) You must retain, in the Source form of any Derivative Works
|
105
|
+
that You distribute, all copyright, patent, trademark, and
|
106
|
+
attribution notices from the Source form of the Work,
|
107
|
+
excluding those notices that do not pertain to any part of
|
108
|
+
the Derivative Works; and
|
109
|
+
|
110
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
111
|
+
distribution, then any Derivative Works that You distribute must
|
112
|
+
include a readable copy of the attribution notices contained
|
113
|
+
within such NOTICE file, excluding those notices that do not
|
114
|
+
pertain to any part of the Derivative Works, in at least one
|
115
|
+
of the following places: within a NOTICE text file distributed
|
116
|
+
as part of the Derivative Works; within the Source form or
|
117
|
+
documentation, if provided along with the Derivative Works; or,
|
118
|
+
within a display generated by the Derivative Works, if and
|
119
|
+
wherever such third-party notices normally appear. The contents
|
120
|
+
of the NOTICE file are for informational purposes only and
|
121
|
+
do not modify the License. You may add Your own attribution
|
122
|
+
notices within Derivative Works that You distribute, alongside
|
123
|
+
or as an addendum to the NOTICE text from the Work, provided
|
124
|
+
that such additional attribution notices cannot be construed
|
125
|
+
as modifying the License.
|
126
|
+
|
127
|
+
You may add Your own copyright statement to Your modifications and
|
128
|
+
may provide additional or different license terms and conditions
|
129
|
+
for use, reproduction, or distribution of Your modifications, or
|
130
|
+
for any such Derivative Works as a whole, provided Your use,
|
131
|
+
reproduction, and distribution of the Work otherwise complies with
|
132
|
+
the conditions stated in this License.
|
133
|
+
|
134
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
135
|
+
any Contribution intentionally submitted for inclusion in the Work
|
136
|
+
by You to the Licensor shall be under the terms and conditions of
|
137
|
+
this License, without any additional terms or conditions.
|
138
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
139
|
+
the terms of any separate license agreement you may have executed
|
140
|
+
with Licensor regarding such Contributions.
|
141
|
+
|
142
|
+
6. Trademarks. This License does not grant permission to use the trade
|
143
|
+
names, trademarks, service marks, or product names of the Licensor,
|
144
|
+
except as required for reasonable and customary use in describing the
|
145
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
146
|
+
|
147
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
148
|
+
agreed to in writing, Licensor provides the Work (and each
|
149
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
151
|
+
implied, including, without limitation, any warranties or conditions
|
152
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
153
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
154
|
+
appropriateness of using or redistributing the Work and assume any
|
155
|
+
risks associated with Your exercise of permissions under this License.
|
156
|
+
|
157
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
158
|
+
whether in tort (including negligence), contract, or otherwise,
|
159
|
+
unless required by applicable law (such as deliberate and grossly
|
160
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
161
|
+
liable to You for damages, including any direct, indirect, special,
|
162
|
+
incidental, or consequential damages of any character arising as a
|
163
|
+
result of this License or out of the use or inability to use the
|
164
|
+
Work (including but not limited to damages for loss of goodwill,
|
165
|
+
work stoppage, computer failure or malfunction, or any and all
|
166
|
+
other commercial damages or losses), even if such Contributor
|
167
|
+
has been advised of the possibility of such damages.
|
168
|
+
|
169
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
170
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
171
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
172
|
+
or other liability obligations and/or rights consistent with this
|
173
|
+
License. However, in accepting such obligations, You may act only
|
174
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
175
|
+
of any other Contributor, and only if You agree to indemnify,
|
176
|
+
defend, and hold each Contributor harmless for any liability
|
177
|
+
incurred by, or claims asserted against, such Contributor by reason
|
178
|
+
of your accepting any such warranty or additional liability.
|
179
|
+
|
180
|
+
END OF TERMS AND CONDITIONS
|
181
|
+
|
182
|
+
APPENDIX: How to apply the Apache License to your work.
|
183
|
+
|
184
|
+
To apply the Apache License to your work, attach the following
|
185
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
186
|
+
replaced with your own identifying information. (Don't include
|
187
|
+
the brackets!) The text should be enclosed in the appropriate
|
188
|
+
comment syntax for the file format. We also recommend that a
|
189
|
+
file or class name and description of purpose be included on the
|
190
|
+
same "printed page" as the copyright notice for easier
|
191
|
+
identification within third-party archives.
|
192
|
+
|
193
|
+
Copyright 2024 Alibaba Group
|
194
|
+
|
195
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
196
|
+
you may not use this file except in compliance with the License.
|
197
|
+
You may obtain a copy of the License at
|
198
|
+
|
199
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
200
|
+
|
201
|
+
Unless required by applicable law or agreed to in writing, software
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
203
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
204
|
+
See the License for the specific language governing permissions and
|
205
|
+
limitations under the License.
|
206
|
+
|
207
|
+
Classifier: Programming Language :: Python :: 3
|
208
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
209
|
+
Classifier: Operating System :: OS Independent
|
210
|
+
Requires-Python: >=3.12
|
211
|
+
Description-Content-Type: text/markdown
|
212
|
+
License-File: LICENSE
|
213
|
+
Requires-Dist: dashscope>=1.19.1
|
214
|
+
Requires-Dist: elasticsearch>=8.14.0
|
215
|
+
Requires-Dist: fastapi>=0.115.13
|
216
|
+
Requires-Dist: fastmcp>=2.10.6
|
217
|
+
Requires-Dist: loguru>=0.7.3
|
218
|
+
Requires-Dist: mcp>=1.9.4
|
219
|
+
Requires-Dist: numpy>=2.3.0
|
220
|
+
Requires-Dist: openai>=1.88.0
|
221
|
+
Requires-Dist: pydantic>=2.11.7
|
222
|
+
Requires-Dist: PyYAML>=6.0.2
|
223
|
+
Requires-Dist: Requests>=2.32.4
|
224
|
+
Requires-Dist: uvicorn>=0.34.3
|
225
|
+
Requires-Dist: setuptools>=75.0
|
226
|
+
Dynamic: license-file
|
227
|
+
|
228
|
+
# LLMFlow
|
229
|
+
|
230
|
+
[](https://www.python.org/downloads/)
|
231
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
232
|
+
|
233
|
+
LLMFlow is a flexible large language model workflow framework that provides a modular pipeline architecture for building complex AI applications. The framework supports multiple LLM providers, vector storage backends, and tool integrations, enabling you to easily build Retrieval-Augmented Generation (RAG), intelligent agents, and other AI-powered applications.
|
234
|
+
|
235
|
+
## ๐ Key Features
|
236
|
+
|
237
|
+
### ๐ง Modular Architecture
|
238
|
+
- **Pipeline System**: Flexible pipeline configuration supporting both serial and parallel operations
|
239
|
+
- **Operation Registry**: Extensible operation registry with support for custom operations
|
240
|
+
- **Configuration-Driven**: Manage entire applications through YAML configuration files
|
241
|
+
|
242
|
+
### ๐ค LLM Support
|
243
|
+
- **Multi-Provider Compatible**: Support for OpenAI-compatible APIs
|
244
|
+
- **Streaming Responses**: Real-time streaming output support
|
245
|
+
- **Tool Calling**: Built-in tool calling and parallel execution support
|
246
|
+
- **Reasoning Mode**: Chain-of-thought reasoning support
|
247
|
+
|
248
|
+
### ๐ Vector Storage
|
249
|
+
- **Multi-Backend Support**:
|
250
|
+
- Elasticsearch
|
251
|
+
- ChromaDB
|
252
|
+
- Local file storage
|
253
|
+
- **Embedding Models**: Support for multiple embedding models
|
254
|
+
- **Workspace Management**: Multi-tenant vector storage management
|
255
|
+
|
256
|
+
### ๐ ๏ธ Rich Tool Ecosystem
|
257
|
+
- **Code Execution**: Python code execution tool
|
258
|
+
- **Web Search**: Integrated Tavily and DashScope search
|
259
|
+
- **MCP Protocol**: Model Context Protocol support
|
260
|
+
- **Termination Control**: Intelligent conversation termination management
|
261
|
+
|
262
|
+
### ๐ API Services
|
263
|
+
- **RESTful API**: FastAPI-powered HTTP services
|
264
|
+
- **MCP Server**: Model Context Protocol server support
|
265
|
+
- **Multiple Endpoints**: Retriever, summarizer, vector store, agent APIs
|
266
|
+
|
267
|
+
## ๐ฆ Installation
|
268
|
+
|
269
|
+
### Prerequisites
|
270
|
+
- Python 3.12+
|
271
|
+
- pip or poetry
|
272
|
+
|
273
|
+
### Installation Steps
|
274
|
+
|
275
|
+
```bash
|
276
|
+
# Clone the repository
|
277
|
+
git clone https://github.com/your-username/llmflow.git
|
278
|
+
cd llmflow
|
279
|
+
|
280
|
+
# Install dependencies
|
281
|
+
pip install -e .
|
282
|
+
|
283
|
+
# Or using poetry
|
284
|
+
poetry install
|
285
|
+
```
|
286
|
+
|
287
|
+
### Environment Configuration
|
288
|
+
|
289
|
+
Copy the environment template:
|
290
|
+
```bash
|
291
|
+
cp example.env .env
|
292
|
+
```
|
293
|
+
|
294
|
+
Edit the `.env` file to configure necessary API keys:
|
295
|
+
|
296
|
+
```bash
|
297
|
+
# LLM Configuration
|
298
|
+
LLM_API_KEY=sk-your-llm-api-key
|
299
|
+
LLM_BASE_URL=https://your-llm-endpoint/v1
|
300
|
+
|
301
|
+
# Embedding Model Configuration
|
302
|
+
EMBEDDING_API_KEY=sk-your-embedding-api-key
|
303
|
+
EMBEDDING_BASE_URL=https://your-embedding-endpoint/v1
|
304
|
+
|
305
|
+
# Elasticsearch (Optional)
|
306
|
+
ES_HOSTS=http://localhost:9200
|
307
|
+
|
308
|
+
# DashScope Search (Optional)
|
309
|
+
DASHSCOPE_API_KEY=sk-your-dashscope-key
|
310
|
+
```
|
311
|
+
|
312
|
+
## ๐ Quick Start
|
313
|
+
|
314
|
+
### 1. Start HTTP Service
|
315
|
+
|
316
|
+
```bash
|
317
|
+
llmflow \
|
318
|
+
http_service.port=8001 \
|
319
|
+
llm.default.model_name=qwen3-32b \
|
320
|
+
embedding_model.default.model_name=text-embedding-v4 \
|
321
|
+
vector_store.default.backend=local_file
|
322
|
+
```
|
323
|
+
|
324
|
+
### 2. Start MCP Server
|
325
|
+
|
326
|
+
```bash
|
327
|
+
llmflow_mcp \
|
328
|
+
mcp_transport=stdio \
|
329
|
+
http_service.port=8001 \
|
330
|
+
llm.default.model_name=qwen3-32b \
|
331
|
+
embedding_model.default.model_name=text-embedding-v4 \
|
332
|
+
vector_store.default.backend=local_file
|
333
|
+
```
|
334
|
+
|
335
|
+
### 3. API Usage Examples
|
336
|
+
|
337
|
+
#### Retriever API
|
338
|
+
```python
|
339
|
+
import requests
|
340
|
+
|
341
|
+
response = requests.post('http://localhost:8001/retriever', json={
|
342
|
+
"query": "What is artificial intelligence?",
|
343
|
+
"top_k": 5,
|
344
|
+
"workspace_id": "default",
|
345
|
+
"config": {}
|
346
|
+
})
|
347
|
+
print(response.json())
|
348
|
+
```
|
349
|
+
|
350
|
+
#### Agent API
|
351
|
+
```python
|
352
|
+
response = requests.post('http://localhost:8001/agent', json={
|
353
|
+
"query": "Help me search for the latest AI technology trends",
|
354
|
+
"workspace_id": "default",
|
355
|
+
"config": {}
|
356
|
+
})
|
357
|
+
print(response.json())
|
358
|
+
```
|
359
|
+
|
360
|
+
## โ๏ธ Configuration Guide
|
361
|
+
|
362
|
+
### Pipeline Configuration Syntax
|
363
|
+
|
364
|
+
LLMFlow uses an intuitive string syntax to define operation pipelines:
|
365
|
+
|
366
|
+
```yaml
|
367
|
+
api:
|
368
|
+
# Serial execution: op1 -> op2 -> op3
|
369
|
+
retriever: recall_vector_store_op->summarizer_op
|
370
|
+
|
371
|
+
# Parallel execution: [op1 | op2] runs in parallel
|
372
|
+
summarizer: mock1_op->[mock4_op->mock2_op|mock5_op]->mock3_op
|
373
|
+
|
374
|
+
# Mixed mode: combination of serial and parallel
|
375
|
+
agent: react_v1_op
|
376
|
+
```
|
377
|
+
|
378
|
+
### Complete Configuration Example
|
379
|
+
|
380
|
+
```yaml
|
381
|
+
# HTTP Service Configuration
|
382
|
+
http_service:
|
383
|
+
host: "0.0.0.0"
|
384
|
+
port: 8001
|
385
|
+
timeout_keep_alive: 600
|
386
|
+
limit_concurrency: 64
|
387
|
+
|
388
|
+
# Thread Pool Configuration
|
389
|
+
thread_pool:
|
390
|
+
max_workers: 10
|
391
|
+
|
392
|
+
# API Pipeline Definitions
|
393
|
+
api:
|
394
|
+
retriever: recall_vector_store_op
|
395
|
+
summarizer: update_vector_store_op
|
396
|
+
vector_store: vector_store_action_op
|
397
|
+
agent: react_v1_op
|
398
|
+
|
399
|
+
# Operation Configuration
|
400
|
+
op:
|
401
|
+
react_v1_op:
|
402
|
+
backend: react_v1_op
|
403
|
+
llm: default
|
404
|
+
params:
|
405
|
+
max_steps: 10
|
406
|
+
tool_names: "code_tool,tavily_search_tool,terminate_tool"
|
407
|
+
|
408
|
+
# LLM Configuration
|
409
|
+
llm:
|
410
|
+
default:
|
411
|
+
backend: openai_compatible
|
412
|
+
model_name: qwen3-32b
|
413
|
+
params:
|
414
|
+
temperature: 0.6
|
415
|
+
max_retries: 5
|
416
|
+
|
417
|
+
# Embedding Model Configuration
|
418
|
+
embedding_model:
|
419
|
+
default:
|
420
|
+
backend: openai_compatible
|
421
|
+
model_name: text-embedding-v4
|
422
|
+
params:
|
423
|
+
dimensions: 1024
|
424
|
+
|
425
|
+
# Vector Store Configuration
|
426
|
+
vector_store:
|
427
|
+
default:
|
428
|
+
backend: local_file # or elasticsearch, chroma
|
429
|
+
embedding_model: default
|
430
|
+
params:
|
431
|
+
store_dir: "./vector_store_data"
|
432
|
+
```
|
433
|
+
|
434
|
+
## ๐งฉ Architecture Design
|
435
|
+
|
436
|
+
### Core Components
|
437
|
+
|
438
|
+
```
|
439
|
+
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
|
440
|
+
โ FastAPI App โ โ MCP Server โ โ Configuration โ
|
441
|
+
โ โ โ โ โ Parser โ
|
442
|
+
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
|
443
|
+
โ โ โ
|
444
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
|
445
|
+
โ
|
446
|
+
โโโโโโโโโโโโโโโโโโโ
|
447
|
+
โ LLMFlow Service โ
|
448
|
+
โโโโโโโโโโโโโโโโโโโ
|
449
|
+
โ
|
450
|
+
โโโโโโโโโโโโโโโโโโโ
|
451
|
+
โ Pipeline โ
|
452
|
+
โ Context โ
|
453
|
+
โโโโโโโโโโโโโโโโโโโ
|
454
|
+
โ
|
455
|
+
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
|
456
|
+
โ โ โ
|
457
|
+
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
|
458
|
+
โ Operations โ โ Tools โ โVector Storesโ
|
459
|
+
โ โ โ โ โ โ
|
460
|
+
โ โข ReAct โ โ โข Code โ โ โข File โ
|
461
|
+
โ โข Recall โ โ โข Search โ โ โข ES โ
|
462
|
+
โ โข Update โ โ โข MCP โ โ โข Chroma โ
|
463
|
+
โ โข Mock โ โ โข Terminate โ โ โ
|
464
|
+
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
|
465
|
+
```
|
466
|
+
|
467
|
+
### Data Flow
|
468
|
+
|
469
|
+
```
|
470
|
+
Request โ Configuration โ Pipeline โ Operations โ Tools/VectorStore โ Response
|
471
|
+
```
|
472
|
+
|
473
|
+
## ๐ง Development Guide
|
474
|
+
|
475
|
+
### Custom Operations
|
476
|
+
|
477
|
+
```python
|
478
|
+
from llmflow.op import OP_REGISTRY
|
479
|
+
from llmflow.op.base_op import BaseOp
|
480
|
+
|
481
|
+
@OP_REGISTRY.register()
|
482
|
+
class CustomOp(BaseOp):
|
483
|
+
def execute(self):
|
484
|
+
# Implement your custom logic
|
485
|
+
request = self.context.request
|
486
|
+
response = self.context.response
|
487
|
+
|
488
|
+
# Process request
|
489
|
+
result = self.process_data(request.query)
|
490
|
+
|
491
|
+
# Update response
|
492
|
+
response.metadata["custom_result"] = result
|
493
|
+
```
|
494
|
+
|
495
|
+
### Custom Tools
|
496
|
+
|
497
|
+
```python
|
498
|
+
from llmflow.tool import TOOL_REGISTRY
|
499
|
+
from llmflow.tool.base_tool import BaseTool
|
500
|
+
|
501
|
+
@TOOL_REGISTRY.register()
|
502
|
+
class CustomTool(BaseTool):
|
503
|
+
name: str = "custom_tool"
|
504
|
+
description: str = "Custom tool description"
|
505
|
+
parameters: dict = {
|
506
|
+
"type": "object",
|
507
|
+
"properties": {
|
508
|
+
"input": {"type": "string", "description": "Input parameter"}
|
509
|
+
},
|
510
|
+
"required": ["input"]
|
511
|
+
}
|
512
|
+
|
513
|
+
def _execute(self, input: str, **kwargs):
|
514
|
+
# Implement tool logic
|
515
|
+
return f"Processing result: {input}"
|
516
|
+
```
|
517
|
+
|
518
|
+
### Custom Vector Stores
|
519
|
+
|
520
|
+
```python
|
521
|
+
from llmflow.vector_store import VECTOR_STORE_REGISTRY
|
522
|
+
from llmflow.vector_store.base_vector_store import BaseVectorStore
|
523
|
+
|
524
|
+
@VECTOR_STORE_REGISTRY.register("custom_store")
|
525
|
+
class CustomVectorStore(BaseVectorStore):
|
526
|
+
def search(self, query: str, top_k: int = 10, **kwargs):
|
527
|
+
# Implement search logic
|
528
|
+
pass
|
529
|
+
|
530
|
+
def insert(self, nodes: List[VectorNode], **kwargs):
|
531
|
+
# Implement insertion logic
|
532
|
+
pass
|
533
|
+
```
|
534
|
+
|
535
|
+
## ๐งช Testing
|
536
|
+
|
537
|
+
```bash
|
538
|
+
# Run tests
|
539
|
+
pytest
|
540
|
+
|
541
|
+
# Run specific tests
|
542
|
+
pytest tests/test_pipeline.py
|
543
|
+
|
544
|
+
# Generate coverage report
|
545
|
+
pytest --cov=llmflow tests/
|
546
|
+
```
|
547
|
+
|
548
|
+
## ๐ค Contributing
|
549
|
+
|
550
|
+
We welcome community contributions! Please follow these steps:
|
551
|
+
|
552
|
+
1. Fork the repository
|
553
|
+
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
|
554
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
555
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
556
|
+
5. Open a Pull Request
|
557
|
+
|
558
|
+
### Development Environment Setup
|
559
|
+
|
560
|
+
```bash
|
561
|
+
# Install development dependencies
|
562
|
+
pip install -e ".[dev]"
|
563
|
+
|
564
|
+
# Install pre-commit hooks
|
565
|
+
pre-commit install
|
566
|
+
|
567
|
+
# Run code formatting
|
568
|
+
black llmflow/
|
569
|
+
isort llmflow/
|
570
|
+
|
571
|
+
# Run type checking
|
572
|
+
mypy llmflow/
|
573
|
+
```
|
574
|
+
|
575
|
+
## ๐ Documentation
|
576
|
+
|
577
|
+
- [API Documentation](docs/api.md)
|
578
|
+
- [Configuration Guide](docs/configuration.md)
|
579
|
+
- [Operations Development](docs/operations.md)
|
580
|
+
- [Tools Development](docs/tools.md)
|
581
|
+
- [Deployment Guide](docs/deployment.md)
|
582
|
+
|
583
|
+
## ๐ Bug Reports
|
584
|
+
|
585
|
+
If you find bugs or have feature requests, please create an issue on [GitHub Issues](https://github.com/your-username/llmflow/issues).
|
586
|
+
|
587
|
+
## ๐ License
|
588
|
+
|
589
|
+
This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.
|
590
|
+
|
591
|
+
## ๐ Acknowledgments
|
592
|
+
|
593
|
+
Thanks to all developers and community members who have contributed to the LLMFlow project.
|
594
|
+
|
595
|
+
---
|
596
|
+
|
597
|
+
**LLMFlow** - Making AI workflow development simple and powerful ๐
|
@@ -0,0 +1,66 @@
|
|
1
|
+
flowllm-0.1.0.dist-info/licenses/LICENSE,sha256=CpH4VoknEI82jjSPd8K3jQLwvrRAM9LwJAOnppzo-Jk,11343
|
2
|
+
llmflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
llmflow/app.py,sha256=lArBS_VusANTkdzAT2deS14HY5_trVCweKfSX45jqPo,1621
|
4
|
+
llmflow/mcp_server.py,sha256=hO4QoqKSqaJJ42cVwuLwQ-MgVKn0UB7gQcUS7MOcgu8,3086
|
5
|
+
llmflow/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
llmflow/config/config_parser.py,sha256=htypaDcT_-he-wexG75usKkQXHyOaDbQAwANWq5aSbI,3214
|
7
|
+
llmflow/config/mock_config.yaml,sha256=0I66Tz5sXHgU-_EoO8hOyqXEmncXTLoS6JoPkizC6jw,995
|
8
|
+
llmflow/embedding_model/__init__.py,sha256=u5QQPmBmJ1ISom5bI--vrAldMZ3RlMEhY5Uh0wNoLVI,185
|
9
|
+
llmflow/embedding_model/base_embedding_model.py,sha256=vijZE1k2Q27wRrDSF2UYZ1I70Hj9iZPkdiWC_-t4csI,4298
|
10
|
+
llmflow/embedding_model/openai_compatible_embedding_model.py,sha256=7y7ttySiB3_dqwQh9d6fk0KgJ48-97-0yQ1ThgLpc8c,3549
|
11
|
+
llmflow/enumeration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
llmflow/enumeration/agent_state.py,sha256=BCBj13fm29oTb-MdsVtbW_flmsWEAYpideMD5xkG2B4,143
|
13
|
+
llmflow/enumeration/chunk_enum.py,sha256=EYB0a84qtrph5H7h_m05Qeo5B00B3xnSOt9KBb5CCJY,152
|
14
|
+
llmflow/enumeration/http_enum.py,sha256=ddIYeVz2J8CInzEkhWbz1rPe0qh2FVfryNNE1uc1ioM,141
|
15
|
+
llmflow/enumeration/role.py,sha256=SFMGXmwYFndGIwbr9GxS3OIoHIZ_nO23DeRnqpV4U3g,133
|
16
|
+
llmflow/llm/__init__.py,sha256=u6FdiMYZMbnMbCgOJ-_4vwfOkNtpoG1jxwVhJTWOIhc,142
|
17
|
+
llmflow/llm/base_llm.py,sha256=EtaUpeFX-gEApwRJYkIdfVjKivbFwg5tGSe6P9lZrHM,5906
|
18
|
+
llmflow/llm/openai_compatible_llm.py,sha256=ib6aUiFEsj2i2G8yP5grnV-x2LIDIedU2rWj50FYbAU,11761
|
19
|
+
llmflow/op/__init__.py,sha256=aFyZt6OD_FdXAESTnOdXVfcvQ47JvOcMLxCxNbs5qiE,444
|
20
|
+
llmflow/op/base_op.py,sha256=vQroEM8eoRRWnfsPN5c_FQBxUOnGVObzUxEuoQ3wArc,4901
|
21
|
+
llmflow/op/mock_op.py,sha256=_mWuRayUyrAebmawbzISLAXN2UBjZNRVPZGL7R3Njrs,639
|
22
|
+
llmflow/op/prompt_mixin.py,sha256=MeD9QSy95It2UhCnfSl1qTHY6DGh2h5OAcqZw99VNdE,2217
|
23
|
+
llmflow/op/react/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
llmflow/op/react/react_v1_op.py,sha256=rx-paa046IkZcj-92D1lqFXShelHrSddKdWfuVXZW9g,3923
|
25
|
+
llmflow/op/react/react_v1_prompt.yaml,sha256=XL8NLutlT5cuJAbWxw1Acu4NKuBoHx5h9iXVr-c30js,1552
|
26
|
+
llmflow/op/vector_store/__init__.py,sha256=xPNPugGcV9h2p5p83mII-fSTwAWgtjPH8pIYQeRhozo,465
|
27
|
+
llmflow/op/vector_store/recall_vector_store_op.py,sha256=AfRKZ8K9iFuG3RgIei-ZgcP7l5oyL1nh_L5IuFJRqFQ,2020
|
28
|
+
llmflow/op/vector_store/update_vector_store_op.py,sha256=ti3fQDaCxlGxTmJzitYhpcXbRviIU1Nb0rXKpxdvbMg,1124
|
29
|
+
llmflow/op/vector_store/vector_store_action_op.py,sha256=4TKDvVWPmJrNCser7qlbXMISMh5JAdKjt5Skqn1l8uI,2071
|
30
|
+
llmflow/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
+
llmflow/pipeline/pipeline.py,sha256=QLmOyVeT8RsZyxPRUuucbHlOQ9BC_ctO2436rRULZas,3493
|
32
|
+
llmflow/pipeline/pipeline_context.py,sha256=JYsReQKoejMi08gJ_ya1QiGM6mBqOaVERWcfF4IECuI,961
|
33
|
+
llmflow/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
|
+
llmflow/schema/app_config.py,sha256=Ql8NLtGSLdkYd3ILBSIajKZhZapsoDgiZSS306bc0yo,2020
|
35
|
+
llmflow/schema/experience.py,sha256=Al50tleJakm1f7kO75pnCeo6kEG_D4TkQ35viD5sERA,4881
|
36
|
+
llmflow/schema/message.py,sha256=_zDuNUY2rFhNURv-1lEsQ_i7detryCrtznlD_U3oMFU,2122
|
37
|
+
llmflow/schema/request.py,sha256=qHzQGa8nUoDHGzMLwujR03z3yXQwgxSX9hPrSjXlD3s,801
|
38
|
+
llmflow/schema/response.py,sha256=KHdXX6u3E73QbC4sOIYC-jFClclyMIBY_FnrnZIoodQ,805
|
39
|
+
llmflow/schema/vector_node.py,sha256=2s6YALIYtj1n7iYsfA7W0WhVunuQBobm8rQoMyAgF3Y,361
|
40
|
+
llmflow/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
41
|
+
llmflow/service/llmflow_service.py,sha256=Hpi_9ZfrJBrESRQUGB39sl640rVezkTTRtNg2aLrJVo,4314
|
42
|
+
llmflow/tool/__init__.py,sha256=A9hPcg6zX0O5k9_A6fOVbTj5wiMbUjuNFFnZLlweBBA,341
|
43
|
+
llmflow/tool/base_tool.py,sha256=3iCvqsh-SKOfIXDuR5XhtkgzjBsmgoj9YEnPxRchDNE,2633
|
44
|
+
llmflow/tool/code_tool.py,sha256=SivJxGZrzFOJ0c-wYU8ftM6AdFdQOnFOxZdTATbQnss,1190
|
45
|
+
llmflow/tool/dashscope_search_tool.py,sha256=7MHm-qATu6CsB4_8tSsjWV_61fC758DbqgboRD0DaDE,6136
|
46
|
+
llmflow/tool/mcp_tool.py,sha256=c1dYW0TLERov15BtwPJPcvl6L1h-O3Xn4SI9VjeuqIQ,2918
|
47
|
+
llmflow/tool/tavily_search_tool.py,sha256=eAtaVIzcURLcm_VA4HjOZJMQs0YjkwzBjyk9JxfcfDo,3646
|
48
|
+
llmflow/tool/terminate_tool.py,sha256=6HR-uUlgzZoI6y8QTu30ug91kUUvPIVVO6iuo3uBlWU,825
|
49
|
+
llmflow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
|
+
llmflow/utils/common_utils.py,sha256=RZ7lq_j9tyVkSrlaqfsrAcEIiu58BXHKIdueHtGPU84,363
|
51
|
+
llmflow/utils/file_handler.py,sha256=-M_p4AGn5FtaD7wrzdmMFQvsQtr_4IsS05j9gizobL4,664
|
52
|
+
llmflow/utils/http_client.py,sha256=LJgdbzdQ8e7X6D_pyy0JQ3RY5AItfVNiNpOEJsJOqu8,6196
|
53
|
+
llmflow/utils/op_utils.py,sha256=q2dU5G4-fmOhXogJG5ca7uQczuHDYu4rQooWWgmysz8,3807
|
54
|
+
llmflow/utils/registry.py,sha256=OFbmp1y5aVtqczPDrfT74M8hLoNeoWKcOdsT-OczoUc,921
|
55
|
+
llmflow/utils/singleton.py,sha256=No3otyPDRHu6wQuFRC-w28MkbommVFTLd7H4mT6-Zos,213
|
56
|
+
llmflow/utils/timer.py,sha256=qccPMh27euWIE9m6hZ1N_kDRwfEN97qPhZis68ktLNs,1443
|
57
|
+
llmflow/vector_store/__init__.py,sha256=Zk9mkH3ii9WPchQcG_KHFO89jwHIKZvuvFpr8WRmy-E,282
|
58
|
+
llmflow/vector_store/base_vector_store.py,sha256=_ciUZ52bqyDiaFzKzB5me_wYXsrNDt0PyQzBQQlgYO4,5517
|
59
|
+
llmflow/vector_store/chroma_vector_store.py,sha256=IcTL2-jqy8Tltkml5dn6L29nDcDhX59f500fqeTp5z8,7084
|
60
|
+
llmflow/vector_store/es_vector_store.py,sha256=9kl7KmQBOZSKlHnyrVNXGx4o7Xi7LRurAbB0-8_dPUo,8447
|
61
|
+
llmflow/vector_store/file_vector_store.py,sha256=9KbixHdqm8R32xMVmNqVXqjhjvv0maAsvMnuW7SkII0,6184
|
62
|
+
flowllm-0.1.0.dist-info/METADATA,sha256=89YrxJzuRmT4b_SRXlRgHPK2gff83CeY7StnYuJAMmA,24257
|
63
|
+
flowllm-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
64
|
+
flowllm-0.1.0.dist-info/entry_points.txt,sha256=LxjuRXqMQ3J95vPC_1i7OAhlJX1rXmklOYi2KOLfKpM,83
|
65
|
+
flowllm-0.1.0.dist-info/top_level.txt,sha256=Hv7BK14mg2npiZaCmy-T2TSABJZHh7YKrOeEs0gPrPI,8
|
66
|
+
flowllm-0.1.0.dist-info/RECORD,,
|