mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
format
This commit is contained in:
parent
451cbd7e46
commit
6a388b53f1
16 changed files with 19 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
"""RAG pipeline"""
|
||||
|
||||
import asyncio
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""Agent with RAG search"""
|
||||
"""Agent with RAG search."""
|
||||
|
||||
import asyncio
|
||||
|
||||
from examples.rag_pipeline import DOC_PATH, QUESTION
|
||||
|
|
@ -8,7 +9,8 @@ from metagpt.roles import Sales
|
|||
|
||||
|
||||
async def search():
|
||||
"""Agent with RAG search"""
|
||||
"""Agent with RAG search."""
|
||||
|
||||
store = SimpleEngine.from_docs(input_files=[DOC_PATH])
|
||||
role = Sales(profile="Sales", store=store)
|
||||
result = await role.run(QUESTION)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"""Engines init"""
|
||||
|
||||
__all__ = ["SimpleEngine"]
|
||||
|
||||
|
||||
from metagpt.rag.engines.simple import SimpleEngine
|
||||
|
||||
__all__ = ["SimpleEngine"]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"""Simple Engine."""
|
||||
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""RAG factories"""
|
||||
|
||||
from metagpt.rag.factories.retriever import get_retriever
|
||||
from metagpt.rag.factories.ranker import get_rankers
|
||||
from metagpt.rag.factories.embedding import get_rag_embedding
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""Base Factory."""
|
||||
|
||||
from typing import Any, Callable
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""RAG Embedding Factory."""
|
||||
|
||||
from llama_index.core.embeddings import BaseEmbedding
|
||||
from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding
|
||||
from llama_index.embeddings.openai import OpenAIEmbedding
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""RAG Index Factory."""
|
||||
|
||||
import chromadb
|
||||
from llama_index.core import StorageContext, VectorStoreIndex, load_index_from_storage
|
||||
from llama_index.core.embeddings import BaseEmbedding
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""RAG Interfaces."""
|
||||
|
||||
from typing import Any, Protocol
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""RAG LLM."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from llama_index.core.llms import (
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Retrievers init"""
|
||||
"""Retrievers init."""
|
||||
|
||||
from metagpt.rag.retrievers.hybrid_retriever import SimpleHybridRetriever
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"""Base retriever."""
|
||||
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from llama_index.core.retrievers import BaseRetriever
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""BM25 retriever."""
|
||||
|
||||
from llama_index.core.schema import BaseNode
|
||||
from llama_index.retrievers.bm25 import BM25Retriever
|
||||
from rank_bm25 import BM25Okapi
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
"""Chroma retriever."""
|
||||
|
||||
from llama_index.core.retrievers import VectorIndexRetriever
|
||||
from llama_index.core.schema import BaseNode
|
||||
|
||||
|
||||
class ChromaRetriever(VectorIndexRetriever):
|
||||
"""FAISS retriever."""
|
||||
"""Chroma retriever."""
|
||||
|
||||
def add_nodes(self, nodes: list[BaseNode], **kwargs):
|
||||
"""Support add nodes"""
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""FAISS retriever."""
|
||||
|
||||
from llama_index.core.retrievers import VectorIndexRetriever
|
||||
from llama_index.core.schema import BaseNode
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"""Hybrid retriever."""
|
||||
|
||||
import copy
|
||||
|
||||
from llama_index.core.schema import BaseNode, QueryType
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue