Skip to content

Commit 0cbd4d2

Browse files
committed
update rag&memory V1.0
1 parent 28e38ac commit 0cbd4d2

45 files changed

Lines changed: 9310 additions & 74 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/memory/index.md

Lines changed: 1402 additions & 0 deletions
Large diffs are not rendered by default.

examples/chapter08_memory_rag.py

Lines changed: 743 additions & 0 deletions
Large diffs are not rendered by default.

examples/chapter09_memory_rag.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/demo_config.json

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
{
2+
"demo_settings": {
3+
"name": "统一多模态智能体演示",
4+
"version": "1.0.0",
5+
"description": "展示Memory + RAG + Vision + Video的综合能力"
6+
},
7+
8+
"llm_config": {
9+
"provider": "openai",
10+
"model": "gpt-3.5-turbo",
11+
"temperature": 0.7,
12+
"max_tokens": 2000
13+
},
14+
15+
"memory_config": {
16+
"user_id": "demo_user",
17+
"memory_types": ["working", "episodic", "semantic", "perceptual"],
18+
"working_memory_capacity": 10,
19+
"importance_threshold": 0.3,
20+
"decay_factor": 0.95
21+
},
22+
23+
"rag_config": {
24+
"knowledge_base_path": "./unified_knowledge_base",
25+
"embedding_model": "sentence-transformers",
26+
"retrieval_strategy": "vector",
27+
"chunk_size": 500,
28+
"chunk_overlap": 50,
29+
"top_k": 3,
30+
"min_score": 0.1
31+
},
32+
33+
"vision_config": {
34+
"api_provider": "openai",
35+
"api_key": null,
36+
"default_sample_type": "nature",
37+
"supported_formats": ["jpg", "jpeg", "png", "webp"],
38+
"max_image_size": "2MB",
39+
"analysis_features": {
40+
"object_detection": true,
41+
"scene_classification": true,
42+
"color_analysis": true,
43+
"composition_analysis": true,
44+
"mood_detection": true,
45+
"text_extraction": true
46+
}
47+
},
48+
49+
"video_config": {
50+
"supported_formats": ["mp4", "avi", "mov", "webm"],
51+
"max_duration": "30:00",
52+
"keyframe_interval": 30,
53+
"analysis_features": {
54+
"content_analysis": true,
55+
"keyframe_extraction": true,
56+
"audio_analysis": true,
57+
"visual_elements": true,
58+
"engagement_metrics": true
59+
}
60+
},
61+
62+
"sample_resources": {
63+
"images": {
64+
"architecture": {
65+
"url": "https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?w=800",
66+
"description": "现代建筑摄影",
67+
"tags": ["建筑", "现代", "玻璃", "城市"],
68+
"license": "Unsplash License"
69+
},
70+
"nature": {
71+
"url": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800",
72+
"description": "自然风景照片",
73+
"tags": ["自然", "山脉", "湖泊", "风景"],
74+
"license": "Unsplash License"
75+
},
76+
"technology": {
77+
"url": "https://images.unsplash.com/photo-1518709268805-4e9042af2176?w=800",
78+
"description": "科技产品图片",
79+
"tags": ["科技", "电脑", "编程", "代码"],
80+
"license": "Unsplash License"
81+
},
82+
"food": {
83+
"url": "https://images.unsplash.com/photo-1565299624946-b28f40a0ca4b?w=800",
84+
"description": "美食摄影",
85+
"tags": ["美食", "披萨", "餐厅", "意大利"],
86+
"license": "Unsplash License"
87+
}
88+
},
89+
90+
"videos": {
91+
"python_tutorial": {
92+
"title": "Python编程基础教程",
93+
"description": "适合初学者的Python编程入门课程",
94+
"duration": "18:45",
95+
"topics": ["Python语法", "变量", "函数", "循环"],
96+
"difficulty": "初级",
97+
"url": "https://example.com/python_tutorial.mp4",
98+
"license": "Creative Commons"
99+
},
100+
"ai_introduction": {
101+
"title": "人工智能入门介绍",
102+
"description": "AI基础概念和应用领域介绍",
103+
"duration": "25:30",
104+
"topics": ["机器学习", "深度学习", "神经网络", "应用案例"],
105+
"difficulty": "中级",
106+
"url": "https://example.com/ai_intro.mp4",
107+
"license": "Creative Commons"
108+
},
109+
"computer_vision": {
110+
"title": "计算机视觉原理",
111+
"description": "深入讲解计算机视觉的核心技术",
112+
"duration": "32:15",
113+
"topics": ["图像处理", "特征提取", "目标检测", "深度学习"],
114+
"difficulty": "高级",
115+
"url": "https://example.com/cv_principles.mp4",
116+
"license": "Creative Commons"
117+
}
118+
}
119+
},
120+
121+
"demo_scenarios": {
122+
"basic_interaction": {
123+
"name": "基础交互演示",
124+
"description": "展示基本的对话和记忆功能",
125+
"steps": [
126+
{
127+
"type": "introduction",
128+
"content": "你好!我是张同学,正在学习人工智能。",
129+
"expected_actions": ["memory_store", "greeting_response"]
130+
},
131+
{
132+
"type": "knowledge_query",
133+
"content": "什么是机器学习?",
134+
"expected_actions": ["rag_search", "knowledge_response"]
135+
}
136+
]
137+
},
138+
139+
"multimodal_analysis": {
140+
"name": "多模态分析演示",
141+
"description": "展示图片和视频分析能力",
142+
"steps": [
143+
{
144+
"type": "image_analysis",
145+
"content": "请分析一张建筑图片",
146+
"expected_actions": ["vision_download", "vision_analyze", "memory_store"]
147+
},
148+
{
149+
"type": "video_analysis",
150+
"content": "找一个Python教学视频",
151+
"expected_actions": ["video_search", "video_analyze", "rag_add"]
152+
}
153+
]
154+
},
155+
156+
"personalized_learning": {
157+
"name": "个性化学习演示",
158+
"description": "展示基于记忆的个性化服务",
159+
"steps": [
160+
{
161+
"type": "profile_building",
162+
"content": "我是初学者,想学习Python和AI",
163+
"expected_actions": ["memory_store", "profile_create"]
164+
},
165+
{
166+
"type": "recommendation",
167+
"content": "根据我的情况推荐学习资源",
168+
"expected_actions": ["memory_recall", "rag_search", "personalized_response"]
169+
}
170+
]
171+
}
172+
},
173+
174+
"performance_benchmarks": {
175+
"response_time_targets": {
176+
"memory_operations": "< 0.5s",
177+
"rag_search": "< 2.0s",
178+
"image_analysis": "< 5.0s",
179+
"video_analysis": "< 3.0s",
180+
"complex_reasoning": "< 10.0s"
181+
},
182+
183+
"accuracy_targets": {
184+
"memory_recall": "> 90%",
185+
"knowledge_retrieval": "> 85%",
186+
"image_understanding": "> 80%",
187+
"video_content_extraction": "> 75%"
188+
}
189+
},
190+
191+
"ui_settings": {
192+
"console_colors": {
193+
"user_input": "cyan",
194+
"agent_response": "green",
195+
"system_info": "yellow",
196+
"error_message": "red",
197+
"success_message": "bright_green"
198+
},
199+
200+
"display_options": {
201+
"show_thinking_process": true,
202+
"show_tool_calls": true,
203+
"show_performance_metrics": false,
204+
"show_memory_stats": true,
205+
"animation_enabled": true
206+
}
207+
},
208+
209+
"logging": {
210+
"level": "INFO",
211+
"file_path": "./logs/unified_demo.log",
212+
"max_file_size": "10MB",
213+
"backup_count": 5,
214+
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
215+
},
216+
217+
"experimental_features": {
218+
"real_api_integration": {
219+
"enabled": false,
220+
"openai_vision": false,
221+
"google_vision": false,
222+
"azure_cognitive": false
223+
},
224+
225+
"advanced_memory": {
226+
"enabled": false,
227+
"memory_consolidation": false,
228+
"cross_session_memory": false,
229+
"memory_visualization": false
230+
},
231+
232+
"multimodal_rag": {
233+
"enabled": false,
234+
"image_to_text_indexing": false,
235+
"video_transcript_search": false,
236+
"cross_modal_retrieval": false
237+
}
238+
}
239+
}

0 commit comments

Comments
 (0)