微信扫码
与创始人交个朋友
我要投稿
01.
02.
Naive RAG上述痛点的原因03.
从RAG到Agentic RAG04.
实践SentenceWindowNodeParser
分段之后,导入到Milvus。node_parser = SentenceWindowNodeParser.from_defaults(
window_size=3,
window_metadata_key="window",
original_text_metadata_key="original_text",
)
# Extract nodes from documents
nodes = node_parser.get_nodes_from_documents(documents)
vector_store = MilvusVectorStore(dim=1536,
uri="http://localhost:19530",
collection_name='agentic_rag',
overwrite=True,
enable_sparse=False,
hybrid_ranker="RRFRanker",
hybrid_ranker_params={"k": 60})
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex(
nodes,
storage_context=storage_context
)
SummaryIndex
对于文档块提取summary。def vector_query(
query: str,
page_numbers: Optional[List[int]] = None
) -> str:
# The target key defaults to `window` to match the node_parser's default
postproc = MetadataReplacementPostProcessor(
target_metadata_key="window"
)
# BAAI/bge-reranker-base is a cross-encoder model
# link: https://huggingface.co/BAAI/bge-reranker-base
rerank = BGERerankFunction(
top_n = 3,
model_name = "BAAI/bge-reranker-base",
device="cpu"
)
# The QueryEngine class is equipped with the generator and facilitates the retrieval and generation steps
query_engine = vector_index.as_query_engine(
similarity_top_k = 3,
vector_store_query_mode="hybrid", # Milvus starts supporting from version 2.4, use 'Default' for versions before 2.4
node_postprocessors = [postproc, rerank],
)
response = query_engine.query(query)
return response
vector_query_tool = FunctionTool.from_defaults(
name=f"vector_tool_{name}",
fn=vector_query
)
summary_index = SummaryIndex(nodes)
summary_query_engine = summary_index.as_query_engine(
response_mode="tree_summarize",
use_async=True,
)
summary_tool = QueryEngineTool.from_defaults(
name=f"summary_tool_{name}",
query_engine=summary_query_engine,
description=(
f"Useful for summarization questions related to {name}"
),
)
ReActAgentWorker
整合vector query tool 和summary tool,以及React的特性,反思,路由以及使用工具能力,实现Agentic RAG。response = agent.query(
"Tell me about the difference between milvus 2.3 and milvus 2.4?"
)
Thought: The user is asking about the differences between Milvus 2.3 and Milvus 2.4. I need to gather information about both versions to provide a comprehensive comparison.
Action: vector_tool_milvus_2_3
Action Input: {'query': "What's new in Milvus 2.3?"}
Thought: It appears there is a persistent issue with the tool input. I will try using a different tool to gather the necessary information.
Action: summary_tool_milvus_2_3
Action Input: {'input': "What's new in Milvus 2.3?"}
Observation: Milvus 2.3 introduces several new features and enhancements, including GPU support, Arm64 support, a refactored QueryNode, and a merged IndexCoord and DataCoord for simplified deployment. It also includes a new NATS-based message queue, upsert API, range search, count statement, cosine metrics, raw vectors in search returns, ScaNN index support, iterator functionality, JSON_CONTAINS expressions, and CDC support. Additionally, there are performance improvements such as MMap for capacity increase, optimized data filtering, growing index, and increased resource usage in multi-core environments. The release also features a new load balancer, dynamic configuration support, tracing support, reorganized error codes, and upgraded tools like Birdwatcher and Attu.
Thought: I have gathered information about the new features and enhancements in Milvus 2.3. Now, I need to gather similar information for Milvus 2.4 to compare the two versions.
Action: summary_tool_milvus_2_4
Action Input: {'input': "What's new in Milvus 2.4?"}
Observation: Milvus 2.4 introduces several new features and improvements. Key highlights include:
...
These updates aim to enhance system performance, improve observability, and streamline the codebase for increased simplicity.
Thought: I now have detailed information about the new features and enhancements in both Milvus 2.3 and Milvus 2.4. I can compare the two versions based on these details.
Answer: Milvus 2.3 and Milvus 2.4 both introduce significant new features and improvements, but they focus on different aspects of the system. Here are the key differences:
### Milvus 2.3:
1. **GPU and Arm64 Support**: Introduces GPU support and Arm64 support.
2. **Refactored QueryNode**: Simplifies deployment by merging IndexCoord and DataCoord.
3. **New Message Queue**: Implements a NATS-based message queue.
4. **New APIs and Features**: Includes upsert API, range search, count statement, cosine metrics, raw vectors in search returns, ScaNN index support, iterator functionality, JSON_CONTAINS expressions, and CDC support.
5. **Performance Improvements**: Features MMap for capacity increase, optimized data filtering, growing index, and increased resource usage in multi-core environments.
6. **Load Balancer and Dynamic Configuration**: Introduces a new load balancer and dynamic configuration support.
7. **Tool Upgrades**: Upgrades tools like Birdwatcher and Attu.
### Milvus 2.4:
1. **New GPU Index - CAGRA**: Introduces a state-of-the-art GPU-based graph index for significant performance boosts.
2. **Multi-vector and Hybrid Search**: Supports storing vector embeddings from multiple models and conducting hybrid searches.
3. **Sparse Vectors**: Supports efficient approximate semantic nearest neighbor search for keyword interpretation and analysis.
4. **Grouping Search**: Allows aggregation of search results by specific scalar fields.
5. **Inverted Index and Fuzzy Match**: Improves scalar query performance and supports fuzzy matches.
6. **New Data Types**: Supports Float16 and BFloat16 vector data types.
7. **L0 Segment**: Enhances performance of delete and upsert operations by recording deleted data.
8. **Refactored BulkInsert**: Improves logic for importing multiple files in a single request.
9. **Memory-mapped Storage**: Optimizes memory usage by mapping file content into memory.
10. **Milvus-CDC**: Improves stability for capturing and synchronizing incremental data.
### Summary:
- **Milvus 2.3** focuses on broadening hardware support, enhancing deployment simplicity, and introducing various new APIs and performance improvements.
- **Milvus 2.4** emphasizes advanced search capabilities, new data types, improved memory management, and further performance optimizations.
Both versions aim to enhance system performance and usability, but Milvus 2.4 introduces more advanced search features and optimizations compared to Milvus 2.3.
05.
53AI,企业落地应用大模型首选服务商
产品:大模型应用平台+智能体定制开发+落地咨询服务
承诺:先做场景POC验证,看到效果再签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2024-11-23
如何提高RAG系统准确率?12大常见痛点及巧妙解!
2024-11-23
RAG 2.0性能提升:优化索引与召回机制的策略与实践
2024-11-22
RAG技术在实际应用中的挑战与解决方案
2024-11-22
从普通RAG到RAPTOR,10个最新的RAG框架
2024-11-22
如何使用 RAG 提高 LLM 成绩
2024-11-21
提升RAG性能的全攻略:优化检索增强生成系统的策略大揭秘 | 深度好文
2024-11-20
FastGraphRAG 如何做到高达 20%优化检索增强生成(RAG)性能优化
2024-11-20
为裸奔的大模型穿上"防护服":企业AI安全护栏设计指南
2024-07-18
2024-05-05
2024-07-09
2024-07-09
2024-05-19
2024-06-20
2024-07-07
2024-07-07
2024-07-08
2024-07-09
2024-11-06
2024-11-06
2024-11-05
2024-11-04
2024-10-27
2024-10-25
2024-10-21
2024-10-21