microsoft / TaskWeaver

A code-first agent framework for seamlessly planning and executing data analytics tasks.
https://microsoft.github.io/TaskWeaver/
MIT License
5.37k stars 688 forks source link

FAISS.from_documents # list index out of range #356

Closed HuggingTech closed 1 month ago

HuggingTech commented 6 months ago

Describe the bug A clear and concise description of what the bug is. ‘’‘ Cannot process your request due to Exception: list index out of range Traceback (most recent call last): File "/app/playground/UI/../../taskweaver/session/session.py", line 202, in _send_text_message post = _send_message(post.send_to, post) File "/app/playground/UI/../../taskweaver/module/tracing.py", line 174, in wrapper return func(*args, kwargs) File "/app/playground/UI/../../taskweaver/session/session.py", line 182, in _send_message reply_post = self.worker_instances[recipient].reply( File "/app/playground/UI/../../taskweaver/ext_role/web_search/web_search.py", line 199, in reply browse_page( File "/app/playground/UI/../../taskweaver/ext_role/web_search/web_search.py", line 104, in browse_page vector_store = FAISS.from_documents( File "/usr/local/lib/python3.10/site-packages/langchain_core/vectorstores.py", line 550, in from_documents return cls.from_texts(texts, embedding, metadatas=metadatas, kwargs) File "/usr/local/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 931, in from_texts return cls.__from( File "/usr/local/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 888, in __from index = faiss.IndexFlatL2(len(embeddings[0])) IndexError: list index out of range ‘’‘

To Reproduce Steps to reproduce the behavior: 1.summarize web content

https://www.toutiao.com/article/7372511416445813258/?log_from=86cd667253017_1716865211852

liqul commented 6 months ago

It seems that this is caused because the embeddings is empty. The web_search role is used to search for key words in a search engine, and is not used to open any given URL. If you need such functionality of summarizing the web page based on a given URL, you probably need to implement a new role.

HuggingTech commented 6 months ago

看起来这是因为 为embeddings空。该web_search角色用于在搜索引擎中搜索关键词,而不是用于打开任何给定的 URL。如果您需要这种根据给定 URL 汇总网页的功能,您可能需要实现一个新角色。

HuggingTech commented 6 months ago

看起来这是因为 为embeddings空。该web_search角色用于在搜索引擎中搜索关键词,而不是用于打开任何给定的 URL。如果您需要这种根据给定 URL 汇总网页的功能,您可能需要实现一个新角色。

thanks