mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-27 14:25:20 +02:00
cr修改,单测完善
This commit is contained in:
parent
79334de5a4
commit
758acf8ba6
18 changed files with 371 additions and 178 deletions
|
|
@ -1,18 +1,16 @@
|
|||
import asyncio
|
||||
|
||||
from llama_parse import ResultType
|
||||
|
||||
from metagpt.config2 import config
|
||||
from metagpt.logs import logger
|
||||
from metagpt.rag.parser.omniparse.client import OmniParseClient
|
||||
from metagpt.rag.parser.omniparse.parse import OmniParse
|
||||
from metagpt.rag.schema import OmniParseOptions, OmniParseType
|
||||
from metagpt.const import EXAMPLE_DATA_PATH
|
||||
from metagpt.logs import logger
|
||||
from metagpt.rag.parser import OmniParse
|
||||
from metagpt.rag.schema import OmniParseOptions, OmniParseType, ParseResultType
|
||||
from metagpt.utils.omniparse_client import OmniParseClient
|
||||
|
||||
TEST_DOCX = EXAMPLE_DATA_PATH / "parse/test01.docx"
|
||||
TEST_PDF = EXAMPLE_DATA_PATH / "parse/test02.pdf"
|
||||
TEST_VIDEO = EXAMPLE_DATA_PATH / "parse/test03.mp4"
|
||||
TEST_AUDIO = EXAMPLE_DATA_PATH / "parse/test04.mp3"
|
||||
TEST_DOCX = EXAMPLE_DATA_PATH / "omniparse/test01.docx"
|
||||
TEST_PDF = EXAMPLE_DATA_PATH / "omniparse/test02.pdf"
|
||||
TEST_VIDEO = EXAMPLE_DATA_PATH / "omniparse/test03.mp4"
|
||||
TEST_AUDIO = EXAMPLE_DATA_PATH / "omniparse/test04.mp3"
|
||||
TEST_WEBSITE_URL = "https://github.com/geekan/MetaGPT"
|
||||
|
||||
|
||||
|
|
@ -37,10 +35,6 @@ async def omniparse_client_example():
|
|||
audio_parse_ret = await client.parse_audio(filelike=TEST_AUDIO)
|
||||
logger.info(audio_parse_ret)
|
||||
|
||||
# website fixme:omniparse官方api还存在问题
|
||||
# website_parse_ret = await client.parse_website(url=TEST_WEBSITE_URL)
|
||||
# logger.info(website_parse_ret)
|
||||
|
||||
|
||||
async def omniparse_example():
|
||||
parser = OmniParse(
|
||||
|
|
@ -48,10 +42,10 @@ async def omniparse_example():
|
|||
base_url=config.omniparse.base_url,
|
||||
parse_options=OmniParseOptions(
|
||||
parse_type=OmniParseType.PDF,
|
||||
result_type=ResultType.MD,
|
||||
result_type=ParseResultType.MD,
|
||||
max_timeout=120,
|
||||
num_workers=3,
|
||||
)
|
||||
),
|
||||
)
|
||||
ret = parser.load_data(file_path=TEST_PDF)
|
||||
logger.info(ret)
|
||||
|
|
@ -67,5 +61,5 @@ async def main():
|
|||
await omniparse_example()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue