To use this, we added the add_files() method (as well as from_files()). Let's see this in action. We pick two PDF documents to upload: The "I have a dream" speech by Dr. KingChurchill's "We Shall Fight on the Beaches" speechimport tempfileimport urllib.requesturls = [    [        "https://www.gilderlehrman.org/sites/default/files/inline-pdfs/king.dreamspeech.excerpts.pdf",        "I-have-a-dream",        "Dr. King"    ],    [        "https://www.parkwayschools.net/cms/lib/MO01931486/Centricity/Domain/1578/Churchill_Beaches_Speech.pdf",        "we shall fight on the beaches",        "Churchil"    ],]files_list = []for url, _, _ in urls:    name = tempfile.NamedTemporaryFile().name    urllib.request.urlretrieve(url, name)    files_list.append(name)docsearch: Vectara = Vectara.from_files(    files=files_list,    embedding=FakeEmbeddings(size=768),    metadatas=[{"url": url, "speech": title, "author": author} for url, title, author in urls],)Similarity search‚ÄãThe simplest scenario for using Vectara is to perform a similarity search. query = "What did the president say about Ketanji Brown Jackson"found_docs = vectara.similarity_search(    query, n_sentence_context=0, filter="doc.speech = 'state-of-the-union'")print(found_docs[0].page_content)    And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson.Similarity search with score‚ÄãSometimes we might want to perform the search, but also obtain a relevancy score to know how good is a particular result.query = "What did the president say about Ketanji Brown Jackson"found_docs = vectara.similarity_search_with_score(    query, filter="doc.speech = 'state-of-the-union'", score_threshold=0.2,)document, score = found_docs[0]print(document.page_content)print(f"\nScore: {score}")    Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days
Vectara is a API platform for building GenAI applications. It provides an easy-to-use API for document indexing and querying that is managed by Vectara and is optimized for performance and accuracy.
Vectara is a API platform for building GenAI applications. It provides an easy-to-use API for document indexing and querying that is managed by Vectara and is optimized for performance and accuracy. ->: To use this, we added the add_files() method (as well as from_files()). Let's see this in action. We pick two PDF documents to upload: The "I have a dream" speech by Dr. KingChurchill's "We Shall Fight on the Beaches" speechimport tempfileimport urllib.requesturls = [    [        "https://www.gilderlehrman.org/sites/default/files/inline-pdfs/king.dreamspeech.excerpts.pdf",        "I-have-a-dream",        "Dr. King"    ],    [        "https://www.parkwayschools.net/cms/lib/MO01931486/Centricity/Domain/1578/Churchill_Beaches_Speech.pdf",        "we shall fight on the beaches",        "Churchil"    ],]files_list = []for url, _, _ in urls:    name = tempfile.NamedTemporaryFile().name    urllib.request.urlretrieve(url, name)    files_list.append(name)docsearch: Vectara = Vectara.from_files(    files=files_list,    embedding=FakeEmbeddings(size=768),    metadatas=[{"url": url, "speech": title, "author": author} for url, title, author in urls],)Similarity search‚ÄãThe simplest scenario for using Vectara is to perform a similarity search. query = "What did the president say about Ketanji Brown Jackson"found_docs = vectara.similarity_search(    query, n_sentence_context=0, filter="doc.speech = 'state-of-the-union'")print(found_docs[0].page_content)    And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson.Similarity search with score‚ÄãSometimes we might want to perform the search, but also obtain a relevancy score to know how good is a particular result.query = "What did the president say about Ketanji Brown Jackson"found_docs = vectara.similarity_search_with_score(    query, filter="doc.speech = 'state-of-the-union'", score_threshold=0.2,)document, score = found_docs[0]print(document.page_content)print(f"\nScore: {score}")    Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days