fromembedchainimportAppapp=App()app.add("https://www.forbes.com/profile/elon-musk")context=app.search("What is the net worth of Elon?",num_documents=2)print(context)
importosfromembedchainimportAppos.environ["PINECONE_API_KEY"]="xxx"config={"vectordb":{"provider":"pinecone","config":{"metric":"dotproduct","vector_dimension":1536,"index_name":"ec-test","serverless_config":{"cloud":"aws","region":"us-west-2"},},}}app=App.from_config(config=config)app.add("https://www.forbes.com/profile/bill-gates",metadata={"type":"forbes","person":"gates"})app.add("https://en.wikipedia.org/wiki/Bill_Gates",metadata={"type":"wiki","person":"gates"})results=app.search("What is the net worth of Bill Gates?",where={"person":"gates"})print("Num of search results: ",len(results))
importosfromembedchainimportAppos.environ["PINECONE_API_KEY"]="xxx"config={"vectordb":{"provider":"pinecone","config":{"metric":"dotproduct","vector_dimension":1536,"index_name":"ec-test","serverless_config":{"cloud":"aws","region":"us-west-2"},},}}app=App.from_config(config=config)app.add("https://www.forbes.com/profile/bill-gates",metadata={"year":2022,"person":"gates"})app.add("https://en.wikipedia.org/wiki/Bill_Gates",metadata={"year":2024,"person":"gates"})print("Filter with person: gates and year > 2023")raw_filter={"$and":[{"person":"gates"},{"year":{"$gt":2023}}]}results=app.search("What is the net worth of Bill Gates?",raw_filter=raw_filter)print("Num of search results: ",len(results))