agentica 0.2.0__tar.gz → 0.2.2__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.2/MANIFEST.in +1 -0
- {agentica-0.2.0 → agentica-0.2.2}/PKG-INFO +44 -23
- {agentica-0.2.0 → agentica-0.2.2}/README.md +43 -22
- {agentica-0.2.0 → agentica-0.2.2}/agentica/__init__.py +22 -4
- {agentica-0.2.0 → agentica-0.2.2}/agentica/knowledge/llamaindex_knowledge.py +9 -10
- {agentica-0.2.0 → agentica-0.2.2}/agentica/memory.py +6 -1
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/content.py +2 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/jina_tool.py +0 -1
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/url_crawler_tool.py +20 -6
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/file_parser.py +51 -87
- agentica-0.2.2/agentica/version.py +1 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/PKG-INFO +44 -23
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/SOURCES.txt +2 -8
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/top_level.txt +0 -1
- {agentica-0.2.0 → agentica-0.2.2}/setup.py +4 -1
- agentica-0.2.0/agentica/version.py +0 -1
- agentica-0.2.0/tests/__init__.py +0 -5
- agentica-0.2.0/tests/test_create_image.py +0 -43
- agentica-0.2.0/tests/test_file_reader.py +0 -65
- agentica-0.2.0/tests/test_jina_tool.py +0 -80
- agentica-0.2.0/tests/test_llm.py +0 -34
- agentica-0.2.0/tests/test_run_nb_code.py +0 -119
- agentica-0.2.0/tests/test_url_crawler.py +0 -120
- {agentica-0.2.0 → agentica-0.2.2}/LICENSE +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/agent.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/agent_session.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/config.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/document.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/azure_openai_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/fireworks_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/genimi_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/hash_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/huggingface_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/ollama_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/openai_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/sentence_transformer_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/text2vec_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/together_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/emb/word2vec_emb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/file/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/file/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/file/csv.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/file/txt.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/knowledge/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/knowledge/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/knowledge/langchain_knowledge.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/memorydb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/anthropic/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/anthropic/claude.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/aws/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/aws/api_client.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/aws/bedrock.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/aws/claude.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/azure/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/azure/openai_chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/cohere/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/cohere/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/deepseek/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/deepseek/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/doubao/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/doubao/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/fireworks/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/fireworks/fireworks.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/google/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/google/gemini.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/google/gemini_openai.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/groq/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/groq/groq.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/huggingface/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/huggingface/hf.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/internlm/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/internlm/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/message.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/mistral/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/mistral/mistral.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/moonshot/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/moonshot/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/nvidia/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/nvidia/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/ollama/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/ollama/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/ollama/hermes.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/ollama/tools.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/openai/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/openai/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/openai/like.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/openrouter/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/openrouter/openrouter.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/response.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/sambanova/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/sambanova/sambanova.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/together/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/together/togetherchat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/vertexai/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/vertexai/gemini.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/xai/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/xai/grok.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/yi/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/model/yi/chat.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/python_agent.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/reasoning.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/reranker/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/reranker/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/reranker/bge.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/reranker/cohere.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/run_response.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/agent/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/agent/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/agent/json_file.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/agent/postgres.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/agent/sqlite.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/agent/yaml_file.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/workflow/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/workflow/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/workflow/postgres.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/storage/workflow/sqlite.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/template.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/airflow_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/analyze_image_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/apify_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/arxiv_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/baidusearch_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/calculator_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/create_image_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/dblp_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/duckduckgo_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/file_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/hackernews_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/newspaper_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/ocr_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/resend_tools.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/run_nb_code_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/run_python_code_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/search_exa_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/search_serper_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/shell_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/sql_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/text_analysis_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/wikipedia_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/tools/yfinance_tool.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/console.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/io.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/json_util.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/log.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/misc.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/shell.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/utils/timer.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/__init__.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/base.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/chromadb_vectordb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/lancedb_vectordb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/memory_vectordb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/pgvectordb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/pineconedb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/vectordb/qdrantdb.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/workflow.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica/workflow_session.py +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/dependency_links.txt +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/entry_points.txt +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/not-zip-safe +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/agentica.egg-info/requires.txt +0 -0
- {agentica-0.2.0 → agentica-0.2.2}/setup.cfg +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
exclude tests/*
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: agentica
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
4
4
|
Summary: LLM agents
|
5
5
|
Home-page: https://github.com/shibing624/agentica
|
6
6
|
Author: XuMing
|
@@ -49,33 +49,54 @@ Requires-Dist: rich
|
|
49
49
|
[](#Contact)
|
50
50
|
|
51
51
|
|
52
|
-
**Agentica**:
|
52
|
+
**Agentica**: Build Smarter, Reflective, and Collaborative AI Agents with Ease!
|
53
53
|
|
54
|
-
|
54
|
+
**Agentica**: 快速打造智能、能反思、协作的AI Agent。
|
55
55
|
|
56
|
-
|
56
|
+
## 📖 Introduction
|
57
|
+
|
58
|
+
**Agentica** can build AI agent, which have the components of planning, memory, and tool use.
|
59
|
+
|
60
|
+
**Agentica** 可以构建AI Agent,包括规划、记忆和工具使用、执行等组件。
|
61
|
+
|
62
|
+
#### Agent Components
|
57
63
|
<img src="https://github.com/shibing624/agentica/blob/main/docs/llm_agentv2.png" width="800" />
|
58
64
|
|
59
65
|
- **规划(Planning)**:任务拆解、生成计划、反思
|
60
66
|
- **记忆(Memory)**:短期记忆(prompt实现)、长期记忆(RAG实现)
|
61
67
|
- **工具使用(Tool use)**:function call能力,调用外部API,以获取外部信息,包括当前日期、日历、代码执行能力、对专用信息源的访问等
|
62
68
|
|
63
|
-
#### Agentica
|
69
|
+
#### Agentica Workflow
|
70
|
+
|
71
|
+
**Agentica** can also build multi-agent systems and workflows.
|
72
|
+
|
73
|
+
**Agentica** 还可以构建多Agent系统和工作流。
|
74
|
+
|
64
75
|
<img src="https://github.com/shibing624/agentica/blob/main/docs/agent_arch.png" width="800" />
|
65
76
|
|
66
77
|
- **Planner**:负责让LLM生成一个多步计划来完成复杂任务,生成相互依赖的“链式计划”,定义每一步所依赖的上一步的输出
|
67
78
|
- **Worker**:接受“链式计划”,循环遍历计划中的每个子任务,并调用工具完成任务,可以自动反思纠错以完成任务
|
68
79
|
- **Solver**:求解器将所有这些输出整合为最终答案
|
69
80
|
|
81
|
+
## 🔥 News
|
82
|
+
[2024/12/25] v0.2.0版本: 支持了多模态模型,输入可以是文本、图片、音频、视频,升级Assistant为Agent,Workflow支持拆解并实现复杂任务,详见[Release-v0.2.0](https://github.com/shibing624/agentica/releases/tag/0.2.0)
|
83
|
+
|
84
|
+
[2024/07/02] v0.1.0版本:实现了基于LLM的Assistant,可以快速用function call搭建大语言模型助手,详见[Release-v0.1.0](https://github.com/shibing624/agentica/releases/tag/0.1.0)
|
85
|
+
|
70
86
|
|
71
|
-
## Features
|
72
|
-
`Agentica
|
87
|
+
## 😊 Features
|
88
|
+
`Agentica`是一个用于构建Agent的工具,具有以下功能:
|
73
89
|
|
74
|
-
-
|
75
|
-
- Agent
|
76
|
-
-
|
90
|
+
- **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Team、Workflow等功能
|
91
|
+
- **自定义prompt**:Agent支持自定义prompt和多种工具调用(tool_calls)
|
92
|
+
- **LLM集成**:支持OpenAI、Azure、Deepseek、Moonshot、Claude、Ollama、Together等多方大模型厂商的API
|
93
|
+
- **记忆功能**:包括短期记忆和长期记忆功能
|
94
|
+
- **Multi-Agent协作**:支持多Agent和任务委托(Team)的团队协作。
|
95
|
+
- **Workflow工作流**:拆解复杂任务为多个Agent,基于工作流自动化串行逐步完成任务,如投资研究、新闻文章撰写和技术教程创建
|
96
|
+
- **自我进化Agent**:具有反思和增强记忆能力的自我进化Agent
|
97
|
+
- **Web UI**:兼容ChatPilot,可以基于Web页面交互,支持主流的open-webui、streamlit、gradio等前端交互框架
|
77
98
|
|
78
|
-
##
|
99
|
+
## 💾 Install
|
79
100
|
|
80
101
|
```bash
|
81
102
|
pip install -U agentica
|
@@ -89,7 +110,7 @@ cd agentica
|
|
89
110
|
pip install .
|
90
111
|
```
|
91
112
|
|
92
|
-
## Getting Started
|
113
|
+
## 🚀 Getting Started
|
93
114
|
|
94
115
|
#### Run the example
|
95
116
|
```shell
|
@@ -109,7 +130,7 @@ python web_search_moonshot_demo.py
|
|
109
130
|
|
110
131
|
2. 使用`agentica`构建Agent并执行:
|
111
132
|
|
112
|
-
自动调用google搜索工具,示例[examples/
|
133
|
+
自动调用google搜索工具,示例[examples/12_web_search_moonshot_demo.py](https://github.com/shibing624/agentica/blob/main/examples/12_web_search_moonshot_demo.py)
|
113
134
|
|
114
135
|
```python
|
115
136
|
from agentica import Agent, MoonshotChat, SearchSerperTool
|
@@ -120,7 +141,7 @@ print(r)
|
|
120
141
|
```
|
121
142
|
|
122
143
|
|
123
|
-
## Web UI
|
144
|
+
## ▶️ Web UI
|
124
145
|
|
125
146
|
[shibing624/ChatPilot](https://github.com/shibing624/ChatPilot) 兼容`agentica`,可以通过Web UI进行交互。
|
126
147
|
|
@@ -139,7 +160,7 @@ bash start.sh
|
|
139
160
|
```
|
140
161
|
|
141
162
|
|
142
|
-
## Examples
|
163
|
+
## 😀 Examples
|
143
164
|
|
144
165
|
|
145
166
|
| 示例 | 描述 |
|
@@ -223,7 +244,7 @@ streamlit run 34_llm_os_demo.py
|
|
223
244
|
|
224
245
|
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llm_os_snap.png" width="800" />
|
225
246
|
|
226
|
-
## Contact
|
247
|
+
## ☎️ Contact
|
227
248
|
|
228
249
|
- Issue(建议)
|
229
250
|
:[](https://github.com/shibing624/agentica/issues)
|
@@ -232,7 +253,7 @@ streamlit run 34_llm_os_demo.py
|
|
232
253
|
|
233
254
|
<img src="https://github.com/shibing624/agentica/blob/main/docs/wechat.jpeg" width="200" />
|
234
255
|
|
235
|
-
## Citation
|
256
|
+
## 😇 Citation
|
236
257
|
|
237
258
|
如果你在研究中使用了`agentica`,请按如下格式引用:
|
238
259
|
|
@@ -253,10 +274,10 @@ BibTeX:
|
|
253
274
|
}
|
254
275
|
```
|
255
276
|
|
256
|
-
## License
|
277
|
+
## ⚠️ License
|
257
278
|
|
258
279
|
授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加`agentica`的链接和授权协议。
|
259
|
-
## Contribute
|
280
|
+
## 😍 Contribute
|
260
281
|
|
261
282
|
项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
|
262
283
|
|
@@ -265,11 +286,11 @@ BibTeX:
|
|
265
286
|
|
266
287
|
之后即可提交PR。
|
267
288
|
|
268
|
-
## Acknowledgements
|
289
|
+
## 💕 Acknowledgements
|
269
290
|
|
270
|
-
- [
|
271
|
-
- [
|
272
|
-
- [
|
291
|
+
- [langchain-ai/langchain](https://github.com/langchain-ai/langchain)
|
292
|
+
- [simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
|
293
|
+
- [phidatahq/phidata](https://github.com/phidatahq/phidata)
|
273
294
|
|
274
295
|
|
275
296
|
Thanks for their great work!
|
@@ -18,33 +18,54 @@
|
|
18
18
|
[](#Contact)
|
19
19
|
|
20
20
|
|
21
|
-
**Agentica**:
|
21
|
+
**Agentica**: Build Smarter, Reflective, and Collaborative AI Agents with Ease!
|
22
22
|
|
23
|
-
|
23
|
+
**Agentica**: 快速打造智能、能反思、协作的AI Agent。
|
24
24
|
|
25
|
-
|
25
|
+
## 📖 Introduction
|
26
|
+
|
27
|
+
**Agentica** can build AI agent, which have the components of planning, memory, and tool use.
|
28
|
+
|
29
|
+
**Agentica** 可以构建AI Agent,包括规划、记忆和工具使用、执行等组件。
|
30
|
+
|
31
|
+
#### Agent Components
|
26
32
|
<img src="https://github.com/shibing624/agentica/blob/main/docs/llm_agentv2.png" width="800" />
|
27
33
|
|
28
34
|
- **规划(Planning)**:任务拆解、生成计划、反思
|
29
35
|
- **记忆(Memory)**:短期记忆(prompt实现)、长期记忆(RAG实现)
|
30
36
|
- **工具使用(Tool use)**:function call能力,调用外部API,以获取外部信息,包括当前日期、日历、代码执行能力、对专用信息源的访问等
|
31
37
|
|
32
|
-
#### Agentica
|
38
|
+
#### Agentica Workflow
|
39
|
+
|
40
|
+
**Agentica** can also build multi-agent systems and workflows.
|
41
|
+
|
42
|
+
**Agentica** 还可以构建多Agent系统和工作流。
|
43
|
+
|
33
44
|
<img src="https://github.com/shibing624/agentica/blob/main/docs/agent_arch.png" width="800" />
|
34
45
|
|
35
46
|
- **Planner**:负责让LLM生成一个多步计划来完成复杂任务,生成相互依赖的“链式计划”,定义每一步所依赖的上一步的输出
|
36
47
|
- **Worker**:接受“链式计划”,循环遍历计划中的每个子任务,并调用工具完成任务,可以自动反思纠错以完成任务
|
37
48
|
- **Solver**:求解器将所有这些输出整合为最终答案
|
38
49
|
|
50
|
+
## 🔥 News
|
51
|
+
[2024/12/25] v0.2.0版本: 支持了多模态模型,输入可以是文本、图片、音频、视频,升级Assistant为Agent,Workflow支持拆解并实现复杂任务,详见[Release-v0.2.0](https://github.com/shibing624/agentica/releases/tag/0.2.0)
|
52
|
+
|
53
|
+
[2024/07/02] v0.1.0版本:实现了基于LLM的Assistant,可以快速用function call搭建大语言模型助手,详见[Release-v0.1.0](https://github.com/shibing624/agentica/releases/tag/0.1.0)
|
54
|
+
|
39
55
|
|
40
|
-
## Features
|
41
|
-
`Agentica
|
56
|
+
## 😊 Features
|
57
|
+
`Agentica`是一个用于构建Agent的工具,具有以下功能:
|
42
58
|
|
43
|
-
-
|
44
|
-
- Agent
|
45
|
-
-
|
59
|
+
- **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Team、Workflow等功能
|
60
|
+
- **自定义prompt**:Agent支持自定义prompt和多种工具调用(tool_calls)
|
61
|
+
- **LLM集成**:支持OpenAI、Azure、Deepseek、Moonshot、Claude、Ollama、Together等多方大模型厂商的API
|
62
|
+
- **记忆功能**:包括短期记忆和长期记忆功能
|
63
|
+
- **Multi-Agent协作**:支持多Agent和任务委托(Team)的团队协作。
|
64
|
+
- **Workflow工作流**:拆解复杂任务为多个Agent,基于工作流自动化串行逐步完成任务,如投资研究、新闻文章撰写和技术教程创建
|
65
|
+
- **自我进化Agent**:具有反思和增强记忆能力的自我进化Agent
|
66
|
+
- **Web UI**:兼容ChatPilot,可以基于Web页面交互,支持主流的open-webui、streamlit、gradio等前端交互框架
|
46
67
|
|
47
|
-
##
|
68
|
+
## 💾 Install
|
48
69
|
|
49
70
|
```bash
|
50
71
|
pip install -U agentica
|
@@ -58,7 +79,7 @@ cd agentica
|
|
58
79
|
pip install .
|
59
80
|
```
|
60
81
|
|
61
|
-
## Getting Started
|
82
|
+
## 🚀 Getting Started
|
62
83
|
|
63
84
|
#### Run the example
|
64
85
|
```shell
|
@@ -78,7 +99,7 @@ python web_search_moonshot_demo.py
|
|
78
99
|
|
79
100
|
2. 使用`agentica`构建Agent并执行:
|
80
101
|
|
81
|
-
自动调用google搜索工具,示例[examples/
|
102
|
+
自动调用google搜索工具,示例[examples/12_web_search_moonshot_demo.py](https://github.com/shibing624/agentica/blob/main/examples/12_web_search_moonshot_demo.py)
|
82
103
|
|
83
104
|
```python
|
84
105
|
from agentica import Agent, MoonshotChat, SearchSerperTool
|
@@ -89,7 +110,7 @@ print(r)
|
|
89
110
|
```
|
90
111
|
|
91
112
|
|
92
|
-
## Web UI
|
113
|
+
## ▶️ Web UI
|
93
114
|
|
94
115
|
[shibing624/ChatPilot](https://github.com/shibing624/ChatPilot) 兼容`agentica`,可以通过Web UI进行交互。
|
95
116
|
|
@@ -108,7 +129,7 @@ bash start.sh
|
|
108
129
|
```
|
109
130
|
|
110
131
|
|
111
|
-
## Examples
|
132
|
+
## 😀 Examples
|
112
133
|
|
113
134
|
|
114
135
|
| 示例 | 描述 |
|
@@ -192,7 +213,7 @@ streamlit run 34_llm_os_demo.py
|
|
192
213
|
|
193
214
|
<img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llm_os_snap.png" width="800" />
|
194
215
|
|
195
|
-
## Contact
|
216
|
+
## ☎️ Contact
|
196
217
|
|
197
218
|
- Issue(建议)
|
198
219
|
:[](https://github.com/shibing624/agentica/issues)
|
@@ -201,7 +222,7 @@ streamlit run 34_llm_os_demo.py
|
|
201
222
|
|
202
223
|
<img src="https://github.com/shibing624/agentica/blob/main/docs/wechat.jpeg" width="200" />
|
203
224
|
|
204
|
-
## Citation
|
225
|
+
## 😇 Citation
|
205
226
|
|
206
227
|
如果你在研究中使用了`agentica`,请按如下格式引用:
|
207
228
|
|
@@ -222,10 +243,10 @@ BibTeX:
|
|
222
243
|
}
|
223
244
|
```
|
224
245
|
|
225
|
-
## License
|
246
|
+
## ⚠️ License
|
226
247
|
|
227
248
|
授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加`agentica`的链接和授权协议。
|
228
|
-
## Contribute
|
249
|
+
## 😍 Contribute
|
229
250
|
|
230
251
|
项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
|
231
252
|
|
@@ -234,11 +255,11 @@ BibTeX:
|
|
234
255
|
|
235
256
|
之后即可提交PR。
|
236
257
|
|
237
|
-
## Acknowledgements
|
258
|
+
## 💕 Acknowledgements
|
238
259
|
|
239
|
-
- [
|
240
|
-
- [
|
241
|
-
- [
|
260
|
+
- [langchain-ai/langchain](https://github.com/langchain-ai/langchain)
|
261
|
+
- [simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
|
262
|
+
- [phidatahq/phidata](https://github.com/phidatahq/phidata)
|
242
263
|
|
243
264
|
|
244
265
|
Thanks for their great work!
|
@@ -23,16 +23,30 @@ from agentica.model.xai.grok import GrokChat
|
|
23
23
|
from agentica.model.yi.chat import YiChat
|
24
24
|
|
25
25
|
# memory
|
26
|
-
from agentica.model.base import Model
|
26
|
+
from agentica.model.base import Model
|
27
|
+
from agentica.model.message import Message,MessageReferences
|
28
|
+
from agentica.model.content import Media, Video, Audio, Image
|
29
|
+
from agentica.model.response import ModelResponse, FileType
|
27
30
|
from agentica.memory import (
|
31
|
+
AgentRun,
|
32
|
+
SessionSummary,
|
28
33
|
Memory,
|
29
|
-
MemoryRetrieval,
|
30
|
-
MemoryClassifier,
|
31
34
|
MemoryManager,
|
35
|
+
MemoryClassifier,
|
36
|
+
MemoryRetrieval,
|
37
|
+
MemorySummarizer,
|
32
38
|
AgentMemory,
|
39
|
+
WorkflowRun,
|
33
40
|
WorkflowMemory,
|
34
41
|
)
|
35
|
-
from agentica.memorydb import
|
42
|
+
from agentica.memorydb import (
|
43
|
+
MemoryDb,
|
44
|
+
CsvMemoryDb,
|
45
|
+
InMemoryDb,
|
46
|
+
SqliteMemoryDb,
|
47
|
+
PgMemoryDb,
|
48
|
+
MemoryRow
|
49
|
+
)
|
36
50
|
from agentica.template import PromptTemplate
|
37
51
|
# rag
|
38
52
|
from agentica.run_response import (
|
@@ -41,7 +55,11 @@ from agentica.run_response import (
|
|
41
55
|
RunResponseExtraData,
|
42
56
|
pprint_run_response,
|
43
57
|
)
|
58
|
+
# knowledge
|
44
59
|
from agentica.knowledge.base import Knowledge
|
60
|
+
from agentica.knowledge.llamaindex_knowledge import LlamaIndexKnowledge
|
61
|
+
from agentica.knowledge.langchain_knowledge import LangChainKnowledge
|
62
|
+
# document
|
45
63
|
from agentica.document import Document
|
46
64
|
# vectordb
|
47
65
|
from agentica.vectordb.base import SearchType, Distance, VectorDb
|
@@ -4,27 +4,26 @@
|
|
4
4
|
@description:
|
5
5
|
part of the code from https://github.com/phidatahq/phidata
|
6
6
|
"""
|
7
|
-
from typing import List, Optional, Callable
|
7
|
+
from typing import List, Optional, Callable, Any
|
8
8
|
|
9
9
|
from agentica.document import Document
|
10
10
|
from agentica.knowledge.base import Knowledge
|
11
11
|
from agentica.utils.log import logger
|
12
12
|
|
13
|
-
try:
|
14
|
-
from llama_index.core.schema import NodeWithScore
|
15
|
-
from llama_index.core.retrievers import BaseRetriever
|
16
|
-
except ImportError:
|
17
|
-
raise ImportError(
|
18
|
-
"The `llama-index-core` package is not installed. Please install it via `pip install llama-index-core`."
|
19
|
-
)
|
20
|
-
|
21
13
|
|
22
14
|
class LlamaIndexKnowledge(Knowledge):
|
23
|
-
retriever:
|
15
|
+
retriever: Any
|
24
16
|
loader: Optional[Callable] = None
|
25
17
|
|
26
18
|
def search(self, query: str, num_documents: Optional[int] = None, filters=None) -> List[Document]:
|
27
19
|
"""Returns relevant documents matching the query."""
|
20
|
+
try:
|
21
|
+
from llama_index.core.schema import NodeWithScore
|
22
|
+
from llama_index.core.retrievers import BaseRetriever
|
23
|
+
except ImportError:
|
24
|
+
raise ImportError(
|
25
|
+
"The `llama-index-core` package is not installed. Please install it via `pip install llama-index-core`."
|
26
|
+
)
|
28
27
|
if not isinstance(self.retriever, BaseRetriever):
|
29
28
|
raise ValueError(f"Retriever is not of type BaseRetriever: {self.retriever}")
|
30
29
|
|
@@ -12,13 +12,18 @@ from typing import Dict, List, Any, Optional, cast, Tuple, Literal
|
|
12
12
|
from copy import deepcopy
|
13
13
|
from pydantic import BaseModel, ConfigDict, Field, ValidationError
|
14
14
|
|
15
|
-
from agentica.memorydb import MemoryDb,MemoryRow
|
15
|
+
from agentica.memorydb import MemoryDb, MemoryRow
|
16
16
|
from agentica.model.openai import OpenAIChat
|
17
17
|
from agentica.model.base import Model
|
18
18
|
from agentica.model.message import Message
|
19
19
|
from agentica.utils.log import logger
|
20
20
|
from agentica.run_response import RunResponse
|
21
21
|
|
22
|
+
__all__ = [
|
23
|
+
"AgentRun", "SessionSummary", "Memory", "MemoryManager", "MemoryClassifier", "MemoryRetrieval",
|
24
|
+
"MemorySummarizer", "AgentMemory", "WorkflowMemory", "WorkflowRun"
|
25
|
+
]
|
26
|
+
|
22
27
|
|
23
28
|
class AgentRun(BaseModel):
|
24
29
|
message: Optional[Message] = None
|
@@ -6,6 +6,7 @@
|
|
6
6
|
import hashlib
|
7
7
|
import os
|
8
8
|
import re
|
9
|
+
import json
|
9
10
|
from urllib.parse import urlparse
|
10
11
|
|
11
12
|
import markdownify
|
@@ -17,9 +18,14 @@ from agentica.utils.log import logger
|
|
17
18
|
|
18
19
|
|
19
20
|
class UrlCrawlerTool(Toolkit):
|
20
|
-
def __init__(
|
21
|
+
def __init__(
|
22
|
+
self,
|
23
|
+
base_dir: str = os.path.curdir,
|
24
|
+
max_content_length: int = 8000,
|
25
|
+
):
|
21
26
|
super().__init__(name="url_crawler_tool")
|
22
27
|
self.base_dir = base_dir
|
28
|
+
self.max_content_length = max_content_length
|
23
29
|
self.register(self.url_crawl)
|
24
30
|
|
25
31
|
@staticmethod
|
@@ -67,7 +73,14 @@ class UrlCrawlerTool(Toolkit):
|
|
67
73
|
webpage_text = "# " + title + "\n\n" + webpage_text
|
68
74
|
return webpage_text
|
69
75
|
|
70
|
-
def
|
76
|
+
def _trim_content(self, content: str) -> str:
|
77
|
+
"""Trim to the maximum allowed length."""
|
78
|
+
if len(content) > self.max_content_length:
|
79
|
+
truncated = content[: self.max_content_length]
|
80
|
+
return truncated + "... (content truncated)"
|
81
|
+
return content
|
82
|
+
|
83
|
+
def url_crawl(self, url: str) -> str:
|
71
84
|
"""Crawl a website and return the content of the website as a json string.
|
72
85
|
|
73
86
|
Args:
|
@@ -81,7 +94,7 @@ class UrlCrawlerTool(Toolkit):
|
|
81
94
|
print(url, '\n\n', r)
|
82
95
|
|
83
96
|
Returns:
|
84
|
-
|
97
|
+
str: The content of the website as a json string.
|
85
98
|
"""
|
86
99
|
filename = self._generate_file_name_from_url(url)
|
87
100
|
save_path = os.path.realpath(os.path.join(self.base_dir, filename))
|
@@ -92,7 +105,7 @@ class UrlCrawlerTool(Toolkit):
|
|
92
105
|
headers = {
|
93
106
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36",
|
94
107
|
}
|
95
|
-
response = requests.get(url, stream=True, headers=headers, timeout=
|
108
|
+
response = requests.get(url, stream=True, headers=headers, timeout=60, verify=False)
|
96
109
|
response.raise_for_status()
|
97
110
|
|
98
111
|
content_type = response.headers.get("content-type", "")
|
@@ -113,10 +126,11 @@ class UrlCrawlerTool(Toolkit):
|
|
113
126
|
logger.debug(f"Failed to crawl: {url}: {e}")
|
114
127
|
crawler_result = {
|
115
128
|
"url": url,
|
116
|
-
"content": content,
|
129
|
+
"content": self._trim_content(content),
|
117
130
|
"save_path": save_path,
|
118
131
|
}
|
119
|
-
|
132
|
+
result = json.dumps(crawler_result, ensure_ascii=False)
|
133
|
+
return result
|
120
134
|
|
121
135
|
|
122
136
|
if __name__ == '__main__':
|