Merge pull request #1172 from seehi/feat-rag-embedding

Make RAG embedding configurable and add gpt-4-turbo in token_counter.
This commit is contained in:
Alexander Wu 2024-04-10 15:59:31 +08:00 committed by GitHub
commit 63ca5452bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 268 additions and 37 deletions

View file

@ -8,7 +8,6 @@ from metagpt.const import DATA_PATH, EXAMPLE_DATA_PATH
from metagpt.logs import logger
from metagpt.rag.engines import SimpleEngine
from metagpt.rag.schema import (
BM25RetrieverConfig,
ChromaIndexConfig,
ChromaRetrieverConfig,
ElasticsearchIndexConfig,
@ -51,7 +50,7 @@ class RAGExample:
if not self._engine:
self._engine = SimpleEngine.from_docs(
input_files=[DOC_PATH],
retriever_configs=[FAISSRetrieverConfig(), BM25RetrieverConfig()],
retriever_configs=[FAISSRetrieverConfig()],
ranker_configs=[LLMRankerConfig()],
)
return self._engine
@ -61,7 +60,7 @@ class RAGExample:
self._engine = value
async def run_pipeline(self, question=QUESTION, print_title=True):
"""This example run rag pipeline, use faiss&bm25 retriever and llm ranker, will print something like:
"""This example run rag pipeline, use faiss retriever and llm ranker, will print something like:
Retrieve Result:
0. Productivi..., 10.0