llama-index readers zyte-serp integration
Project description
LlamaIndex Readers Integration: Zyte-Serp
ZyteSerp can be used to add organic search results from Google Search. It takes a query
and returns top search results urls.
Instructions for ZyteSerpReader
Setup and Installation
pip install llama-index-readers-zyte-serp
Secure an API key from Zyte to access the Zyte services.
Using ZyteSerpReader
-
Initialization: Initialize the ZyteSerpReader by providing the API key and the option for extraction ("httpResponseBody" or "browserHtml").
from llama_index.readers.zyte_serp import ZyteSerpReader zyte_serp = ZyteSerpReader( api_key="your_api_key_here", extract_from="httpResponseBody", # or "browserHtml" )
-
Loading Data: To load search results, use the
load_data
method with the query you wish to search.
documents = zyte_serp.load_data(query="llama index docs")
Example Usage
Here is an example demonstrating how to initialize the ZyteSerpReader and get top search URLs. Further the content from these URLs can be loaded using ZyteWebReader in "article" mode to obtain just the article content from webpage.
from llama_index.readers.zyte_serp import ZyteSerpReader
from llama_index.readers.web.zyte.base import ZyteWebReader
# Initialize the ZyteSerpReader with your API key
zyte_serp = ZyteSerpReader(
api_key="your_api_key_here", # Replace with your actual API key
)
# Get the search results (URLs from google search results)
search_urls = zyte_serp.load_data(query="llama index docs")
# Display the results
print(search_urls)
urls = [result.text for result in search_urls]
# Initialize the ZyteWebReader to load the content from search results
zyte_web = ZyteWebReader(
api_key="your_api_key_here", # Replace with your actual API key
mode="article",
)
documents = zyte_web.load_data(urls)
print(documents)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for llama_index_readers_zyte_serp-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 538179af0d2c75a9518c117fe4abb215b38fe41a99d353ecedcc601987f05122 |
|
MD5 | aa75bf0d8701419b2a1ddaf3fddbf36c |
|
BLAKE2b-256 | 082d56d0f89c6bfbffa9f65313e7e78c332b6b06cc7c14aebefa891b8cc26c34 |
Hashes for llama_index_readers_zyte_serp-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b614a6ea292544c5303aae22913522f775c540857c9a1759865c488a2a8196ae |
|
MD5 | 9fd35deb87bca5efb76eef42add7b582 |
|
BLAKE2b-256 | 666b0d08de266f32938f8178e193ce7acf99b454c344d495126cc0ab0edf6531 |