phidata
phidata copied to clipboard
A feature of filters is missing from assistant
What I'm looking at in vectordb, it actually has some databases that support this filters feature:phi/vectordb/pgvector/pgvector2.py
But in fact, there is no relevant implementation in the assistant, such as the following code:
def get_references_from_knowledge_base(self, query: str, num_documents: Optional[int] = None) -> Optional[str]:
"""Return a list of references from the knowledge base"""
if self.references_function is not None:
reference_kwargs = {"assistant": self, "query": query, "num_documents": num_documents}
return remove_indent(self.references_function(**reference_kwargs))
if self.knowledge_base is None:
return None
relevant_docs: List[Document] = self.knowledge_base.search(query=query, num_documents=num_documents)
if len(relevant_docs) == 0:
return None
if self.references_format == "yaml":
import yaml
return yaml.dump([doc.to_dict() for doc in relevant_docs])
return json.dumps([doc.to_dict() for doc in relevant_docs], indent=2)
I think a feature for this could be added