agentica 0.1.8__tar.gz → 0.2.1__tar.gz
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.
- agentica-0.2.1/PKG-INFO +282 -0
- agentica-0.2.1/README.md +251 -0
- agentica-0.2.1/agentica/__init__.py +109 -0
- agentica-0.2.1/agentica/agent.py +3092 -0
- agentica-0.2.1/agentica/agent_session.py +60 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/config.py +2 -5
- {agentica-0.1.8 → agentica-0.2.1}/agentica/document.py +1 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/hash_emb.py +11 -1
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/openai_emb.py +12 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/sentence_transformer_emb.py +1 -1
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/text2vec_emb.py +10 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/word2vec_emb.py +10 -0
- agentica-0.2.1/agentica/knowledge/__init__.py +8 -0
- agentica-0.1.8/agentica/knowledge/knowledge_base.py → agentica-0.2.1/agentica/knowledge/base.py +61 -31
- agentica-0.1.8/agentica/knowledge/langchain.py → agentica-0.2.1/agentica/knowledge/langchain_knowledge.py +4 -4
- agentica-0.1.8/agentica/knowledge/llamaindex.py → agentica-0.2.1/agentica/knowledge/llamaindex_knowledge.py +14 -26
- agentica-0.2.1/agentica/memory.py +892 -0
- agentica-0.2.1/agentica/memorydb.py +600 -0
- agentica-0.2.1/agentica/model/anthropic/__init__.py +1 -0
- agentica-0.2.1/agentica/model/anthropic/claude.py +670 -0
- agentica-0.2.1/agentica/model/aws/api_client.py +43 -0
- agentica-0.2.1/agentica/model/aws/bedrock.py +577 -0
- agentica-0.2.1/agentica/model/aws/claude.py +223 -0
- agentica-0.2.1/agentica/model/azure/__init__.py +1 -0
- agentica-0.2.1/agentica/model/azure/openai_chat.py +96 -0
- agentica-0.2.1/agentica/model/base.py +530 -0
- agentica-0.2.1/agentica/model/cohere/__init__.py +1 -0
- agentica-0.2.1/agentica/model/cohere/chat.py +636 -0
- agentica-0.2.1/agentica/model/content.py +39 -0
- agentica-0.2.1/agentica/model/deepseek/__init__.py +1 -0
- agentica-0.2.1/agentica/model/deepseek/chat.py +24 -0
- agentica-0.2.1/agentica/model/doubao/__init__.py +1 -0
- agentica-0.2.1/agentica/model/doubao/chat.py +24 -0
- agentica-0.2.1/agentica/model/fireworks/__init__.py +1 -0
- agentica-0.2.1/agentica/model/fireworks/fireworks.py +43 -0
- agentica-0.2.1/agentica/model/google/__init__.py +2 -0
- agentica-0.2.1/agentica/model/google/gemini.py +780 -0
- agentica-0.2.1/agentica/model/google/gemini_openai.py +25 -0
- agentica-0.2.1/agentica/model/groq/__init__.py +1 -0
- agentica-0.2.1/agentica/model/groq/groq.py +891 -0
- agentica-0.2.1/agentica/model/huggingface/__init__.py +1 -0
- agentica-0.2.1/agentica/model/huggingface/hf.py +849 -0
- agentica-0.2.1/agentica/model/internlm/__init__.py +1 -0
- agentica-0.2.1/agentica/model/internlm/chat.py +24 -0
- agentica-0.2.1/agentica/model/message.py +129 -0
- agentica-0.2.1/agentica/model/mistral/__init__.py +1 -0
- agentica-0.2.1/agentica/model/mistral/mistral.py +544 -0
- agentica-0.2.1/agentica/model/moonshot/__init__.py +1 -0
- agentica-0.2.1/agentica/model/moonshot/chat.py +24 -0
- agentica-0.2.1/agentica/model/nvidia/__init__.py +1 -0
- agentica-0.2.1/agentica/model/nvidia/chat.py +24 -0
- agentica-0.2.1/agentica/model/ollama/__init__.py +3 -0
- agentica-0.2.1/agentica/model/ollama/chat.py +724 -0
- agentica-0.2.1/agentica/model/ollama/hermes.py +226 -0
- agentica-0.2.1/agentica/model/ollama/tools.py +361 -0
- agentica-0.2.1/agentica/model/openai/__init__.py +2 -0
- agentica-0.2.1/agentica/model/openai/chat.py +1024 -0
- agentica-0.2.1/agentica/model/openai/like.py +8 -0
- agentica-0.2.1/agentica/model/openrouter/__init__.py +1 -0
- agentica-0.2.1/agentica/model/openrouter/openrouter.py +26 -0
- agentica-0.2.1/agentica/model/response.py +30 -0
- agentica-0.2.1/agentica/model/sambanova/__init__.py +1 -0
- agentica-0.2.1/agentica/model/sambanova/sambanova.py +24 -0
- agentica-0.2.1/agentica/model/together/__init__.py +1 -0
- agentica-0.2.1/agentica/model/together/togetherchat.py +179 -0
- agentica-0.2.1/agentica/model/vertexai/__init__.py +1 -0
- agentica-0.2.1/agentica/model/vertexai/gemini.py +631 -0
- agentica-0.2.1/agentica/model/xai/__init__.py +1 -0
- agentica-0.2.1/agentica/model/xai/grok.py +24 -0
- agentica-0.2.1/agentica/model/yi/__init__.py +1 -0
- agentica-0.2.1/agentica/model/yi/chat.py +24 -0
- agentica-0.1.8/agentica/python_assistant.py → agentica-0.2.1/agentica/python_agent.py +86 -83
- agentica-0.2.1/agentica/reasoning.py +35 -0
- agentica-0.2.1/agentica/reranker/__init__.py +0 -0
- agentica-0.2.1/agentica/reranker/base.py +18 -0
- agentica-0.2.1/agentica/reranker/bge.py +97 -0
- agentica-0.2.1/agentica/reranker/cohere.py +68 -0
- agentica-0.2.1/agentica/run_response.py +159 -0
- agentica-0.2.1/agentica/storage/__init__.py +0 -0
- agentica-0.2.1/agentica/storage/agent/base.py +43 -0
- agentica-0.2.1/agentica/storage/agent/json_file.py +89 -0
- agentica-0.2.1/agentica/storage/agent/postgres.py +370 -0
- agentica-0.2.1/agentica/storage/agent/sqlite.py +384 -0
- agentica-0.2.1/agentica/storage/agent/yaml_file.py +89 -0
- agentica-0.2.1/agentica/storage/workflow/__init__.py +5 -0
- agentica-0.2.1/agentica/storage/workflow/base.py +45 -0
- agentica-0.2.1/agentica/storage/workflow/postgres.py +363 -0
- agentica-0.2.1/agentica/storage/workflow/sqlite.py +356 -0
- agentica-0.2.1/agentica/tools/__init__.py +0 -0
- agentica-0.1.8/agentica/tools/airflow.py → agentica-0.2.1/agentica/tools/airflow_tool.py +30 -6
- agentica-0.1.8/agentica/tools/analyze_image.py → agentica-0.2.1/agentica/tools/analyze_image_tool.py +22 -14
- agentica-0.1.8/agentica/tools/arxiv.py → agentica-0.2.1/agentica/tools/arxiv_tool.py +31 -2
- agentica-0.2.1/agentica/tools/baidusearch_tool.py +287 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/tools/base.py +259 -58
- agentica-0.2.1/agentica/tools/calculator_tool.py +190 -0
- agentica-0.1.8/agentica/tools/create_image.py → agentica-0.2.1/agentica/tools/create_image_tool.py +38 -27
- agentica-0.1.8/agentica/tools/dblp.py → agentica-0.2.1/agentica/tools/dblp_tool.py +5 -0
- agentica-0.1.8/agentica/tools/duckduckgo.py → agentica-0.2.1/agentica/tools/duckduckgo_tool.py +19 -6
- agentica-0.1.8/agentica/tools/file.py → agentica-0.2.1/agentica/tools/file_tool.py +56 -14
- agentica-0.1.8/agentica/tools/hackernews.py → agentica-0.2.1/agentica/tools/hackernews_tool.py +18 -6
- agentica-0.1.8/agentica/tools/jina.py → agentica-0.2.1/agentica/tools/jina_tool.py +27 -10
- agentica-0.2.1/agentica/tools/newspaper_tool.py +86 -0
- agentica-0.2.1/agentica/tools/ocr_tool.py +57 -0
- agentica-0.2.1/agentica/tools/resend_tools.py +65 -0
- agentica-0.1.8/agentica/tools/run_nb_code.py → agentica-0.2.1/agentica/tools/run_nb_code_tool.py +11 -2
- agentica-0.2.1/agentica/tools/run_python_code_tool.py +187 -0
- agentica-0.1.8/agentica/tools/search_exa.py → agentica-0.2.1/agentica/tools/search_exa_tool.py +14 -0
- agentica-0.1.8/agentica/tools/search_serper.py → agentica-0.2.1/agentica/tools/search_serper_tool.py +21 -16
- agentica-0.1.8/agentica/tools/shell.py → agentica-0.2.1/agentica/tools/shell_tool.py +13 -0
- agentica-0.1.8/agentica/tools/sql.py → agentica-0.2.1/agentica/tools/sql_tool.py +21 -5
- agentica-0.2.1/agentica/tools/text_analysis_tool.py +51 -0
- agentica-0.1.8/agentica/tools/url_crawler.py → agentica-0.2.1/agentica/tools/url_crawler_tool.py +19 -22
- agentica-0.2.1/agentica/tools/wikipedia_tool.py +47 -0
- agentica-0.1.8/agentica/tools/yfinance.py → agentica-0.2.1/agentica/tools/yfinance_tool.py +87 -20
- {agentica-0.1.8 → agentica-0.2.1}/agentica/utils/__init__.py +0 -1
- agentica-0.2.1/agentica/utils/console.py +78 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/utils/file_parser.py +75 -31
- agentica-0.2.1/agentica/utils/io.py +18 -0
- agentica-0.2.1/agentica/utils/json_util.py +106 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/utils/misc.py +43 -36
- {agentica-0.1.8 → agentica-0.2.1}/agentica/vectordb/base.py +25 -8
- agentica-0.1.8/agentica/vectordb/chromadb.py → agentica-0.2.1/agentica/vectordb/chromadb_vectordb.py +35 -11
- agentica-0.2.1/agentica/vectordb/lancedb_vectordb.py +293 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/vectordb/memory_vectordb.py +20 -9
- agentica-0.1.8/agentica/vectordb/pgvector.py → agentica-0.2.1/agentica/vectordb/pgvectordb.py +46 -6
- {agentica-0.1.8 → agentica-0.2.1}/agentica/vectordb/pineconedb.py +99 -29
- agentica-0.1.8/agentica/vectordb/qdrant.py → agentica-0.2.1/agentica/vectordb/qdrantdb.py +30 -8
- agentica-0.2.1/agentica/version.py +1 -0
- agentica-0.2.1/agentica/workflow.py +453 -0
- agentica-0.2.1/agentica/workflow_session.py +41 -0
- agentica-0.2.1/agentica.egg-info/PKG-INFO +282 -0
- agentica-0.2.1/agentica.egg-info/SOURCES.txt +166 -0
- agentica-0.2.1/tests/__init__.py +5 -0
- {agentica-0.1.8 → agentica-0.2.1}/tests/test_create_image.py +7 -5
- agentica-0.2.1/tests/test_file_reader.py +65 -0
- {agentica-0.1.8 → agentica-0.2.1}/tests/test_jina_tool.py +8 -15
- {agentica-0.1.8 → agentica-0.2.1}/tests/test_llm.py +4 -2
- {agentica-0.1.8 → agentica-0.2.1}/tests/test_run_nb_code.py +3 -1
- {agentica-0.1.8 → agentica-0.2.1}/tests/test_url_crawler.py +29 -26
- agentica-0.1.8/PKG-INFO +0 -258
- agentica-0.1.8/README.md +0 -227
- agentica-0.1.8/agentica/__init__.py +0 -74
- agentica-0.1.8/agentica/assistant.py +0 -1392
- agentica-0.1.8/agentica/llm/__init__.py +0 -8
- agentica-0.1.8/agentica/llm/azure_openai_llm.py +0 -64
- agentica-0.1.8/agentica/llm/base.py +0 -197
- agentica-0.1.8/agentica/llm/claude_llm.py +0 -419
- agentica-0.1.8/agentica/llm/deepseek_llm.py +0 -75
- agentica-0.1.8/agentica/llm/moonshot_llm.py +0 -27
- agentica-0.1.8/agentica/llm/ollama_llm.py +0 -640
- agentica-0.1.8/agentica/llm/ollama_tools_llm.py +0 -489
- agentica-0.1.8/agentica/llm/openai_llm.py +0 -965
- agentica-0.1.8/agentica/llm/togetherllm.py +0 -155
- agentica-0.1.8/agentica/memory.py +0 -752
- agentica-0.1.8/agentica/message.py +0 -114
- agentica-0.1.8/agentica/references.py +0 -19
- agentica-0.1.8/agentica/run_record.py +0 -52
- agentica-0.1.8/agentica/storage/__init__.py +0 -8
- agentica-0.1.8/agentica/storage/base.py +0 -38
- agentica-0.1.8/agentica/storage/pg_storage.py +0 -234
- agentica-0.1.8/agentica/storage/sqlite_storage.py +0 -263
- agentica-0.1.8/agentica/task.py +0 -122
- agentica-0.1.8/agentica/tools/ocr.py +0 -66
- agentica-0.1.8/agentica/tools/run_python_code.py +0 -110
- agentica-0.1.8/agentica/tools/wikipedia.py +0 -40
- agentica-0.1.8/agentica/vectordb/lancedb.py +0 -204
- agentica-0.1.8/agentica/version.py +0 -1
- agentica-0.1.8/agentica/workflow.py +0 -161
- agentica-0.1.8/agentica.egg-info/PKG-INFO +0 -258
- agentica-0.1.8/agentica.egg-info/SOURCES.txt +0 -102
- agentica-0.1.8/tests/test_moonshot_llm.py +0 -296
- agentica-0.1.8/tests/test_sqlite_storage.py +0 -97
- {agentica-0.1.8 → agentica-0.2.1}/LICENSE +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/__init__.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/azure_openai_emb.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/base.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/fireworks_emb.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/genimi_emb.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/huggingface_emb.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/ollama_emb.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/emb/together_emb.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/file/__init__.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/file/base.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/file/csv.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/file/txt.py +0 -0
- {agentica-0.1.8/agentica/tools → agentica-0.2.1/agentica/model}/__init__.py +0 -0
- {agentica-0.1.8/tests → agentica-0.2.1/agentica/model/aws}/__init__.py +0 -0
- {agentica-0.1.8/agentica/knowledge → agentica-0.2.1/agentica/storage/agent}/__init__.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/template.py +0 -0
- /agentica-0.1.8/agentica/tools/apify.py → /agentica-0.2.1/agentica/tools/apify_tool.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/utils/log.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/utils/shell.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/utils/timer.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica/vectordb/__init__.py +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica.egg-info/dependency_links.txt +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica.egg-info/entry_points.txt +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica.egg-info/not-zip-safe +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica.egg-info/requires.txt +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/agentica.egg-info/top_level.txt +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/setup.cfg +0 -0
- {agentica-0.1.8 → agentica-0.2.1}/setup.py +0 -0
agentica-0.2.1/PKG-INFO
ADDED
@@ -0,0 +1,282 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: agentica
|
3
|
+
Version: 0.2.1
|
4
|
+
Summary: LLM agents
|
5
|
+
Home-page: https://github.com/shibing624/agentica
|
6
|
+
Author: XuMing
|
7
|
+
Author-email: xuming624@qq.com
|
8
|
+
License: Apache License 2.0
|
9
|
+
Keywords: Agentica,Agent Tool,action,agent,agentica
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: Intended Audience :: Education
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
15
|
+
Classifier: Operating System :: OS Independent
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
18
|
+
Requires-Python: >=3.8.0
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
License-File: LICENSE
|
21
|
+
Requires-Dist: loguru
|
22
|
+
Requires-Dist: markdownify
|
23
|
+
Requires-Dist: openai
|
24
|
+
Requires-Dist: python-dotenv
|
25
|
+
Requires-Dist: pydantic
|
26
|
+
Requires-Dist: requests
|
27
|
+
Requires-Dist: sqlalchemy
|
28
|
+
Requires-Dist: scikit-learn
|
29
|
+
Requires-Dist: tqdm
|
30
|
+
Requires-Dist: rich
|
31
|
+
|
32
|
+
[**🇨🇳中文**](https://github.com/shibing624/agentica/blob/main/README.md) | [**🌐English**](https://github.com/shibing624/agentica/blob/main/README_EN.md) | [**🇯🇵日本語**](https://github.com/shibing624/agentica/blob/main/README_JP.md)
|
33
|
+
|
34
|
+
<div align="center">
|
35
|
+
<a href="https://github.com/shibing624/agentica">
|
36
|
+
<img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/logo.png" height="150" alt="Logo">
|
37
|
+
</a>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
-----------------
|
41
|
+
|
42
|
+
# Agentica: Build AI Agents
|
43
|
+
[](https://badge.fury.io/py/agentica)
|
44
|
+
[](https://pepy.tech/project/agentica)
|
45
|
+
[](CONTRIBUTING.md)
|
46
|
+
[](LICENSE)
|
47
|
+
[](requirements.txt)
|
48
|
+
[](https://github.com/shibing624/agentica/issues)
|
49
|
+
[](#Contact)
|
50
|
+
|
51
|
+
|
52
|
+
**Agentica**: Build Smarter, Reflective, and Collaborative AI Agents with Ease!
|
53
|
+
|
54
|
+
**Agentica**: 快速打造智能、能反思、协作的AI Agent。
|
55
|
+
|
56
|
+
## Overview
|
57
|
+
|
58
|
+
#### LLM Agent
|
59
|
+
<img src="https://github.com/shibing624/agentica/blob/main/docs/llm_agentv2.png" width="800" />
|
60
|
+
|
61
|
+
- **规划(Planning)**:任务拆解、生成计划、反思
|
62
|
+
- **记忆(Memory)**:短期记忆(prompt实现)、长期记忆(RAG实现)
|
63
|
+
- **工具使用(Tool use)**:function call能力,调用外部API,以获取外部信息,包括当前日期、日历、代码执行能力、对专用信息源的访问等
|
64
|
+
|
65
|
+
#### Agentica Architecture
|
66
|
+
<img src="https://github.com/shibing624/agentica/blob/main/docs/agent_arch.png" width="800" />
|
67
|
+
|
68
|
+
- **Planner**:负责让LLM生成一个多步计划来完成复杂任务,生成相互依赖的“链式计划”,定义每一步所依赖的上一步的输出
|
69
|
+
- **Worker**:接受“链式计划”,循环遍历计划中的每个子任务,并调用工具完成任务,可以自动反思纠错以完成任务
|
70
|
+
- **Solver**:求解器将所有这些输出整合为最终答案
|
71
|
+
|
72
|
+
|
73
|
+
## Features
|
74
|
+
`Agentica`是一个用于构建Agent的工具,具有以下功能:
|
75
|
+
|
76
|
+
- **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Multi-Role、Workflow等功能
|
77
|
+
- **自定义prompt**:Agent支持自定义prompt和多种工具调用(tool_calls)
|
78
|
+
- **LLM集成**:支持OpenAI、Azure、Deepseek、Moonshot、Claude、Ollama、Together等多方大模型厂商的API
|
79
|
+
- **记忆功能**:包括短期记忆和长期记忆功能
|
80
|
+
- **Multi-Agent协作**:支持多Agent和多角色的团队协作。
|
81
|
+
- **Workflow工作流**:拆解复杂任务为多个Agent,基于工作流自动化串行逐步完成任务,如投资研究、新闻文章撰写和技术教程创建
|
82
|
+
- **自我进化Agent**:具有反思和增强记忆能力的自我进化Agent
|
83
|
+
- **Web UI**:兼容ChatPilot,可以基于Web页面交互,支持主流的open-webui、streamlit、gradio等前端交互框架
|
84
|
+
|
85
|
+
## Installation
|
86
|
+
|
87
|
+
```bash
|
88
|
+
pip install -U agentica
|
89
|
+
```
|
90
|
+
|
91
|
+
or
|
92
|
+
|
93
|
+
```bash
|
94
|
+
git clone https://github.com/shibing624/agentica.git
|
95
|
+
cd agentica
|
96
|
+
pip install .
|
97
|
+
```
|
98
|
+
|
99
|
+
## Getting Started
|
100
|
+
|
101
|
+
#### Run the example
|
102
|
+
```shell
|
103
|
+
# Copying required .env file, and fill in the LLM api key
|
104
|
+
cp .env.example ~/.agentica/.env
|
105
|
+
|
106
|
+
cd examples
|
107
|
+
python web_search_moonshot_demo.py
|
108
|
+
```
|
109
|
+
|
110
|
+
1. 复制[.env.example](https://github.com/shibing624/agentica/blob/main/.env.example)文件为`~/.agentica/.env`,并填写LLM api key(选填DEEPSEEK_API_KEY、MOONSHOT_API_KEY、OPENAI_API_KEY等任一个即可)。或者使用`export`命令设置环境变量:
|
111
|
+
|
112
|
+
```shell
|
113
|
+
export MOONSHOT_API_KEY=your_moonshot_api_key
|
114
|
+
export SERPER_API_KEY=your_serper_api_key
|
115
|
+
```
|
116
|
+
|
117
|
+
2. 使用`agentica`构建Agent并执行:
|
118
|
+
|
119
|
+
自动调用google搜索工具,示例[examples/12_web_search_moonshot_demo.py](https://github.com/shibing624/agentica/blob/main/examples/12_web_search_moonshot_demo.py)
|
120
|
+
|
121
|
+
```python
|
122
|
+
from agentica import Agent, MoonshotChat, SearchSerperTool
|
123
|
+
|
124
|
+
m = Agent(model=MoonshotChat(), tools=[SearchSerperTool()], add_datetime_to_instructions=True)
|
125
|
+
r = m.run("下一届奥运会在哪里举办")
|
126
|
+
print(r)
|
127
|
+
```
|
128
|
+
|
129
|
+
|
130
|
+
## Web UI
|
131
|
+
|
132
|
+
[shibing624/ChatPilot](https://github.com/shibing624/ChatPilot) 兼容`agentica`,可以通过Web UI进行交互。
|
133
|
+
|
134
|
+
Web Demo: https://chat.mulanai.com
|
135
|
+
|
136
|
+
<img src="https://github.com/shibing624/ChatPilot/blob/main/docs/shot.png" width="800" />
|
137
|
+
|
138
|
+
```shell
|
139
|
+
git clone https://github.com/shibing624/ChatPilot.git
|
140
|
+
cd ChatPilot
|
141
|
+
pip install -r requirements.txt
|
142
|
+
|
143
|
+
cp .env.example .env
|
144
|
+
|
145
|
+
bash start.sh
|
146
|
+
```
|
147
|
+
|
148
|
+
|
149
|
+
## Examples
|
150
|
+
|
151
|
+
|
152
|
+
| 示例 | 描述 |
|
153
|
+
|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
|
154
|
+
| [examples/01_llm_demo.py](https://github.com/shibing624/agentica/blob/main/examples/01_llm_demo.py) | LLM问答Demo |
|
155
|
+
| [examples/02_user_prompt_demo.py](https://github.com/shibing624/agentica/blob/main/examples/02_user_prompt_demo.py) | 自定义用户prompt的Demo |
|
156
|
+
| [examples/03_user_messages_demo.py](https://github.com/shibing624/agentica/blob/main/examples/03_user_messages_demo.py) | 自定义输入用户消息的Demo |
|
157
|
+
| [examples/04_memory_demo.py](https://github.com/shibing624/agentica/blob/main/examples/04_memory_demo.py) | Agent的记忆Demo |
|
158
|
+
| [examples/05_response_model_demo.py](https://github.com/shibing624/agentica/blob/main/examples/05_response_model_demo.py) | 按指定格式(pydantic的BaseModel)回复的Demo |
|
159
|
+
| [examples/06_calc_with_csv_file_demo.py](https://github.com/shibing624/agentica/blob/main/examples/06_calc_with_csv_file_demo.py) | LLM加载CSV文件,并执行计算来回答的Demo |
|
160
|
+
| [examples/07_create_image_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/07_create_image_tool_demo.py) | 实现了创建图像工具的Demo |
|
161
|
+
| [examples/08_ocr_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/08_ocr_tool_demo.py) | 实现了OCR工具的Demo |
|
162
|
+
| [examples/09_remove_image_background_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/09_remove_image_background_tool_demo.py) | 实现了自动去除图片背景功能,包括自动通过pip安装库,调用库实现去除图片背景 |
|
163
|
+
| [examples/10_vision_demo.py](https://github.com/shibing624/agentica/blob/main/examples/10_vision_demo.py) | 视觉理解Demo |
|
164
|
+
| [examples/11_web_search_openai_demo.py](https://github.com/shibing624/agentica/blob/main/examples/11_web_search_openai_demo.py) | 基于OpenAI的function call做网页搜索Demo |
|
165
|
+
| [examples/12_web_search_moonshot_demo.py](https://github.com/shibing624/agentica/blob/main/examples/12_web_search_moonshot_demo.py) | 基于Moonshot的function call做网页搜索Demo |
|
166
|
+
| [examples/13_storage_demo.py](https://github.com/shibing624/agentica/blob/main/examples/13_storage_demo.py) | Agent的存储Demo |
|
167
|
+
| [examples/14_custom_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/14_custom_tool_demo.py) | 自定义工具,并用大模型自主选择调用的Demo |
|
168
|
+
| [examples/15_crawl_webpage_demo.py](https://github.com/shibing624/agentica/blob/main/examples/15_crawl_webpage_demo.py) | 实现了网页分析工作流:从Url爬取融资快讯 - 分析网页内容和格式 - 提取核心信息 - 汇总存为md文件 |
|
169
|
+
| [examples/16_get_top_papers_demo.py](https://github.com/shibing624/agentica/blob/main/examples/16_get_top_papers_demo.py) | 解析每日论文,并保存为json格式的Demo |
|
170
|
+
| [examples/17_find_paper_from_arxiv_demo.py](https://github.com/shibing624/agentica/blob/main/examples/17_find_paper_from_arxiv_demo.py) | 实现了论文推荐的Demo:自动从arxiv搜索多组论文 - 相似论文去重 - 提取核心论文信息 - 保存为csv文件 |
|
171
|
+
| [examples/18_agent_input_is_list.py](https://github.com/shibing624/agentica/blob/main/examples/18_agent_input_is_list.py) | 展示Agent的message可以是列表的Demo |
|
172
|
+
| [examples/19_naive_rag_demo.py](https://github.com/shibing624/agentica/blob/main/examples/19_naive_rag_demo.py) | 实现了基础版RAG,基于Txt文档回答问题 |
|
173
|
+
| [examples/20_advanced_rag_demo.py](https://github.com/shibing624/agentica/blob/main/examples/20_advanced_rag_demo.py) | 实现了高级版RAG,基于PDF文档回答问题,新增功能:pdf文件解析、query改写,字面+语义多路混合召回,召回排序(rerank) |
|
174
|
+
| [examples/21_memorydb_rag_demo.py](https://github.com/shibing624/agentica/blob/main/examples/21_reference_in_prompt_rag_demo.py) | 把参考资料放到prompt的传统RAG做法的Demo |
|
175
|
+
| [examples/22_chat_pdf_app_demo.py](https://github.com/shibing624/agentica/blob/main/examples/22_chat_pdf_app_demo.py) | 对PDF文档做深入对话的Demo |
|
176
|
+
| [examples/23_python_agent_memory_demo.py](https://github.com/shibing624/agentica/blob/main/examples/23_python_agent_memory_demo.py) | 实现了带记忆的Code Interpreter功能,自动生成python代码并执行,下次执行时从记忆获取结果 |
|
177
|
+
| [examples/24_context_demo.py](https://github.com/shibing624/agentica/blob/main/examples/24_context_demo.py) | 实现了传入上下文进行对话的Demo |
|
178
|
+
| [examples/25_tools_with_context_demo.py](https://github.com/shibing624/agentica/blob/main/examples/25_tools_with_context_demo.py) | 工具带上下文传参的Demo |
|
179
|
+
| [examples/26_complex_translate_demo.py](https://github.com/shibing624/agentica/blob/main/examples/26_complex_translate_demo.py) | 实现了复杂翻译Demo |
|
180
|
+
| [examples/27_research_agent_demo.py](https://github.com/shibing624/agentica/blob/main/examples/27_research_agent_demo.py) | 实现了Research功能,自动调用搜索工具,汇总信息后撰写科技报告 |
|
181
|
+
| [examples/28_rag_integrated_langchain_demo.py](https://github.com/shibing624/agentica/blob/main/examples/28_rag_integrated_langchain_demo.py) | 集成LangChain的RAG Demo |
|
182
|
+
| [examples/29_rag_integrated_llamaindex_demo.py](https://github.com/shibing624/agentica/blob/main/examples/29_rag_integrated_llamaindex_demo.py) | 集成LlamaIndex的RAG Demo |
|
183
|
+
| [examples/30_text_classification_demo.py](https://github.com/shibing624/agentica/blob/main/examples/30_text_classification_demo.py) | 实现了自动训练分类模型的Agent:读取训练集文件并理解格式 - 谷歌搜索pytextclassifier库 - 爬取github页面了解pytextclassifier的调用方法 - 写代码并执行fasttext模型训练 - check训练好的模型预测结果 |
|
184
|
+
| [examples/31_team_news_article_demo.py](https://github.com/shibing624/agentica/blob/main/examples/31_team_news_article_demo.py) | Team实现:写新闻稿的team协作,multi-role实现,委托不用角色完成各自任务:研究员检索分析文章,撰写员根据排版写文章,汇总多角色成果输出结果 |
|
185
|
+
| [examples/32_team_debate_demo.py](https://github.com/shibing624/agentica/blob/main/examples/32_team_debate_demo.py) | Team实现:基于委托做双人辩论Demo,特朗普和拜登辩论 |
|
186
|
+
| [examples/33_self_evolving_agent_demo.py](https://github.com/shibing624/agentica/blob/main/examples/33_self_evolving_agent_demo.py) | 实现了自我进化Agent的Demo |
|
187
|
+
| [examples/34_llm_os_demo.py](https://github.com/shibing624/agentica/blob/main/examples/34_llm_os_demo.py) | 实现了LLM OS的初步设计,基于LLM设计操作系统,可以通过LLM调用RAG、代码执行器、Shell等工具,并协同代码解释器、研究助手、投资助手等来解决问题。 |
|
188
|
+
| [examples/35_workflow_investment_demo.py](https://github.com/shibing624/agentica/blob/main/examples/35_workflow_investment_demo.py) | 实现了投资研究的工作流:股票信息收集 - 股票分析 - 撰写分析报告 - 复查报告等多个Task |
|
189
|
+
| [examples/36_workflow_news_article_demo.py](https://github.com/shibing624/agentica/blob/main/examples/36_workflow_news_article_demo.py) | 实现了写新闻稿的工作流,multi-agent的实现,多次调用搜索工具,并生成高级排版的新闻文章 |
|
190
|
+
| [examples/37_workflow_write_novel_demo.py](https://github.com/shibing624/agentica/blob/main/examples/37_workflow_write_novel_demo.py) | 实现了写小说的工作流:定小说提纲 - 搜索谷歌反思提纲 - 撰写小说内容 - 保存为md文件 |
|
191
|
+
| [examples/38_workflow_write_tutorial_demo.py](https://github.com/shibing624/agentica/blob/main/examples/38_workflow_write_tutorial_demo.py) | 实现了写技术教程的工作流:定教程目录 - 反思目录内容 - 撰写教程内容 - 保存为md文件 |
|
192
|
+
| [examples/39_audio_multi_turn_demo.py](https://github.com/shibing624/agentica/blob/main/examples/39_audio_multi_turn_demo.py) | 基于openai的语音api做多轮音频对话的Demo |
|
193
|
+
|
194
|
+
|
195
|
+
### Self-evolving Agent
|
196
|
+
The self-evolving agent design:
|
197
|
+
|
198
|
+
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/sage_arch.png" width="800" />
|
199
|
+
|
200
|
+
#### Feature
|
201
|
+
|
202
|
+
具有反思和增强记忆能力的自我进化智能体(self-evolving Agents with Reflective and Memory-augmented Abilities, SAGE)
|
203
|
+
|
204
|
+
实现方法:
|
205
|
+
|
206
|
+
1. 使用PythonAgent作为SAGE智能体,使用AzureOpenAIChat作为LLM, 具备code-interpreter功能,可以执行Python代码,并自动纠错。
|
207
|
+
2. 使用CsvMemoryDb作为SAGE智能体的记忆,用于存储用户的问题和答案,下次遇到相似的问题时,可以直接返回答案。
|
208
|
+
|
209
|
+
#### Run Self-evolving Agent App
|
210
|
+
|
211
|
+
```shell
|
212
|
+
cd examples
|
213
|
+
streamlit run 33_self_evolving_agent_demo.py
|
214
|
+
```
|
215
|
+
|
216
|
+
<img alt="sage_snap" src="https://github.com/shibing624/agentica/blob/main/docs/sage_snap.png" width="800" />
|
217
|
+
|
218
|
+
|
219
|
+
### LLM OS
|
220
|
+
The LLM OS design:
|
221
|
+
|
222
|
+
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llmos.png" width="800" />
|
223
|
+
|
224
|
+
#### Run the LLM OS App
|
225
|
+
|
226
|
+
```shell
|
227
|
+
cd examples
|
228
|
+
streamlit run 34_llm_os_demo.py
|
229
|
+
```
|
230
|
+
|
231
|
+
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llm_os_snap.png" width="800" />
|
232
|
+
|
233
|
+
## Contact
|
234
|
+
|
235
|
+
- Issue(建议)
|
236
|
+
:[](https://github.com/shibing624/agentica/issues)
|
237
|
+
- 邮件我:xuming: xuming624@qq.com
|
238
|
+
- 微信我: 加我*微信号:xuming624, 备注:姓名-公司-NLP* 进NLP交流群。
|
239
|
+
|
240
|
+
<img src="https://github.com/shibing624/agentica/blob/main/docs/wechat.jpeg" width="200" />
|
241
|
+
|
242
|
+
## Citation
|
243
|
+
|
244
|
+
如果你在研究中使用了`agentica`,请按如下格式引用:
|
245
|
+
|
246
|
+
APA:
|
247
|
+
|
248
|
+
```
|
249
|
+
Xu, M. agentica: A Human-Centric Framework for Large Language Model Agent Workflows (Version 0.0.2) [Computer software]. https://github.com/shibing624/agentica
|
250
|
+
```
|
251
|
+
|
252
|
+
BibTeX:
|
253
|
+
|
254
|
+
```
|
255
|
+
@misc{Xu_agentica,
|
256
|
+
title={agentica: A Human-Centric Framework for Large Language Model Agent Workflows},
|
257
|
+
author={Xu Ming},
|
258
|
+
year={2024},
|
259
|
+
howpublished={\url{https://github.com/shibing624/agentica}},
|
260
|
+
}
|
261
|
+
```
|
262
|
+
|
263
|
+
## License
|
264
|
+
|
265
|
+
授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加`agentica`的链接和授权协议。
|
266
|
+
## Contribute
|
267
|
+
|
268
|
+
项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
|
269
|
+
|
270
|
+
- 在`tests`添加相应的单元测试
|
271
|
+
- 使用`python -m pytest`来运行所有单元测试,确保所有单测都是通过的
|
272
|
+
|
273
|
+
之后即可提交PR。
|
274
|
+
|
275
|
+
## Acknowledgements
|
276
|
+
|
277
|
+
- [https://github.com/langchain-ai/langchain](https://github.com/langchain-ai/langchain)
|
278
|
+
- [https://github.com/simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
|
279
|
+
- [https://github.com/phidatahq/phidata](https://github.com/phidatahq/phidata)
|
280
|
+
|
281
|
+
|
282
|
+
Thanks for their great work!
|
agentica-0.2.1/README.md
ADDED
@@ -0,0 +1,251 @@
|
|
1
|
+
[**🇨🇳中文**](https://github.com/shibing624/agentica/blob/main/README.md) | [**🌐English**](https://github.com/shibing624/agentica/blob/main/README_EN.md) | [**🇯🇵日本語**](https://github.com/shibing624/agentica/blob/main/README_JP.md)
|
2
|
+
|
3
|
+
<div align="center">
|
4
|
+
<a href="https://github.com/shibing624/agentica">
|
5
|
+
<img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/logo.png" height="150" alt="Logo">
|
6
|
+
</a>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
-----------------
|
10
|
+
|
11
|
+
# Agentica: Build AI Agents
|
12
|
+
[](https://badge.fury.io/py/agentica)
|
13
|
+
[](https://pepy.tech/project/agentica)
|
14
|
+
[](CONTRIBUTING.md)
|
15
|
+
[](LICENSE)
|
16
|
+
[](requirements.txt)
|
17
|
+
[](https://github.com/shibing624/agentica/issues)
|
18
|
+
[](#Contact)
|
19
|
+
|
20
|
+
|
21
|
+
**Agentica**: Build Smarter, Reflective, and Collaborative AI Agents with Ease!
|
22
|
+
|
23
|
+
**Agentica**: 快速打造智能、能反思、协作的AI Agent。
|
24
|
+
|
25
|
+
## Overview
|
26
|
+
|
27
|
+
#### LLM Agent
|
28
|
+
<img src="https://github.com/shibing624/agentica/blob/main/docs/llm_agentv2.png" width="800" />
|
29
|
+
|
30
|
+
- **规划(Planning)**:任务拆解、生成计划、反思
|
31
|
+
- **记忆(Memory)**:短期记忆(prompt实现)、长期记忆(RAG实现)
|
32
|
+
- **工具使用(Tool use)**:function call能力,调用外部API,以获取外部信息,包括当前日期、日历、代码执行能力、对专用信息源的访问等
|
33
|
+
|
34
|
+
#### Agentica Architecture
|
35
|
+
<img src="https://github.com/shibing624/agentica/blob/main/docs/agent_arch.png" width="800" />
|
36
|
+
|
37
|
+
- **Planner**:负责让LLM生成一个多步计划来完成复杂任务,生成相互依赖的“链式计划”,定义每一步所依赖的上一步的输出
|
38
|
+
- **Worker**:接受“链式计划”,循环遍历计划中的每个子任务,并调用工具完成任务,可以自动反思纠错以完成任务
|
39
|
+
- **Solver**:求解器将所有这些输出整合为最终答案
|
40
|
+
|
41
|
+
|
42
|
+
## Features
|
43
|
+
`Agentica`是一个用于构建Agent的工具,具有以下功能:
|
44
|
+
|
45
|
+
- **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Multi-Role、Workflow等功能
|
46
|
+
- **自定义prompt**:Agent支持自定义prompt和多种工具调用(tool_calls)
|
47
|
+
- **LLM集成**:支持OpenAI、Azure、Deepseek、Moonshot、Claude、Ollama、Together等多方大模型厂商的API
|
48
|
+
- **记忆功能**:包括短期记忆和长期记忆功能
|
49
|
+
- **Multi-Agent协作**:支持多Agent和多角色的团队协作。
|
50
|
+
- **Workflow工作流**:拆解复杂任务为多个Agent,基于工作流自动化串行逐步完成任务,如投资研究、新闻文章撰写和技术教程创建
|
51
|
+
- **自我进化Agent**:具有反思和增强记忆能力的自我进化Agent
|
52
|
+
- **Web UI**:兼容ChatPilot,可以基于Web页面交互,支持主流的open-webui、streamlit、gradio等前端交互框架
|
53
|
+
|
54
|
+
## Installation
|
55
|
+
|
56
|
+
```bash
|
57
|
+
pip install -U agentica
|
58
|
+
```
|
59
|
+
|
60
|
+
or
|
61
|
+
|
62
|
+
```bash
|
63
|
+
git clone https://github.com/shibing624/agentica.git
|
64
|
+
cd agentica
|
65
|
+
pip install .
|
66
|
+
```
|
67
|
+
|
68
|
+
## Getting Started
|
69
|
+
|
70
|
+
#### Run the example
|
71
|
+
```shell
|
72
|
+
# Copying required .env file, and fill in the LLM api key
|
73
|
+
cp .env.example ~/.agentica/.env
|
74
|
+
|
75
|
+
cd examples
|
76
|
+
python web_search_moonshot_demo.py
|
77
|
+
```
|
78
|
+
|
79
|
+
1. 复制[.env.example](https://github.com/shibing624/agentica/blob/main/.env.example)文件为`~/.agentica/.env`,并填写LLM api key(选填DEEPSEEK_API_KEY、MOONSHOT_API_KEY、OPENAI_API_KEY等任一个即可)。或者使用`export`命令设置环境变量:
|
80
|
+
|
81
|
+
```shell
|
82
|
+
export MOONSHOT_API_KEY=your_moonshot_api_key
|
83
|
+
export SERPER_API_KEY=your_serper_api_key
|
84
|
+
```
|
85
|
+
|
86
|
+
2. 使用`agentica`构建Agent并执行:
|
87
|
+
|
88
|
+
自动调用google搜索工具,示例[examples/12_web_search_moonshot_demo.py](https://github.com/shibing624/agentica/blob/main/examples/12_web_search_moonshot_demo.py)
|
89
|
+
|
90
|
+
```python
|
91
|
+
from agentica import Agent, MoonshotChat, SearchSerperTool
|
92
|
+
|
93
|
+
m = Agent(model=MoonshotChat(), tools=[SearchSerperTool()], add_datetime_to_instructions=True)
|
94
|
+
r = m.run("下一届奥运会在哪里举办")
|
95
|
+
print(r)
|
96
|
+
```
|
97
|
+
|
98
|
+
|
99
|
+
## Web UI
|
100
|
+
|
101
|
+
[shibing624/ChatPilot](https://github.com/shibing624/ChatPilot) 兼容`agentica`,可以通过Web UI进行交互。
|
102
|
+
|
103
|
+
Web Demo: https://chat.mulanai.com
|
104
|
+
|
105
|
+
<img src="https://github.com/shibing624/ChatPilot/blob/main/docs/shot.png" width="800" />
|
106
|
+
|
107
|
+
```shell
|
108
|
+
git clone https://github.com/shibing624/ChatPilot.git
|
109
|
+
cd ChatPilot
|
110
|
+
pip install -r requirements.txt
|
111
|
+
|
112
|
+
cp .env.example .env
|
113
|
+
|
114
|
+
bash start.sh
|
115
|
+
```
|
116
|
+
|
117
|
+
|
118
|
+
## Examples
|
119
|
+
|
120
|
+
|
121
|
+
| 示例 | 描述 |
|
122
|
+
|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
|
123
|
+
| [examples/01_llm_demo.py](https://github.com/shibing624/agentica/blob/main/examples/01_llm_demo.py) | LLM问答Demo |
|
124
|
+
| [examples/02_user_prompt_demo.py](https://github.com/shibing624/agentica/blob/main/examples/02_user_prompt_demo.py) | 自定义用户prompt的Demo |
|
125
|
+
| [examples/03_user_messages_demo.py](https://github.com/shibing624/agentica/blob/main/examples/03_user_messages_demo.py) | 自定义输入用户消息的Demo |
|
126
|
+
| [examples/04_memory_demo.py](https://github.com/shibing624/agentica/blob/main/examples/04_memory_demo.py) | Agent的记忆Demo |
|
127
|
+
| [examples/05_response_model_demo.py](https://github.com/shibing624/agentica/blob/main/examples/05_response_model_demo.py) | 按指定格式(pydantic的BaseModel)回复的Demo |
|
128
|
+
| [examples/06_calc_with_csv_file_demo.py](https://github.com/shibing624/agentica/blob/main/examples/06_calc_with_csv_file_demo.py) | LLM加载CSV文件,并执行计算来回答的Demo |
|
129
|
+
| [examples/07_create_image_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/07_create_image_tool_demo.py) | 实现了创建图像工具的Demo |
|
130
|
+
| [examples/08_ocr_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/08_ocr_tool_demo.py) | 实现了OCR工具的Demo |
|
131
|
+
| [examples/09_remove_image_background_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/09_remove_image_background_tool_demo.py) | 实现了自动去除图片背景功能,包括自动通过pip安装库,调用库实现去除图片背景 |
|
132
|
+
| [examples/10_vision_demo.py](https://github.com/shibing624/agentica/blob/main/examples/10_vision_demo.py) | 视觉理解Demo |
|
133
|
+
| [examples/11_web_search_openai_demo.py](https://github.com/shibing624/agentica/blob/main/examples/11_web_search_openai_demo.py) | 基于OpenAI的function call做网页搜索Demo |
|
134
|
+
| [examples/12_web_search_moonshot_demo.py](https://github.com/shibing624/agentica/blob/main/examples/12_web_search_moonshot_demo.py) | 基于Moonshot的function call做网页搜索Demo |
|
135
|
+
| [examples/13_storage_demo.py](https://github.com/shibing624/agentica/blob/main/examples/13_storage_demo.py) | Agent的存储Demo |
|
136
|
+
| [examples/14_custom_tool_demo.py](https://github.com/shibing624/agentica/blob/main/examples/14_custom_tool_demo.py) | 自定义工具,并用大模型自主选择调用的Demo |
|
137
|
+
| [examples/15_crawl_webpage_demo.py](https://github.com/shibing624/agentica/blob/main/examples/15_crawl_webpage_demo.py) | 实现了网页分析工作流:从Url爬取融资快讯 - 分析网页内容和格式 - 提取核心信息 - 汇总存为md文件 |
|
138
|
+
| [examples/16_get_top_papers_demo.py](https://github.com/shibing624/agentica/blob/main/examples/16_get_top_papers_demo.py) | 解析每日论文,并保存为json格式的Demo |
|
139
|
+
| [examples/17_find_paper_from_arxiv_demo.py](https://github.com/shibing624/agentica/blob/main/examples/17_find_paper_from_arxiv_demo.py) | 实现了论文推荐的Demo:自动从arxiv搜索多组论文 - 相似论文去重 - 提取核心论文信息 - 保存为csv文件 |
|
140
|
+
| [examples/18_agent_input_is_list.py](https://github.com/shibing624/agentica/blob/main/examples/18_agent_input_is_list.py) | 展示Agent的message可以是列表的Demo |
|
141
|
+
| [examples/19_naive_rag_demo.py](https://github.com/shibing624/agentica/blob/main/examples/19_naive_rag_demo.py) | 实现了基础版RAG,基于Txt文档回答问题 |
|
142
|
+
| [examples/20_advanced_rag_demo.py](https://github.com/shibing624/agentica/blob/main/examples/20_advanced_rag_demo.py) | 实现了高级版RAG,基于PDF文档回答问题,新增功能:pdf文件解析、query改写,字面+语义多路混合召回,召回排序(rerank) |
|
143
|
+
| [examples/21_memorydb_rag_demo.py](https://github.com/shibing624/agentica/blob/main/examples/21_reference_in_prompt_rag_demo.py) | 把参考资料放到prompt的传统RAG做法的Demo |
|
144
|
+
| [examples/22_chat_pdf_app_demo.py](https://github.com/shibing624/agentica/blob/main/examples/22_chat_pdf_app_demo.py) | 对PDF文档做深入对话的Demo |
|
145
|
+
| [examples/23_python_agent_memory_demo.py](https://github.com/shibing624/agentica/blob/main/examples/23_python_agent_memory_demo.py) | 实现了带记忆的Code Interpreter功能,自动生成python代码并执行,下次执行时从记忆获取结果 |
|
146
|
+
| [examples/24_context_demo.py](https://github.com/shibing624/agentica/blob/main/examples/24_context_demo.py) | 实现了传入上下文进行对话的Demo |
|
147
|
+
| [examples/25_tools_with_context_demo.py](https://github.com/shibing624/agentica/blob/main/examples/25_tools_with_context_demo.py) | 工具带上下文传参的Demo |
|
148
|
+
| [examples/26_complex_translate_demo.py](https://github.com/shibing624/agentica/blob/main/examples/26_complex_translate_demo.py) | 实现了复杂翻译Demo |
|
149
|
+
| [examples/27_research_agent_demo.py](https://github.com/shibing624/agentica/blob/main/examples/27_research_agent_demo.py) | 实现了Research功能,自动调用搜索工具,汇总信息后撰写科技报告 |
|
150
|
+
| [examples/28_rag_integrated_langchain_demo.py](https://github.com/shibing624/agentica/blob/main/examples/28_rag_integrated_langchain_demo.py) | 集成LangChain的RAG Demo |
|
151
|
+
| [examples/29_rag_integrated_llamaindex_demo.py](https://github.com/shibing624/agentica/blob/main/examples/29_rag_integrated_llamaindex_demo.py) | 集成LlamaIndex的RAG Demo |
|
152
|
+
| [examples/30_text_classification_demo.py](https://github.com/shibing624/agentica/blob/main/examples/30_text_classification_demo.py) | 实现了自动训练分类模型的Agent:读取训练集文件并理解格式 - 谷歌搜索pytextclassifier库 - 爬取github页面了解pytextclassifier的调用方法 - 写代码并执行fasttext模型训练 - check训练好的模型预测结果 |
|
153
|
+
| [examples/31_team_news_article_demo.py](https://github.com/shibing624/agentica/blob/main/examples/31_team_news_article_demo.py) | Team实现:写新闻稿的team协作,multi-role实现,委托不用角色完成各自任务:研究员检索分析文章,撰写员根据排版写文章,汇总多角色成果输出结果 |
|
154
|
+
| [examples/32_team_debate_demo.py](https://github.com/shibing624/agentica/blob/main/examples/32_team_debate_demo.py) | Team实现:基于委托做双人辩论Demo,特朗普和拜登辩论 |
|
155
|
+
| [examples/33_self_evolving_agent_demo.py](https://github.com/shibing624/agentica/blob/main/examples/33_self_evolving_agent_demo.py) | 实现了自我进化Agent的Demo |
|
156
|
+
| [examples/34_llm_os_demo.py](https://github.com/shibing624/agentica/blob/main/examples/34_llm_os_demo.py) | 实现了LLM OS的初步设计,基于LLM设计操作系统,可以通过LLM调用RAG、代码执行器、Shell等工具,并协同代码解释器、研究助手、投资助手等来解决问题。 |
|
157
|
+
| [examples/35_workflow_investment_demo.py](https://github.com/shibing624/agentica/blob/main/examples/35_workflow_investment_demo.py) | 实现了投资研究的工作流:股票信息收集 - 股票分析 - 撰写分析报告 - 复查报告等多个Task |
|
158
|
+
| [examples/36_workflow_news_article_demo.py](https://github.com/shibing624/agentica/blob/main/examples/36_workflow_news_article_demo.py) | 实现了写新闻稿的工作流,multi-agent的实现,多次调用搜索工具,并生成高级排版的新闻文章 |
|
159
|
+
| [examples/37_workflow_write_novel_demo.py](https://github.com/shibing624/agentica/blob/main/examples/37_workflow_write_novel_demo.py) | 实现了写小说的工作流:定小说提纲 - 搜索谷歌反思提纲 - 撰写小说内容 - 保存为md文件 |
|
160
|
+
| [examples/38_workflow_write_tutorial_demo.py](https://github.com/shibing624/agentica/blob/main/examples/38_workflow_write_tutorial_demo.py) | 实现了写技术教程的工作流:定教程目录 - 反思目录内容 - 撰写教程内容 - 保存为md文件 |
|
161
|
+
| [examples/39_audio_multi_turn_demo.py](https://github.com/shibing624/agentica/blob/main/examples/39_audio_multi_turn_demo.py) | 基于openai的语音api做多轮音频对话的Demo |
|
162
|
+
|
163
|
+
|
164
|
+
### Self-evolving Agent
|
165
|
+
The self-evolving agent design:
|
166
|
+
|
167
|
+
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/sage_arch.png" width="800" />
|
168
|
+
|
169
|
+
#### Feature
|
170
|
+
|
171
|
+
具有反思和增强记忆能力的自我进化智能体(self-evolving Agents with Reflective and Memory-augmented Abilities, SAGE)
|
172
|
+
|
173
|
+
实现方法:
|
174
|
+
|
175
|
+
1. 使用PythonAgent作为SAGE智能体,使用AzureOpenAIChat作为LLM, 具备code-interpreter功能,可以执行Python代码,并自动纠错。
|
176
|
+
2. 使用CsvMemoryDb作为SAGE智能体的记忆,用于存储用户的问题和答案,下次遇到相似的问题时,可以直接返回答案。
|
177
|
+
|
178
|
+
#### Run Self-evolving Agent App
|
179
|
+
|
180
|
+
```shell
|
181
|
+
cd examples
|
182
|
+
streamlit run 33_self_evolving_agent_demo.py
|
183
|
+
```
|
184
|
+
|
185
|
+
<img alt="sage_snap" src="https://github.com/shibing624/agentica/blob/main/docs/sage_snap.png" width="800" />
|
186
|
+
|
187
|
+
|
188
|
+
### LLM OS
|
189
|
+
The LLM OS design:
|
190
|
+
|
191
|
+
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llmos.png" width="800" />
|
192
|
+
|
193
|
+
#### Run the LLM OS App
|
194
|
+
|
195
|
+
```shell
|
196
|
+
cd examples
|
197
|
+
streamlit run 34_llm_os_demo.py
|
198
|
+
```
|
199
|
+
|
200
|
+
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llm_os_snap.png" width="800" />
|
201
|
+
|
202
|
+
## Contact
|
203
|
+
|
204
|
+
- Issue(建议)
|
205
|
+
:[](https://github.com/shibing624/agentica/issues)
|
206
|
+
- 邮件我:xuming: xuming624@qq.com
|
207
|
+
- 微信我: 加我*微信号:xuming624, 备注:姓名-公司-NLP* 进NLP交流群。
|
208
|
+
|
209
|
+
<img src="https://github.com/shibing624/agentica/blob/main/docs/wechat.jpeg" width="200" />
|
210
|
+
|
211
|
+
## Citation
|
212
|
+
|
213
|
+
如果你在研究中使用了`agentica`,请按如下格式引用:
|
214
|
+
|
215
|
+
APA:
|
216
|
+
|
217
|
+
```
|
218
|
+
Xu, M. agentica: A Human-Centric Framework for Large Language Model Agent Workflows (Version 0.0.2) [Computer software]. https://github.com/shibing624/agentica
|
219
|
+
```
|
220
|
+
|
221
|
+
BibTeX:
|
222
|
+
|
223
|
+
```
|
224
|
+
@misc{Xu_agentica,
|
225
|
+
title={agentica: A Human-Centric Framework for Large Language Model Agent Workflows},
|
226
|
+
author={Xu Ming},
|
227
|
+
year={2024},
|
228
|
+
howpublished={\url{https://github.com/shibing624/agentica}},
|
229
|
+
}
|
230
|
+
```
|
231
|
+
|
232
|
+
## License
|
233
|
+
|
234
|
+
授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加`agentica`的链接和授权协议。
|
235
|
+
## Contribute
|
236
|
+
|
237
|
+
项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
|
238
|
+
|
239
|
+
- 在`tests`添加相应的单元测试
|
240
|
+
- 使用`python -m pytest`来运行所有单元测试,确保所有单测都是通过的
|
241
|
+
|
242
|
+
之后即可提交PR。
|
243
|
+
|
244
|
+
## Acknowledgements
|
245
|
+
|
246
|
+
- [https://github.com/langchain-ai/langchain](https://github.com/langchain-ai/langchain)
|
247
|
+
- [https://github.com/simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
|
248
|
+
- [https://github.com/phidatahq/phidata](https://github.com/phidatahq/phidata)
|
249
|
+
|
250
|
+
|
251
|
+
Thanks for their great work!
|