Find answers from the community

Updated 9 months ago

Anyone getting this error while using

At a glance

A community member is encountering a validation error while using the BM25 Retriever, specifically "Can't instantiate abstract class BaseNode with abstract methods get_content, get_metadata_str, get_type, hash, set_content (type=type_error)". The community members have tried upgrading the llamaindex and BM25 versions, but the issue persists. They have also checked for any mixing of legacy imports with non-legacy imports. The issue seems to be specific to the community member's environment, as the code works fine for others in a fresh environment and on Google Colab. The community members have tried deploying the code on Streamlit Community Cloud, but the issue remains. There is no explicitly marked answer in the comments.

Anyone getting this error while using BM25 Retriever?
Plain Text
ValidationError: 1 validation error for NodeWithScore node Can't instantiate abstract class BaseNode with abstract methods get_content, get_metadata_str, get_type, hash, set_content (type=type_error)
W
k
L
18 comments
Are you trying with latest version fro BM25 and llamaindex?
only encountered after upgrading llamaindex version
Can you try upgrading BM25 as well?
Seems like you are mixing legacy imports with non-legacy imports
I checked that too
Plain Text
import streamlit as st
from llama_index.llms.openai import OpenAI
from llama_index.retrievers.bm25 import BM25Retriever
from llama_index.core.retrievers import VectorIndexRetriever
from llama_index.core.retrievers import BaseRetriever
from llama_index.core.chat_engine import CondensePlusContextChatEngine
from llama_index.core.query_engine import RetrieverQueryEngine
from llama_index.core.postprocessor import LongContextReorder 
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.embeddings.openai import OpenAIEmbedding
import openai
import os
these are my imports
One detail I missed. I am running this on ec2
Hmm I've never had that issue. Maybe start with a fresh venv?
Not working even with a fresh venv?
I even tried deploying streamlit community cloud
Doesn't work there too
Works fine for me in a fresh env. Also runs fine on Google colab
If you can reproduce on Google colab, then it's my problem πŸ˜… seems like an issue with either your env, deps, or imports
Okay. Thanks for the help!
Add a reply
Sign up and join the conversation on Discord