Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Langchain (Python)
similarity_search( query: str, k: int = 4, filter: Optional[Dict[str, Any]] = None, **kwargs ) -> List[Document]
query
str
k
int
filter
Optional[Dict[str, Any]]
**kwargs
Any
List[Document]
# Basic similarity search results = store.similarity_search("machine learning algorithms", k=5) for doc in results: print(f"Content: {doc.page_content[:100]}...") print(f"Metadata: {doc.metadata}") # Search with metadata filter filter_dict = {"language": "python", "level": "beginner"} results = store.similarity_search( "python tutorial", k=3, filter=filter_dict )
Was this page helpful?
Contact support