I am implementing this code
class ChromaProductRetriever(BaseRetriever, BaseModel):
vectorstore: VectorStore
class Config:
arbitrary_types_allowed = True
def combine_metadata(self, doc) -> str:
metadata = doc.metadata
return (
"Item Name: " + metadata["item_name"] + ". " +
"Item Description: " + metadata["bullet_point"] + ". " +
"Item Keywords: " + metadata["item_keywords"] + "."
)
def get_relevant_documents(self, query):
docs = []
for doc in self.vectorstore.similarity_search(query):
content = self.combine_metadata(doc)
docs.append(Document(
page_content=content,
metadata=doc.metadata
))
return docs
But when I instantiate the class
chroma_product_retriever = ChromaProductRetriever(vectorstore=vectorstore)
I get the following error
TypeError: Can't instantiate abstract class ChromaProductRetriever with abstract method aget_relevant_documents
For some reason, the code adds an "a" to the get_relevant_documents method. I'm not too clear on abstract classes or methods so i'm not sure whats going on. I'm using python version 3.7.9. Any help would be great.