Skip to main content

Python wrapper for Bing Search and RAG extraction

Project description

PyBingScrapper

Python wrapper for Bing Search results.

Implementation

pip install PyBingScrapper

Below is a simple example for running the library

from PyBingScrapper.search import BingSearch

bing = BingSearch("Narendra Modi")
#num - num of results to return
#max_lines - maximum number of lines/sentences to return in each result

bing_results = bing.get_results(num=4, max_lines=15)
# bing_results[i]['content'] - scrapped content
# nlines - num of iterations
# hfkey - hugging face secret key

print(bing.rag_output("Tell me about Mr. Narendra Modi?", bing_results, hfkey, n_iters=15)) #n_iters-optional

To only scrape results from the web use the below code snippet

bing = BingSearch("Narendra Modi")
bing_results = bing.get_results(num=4, max_lines=15)

# the above code provides the top 4 results from bing search with 15 sentences from each result as content

To implement RAG algorithm over the query use the below. RAG - RAG is a framework/algorithm to improve LLM-generated responses by leveraging external information such as Wikipedia information etc for the queried prompt.

print(bing.rag_output("Tell me about Mr. Narendra Modi?", bing_results, hfkey, n_iters=15))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyBingScrapper-0.0.8.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file PyBingScrapper-0.0.8.tar.gz.

File metadata

  • Download URL: PyBingScrapper-0.0.8.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for PyBingScrapper-0.0.8.tar.gz
Algorithm Hash digest
SHA256 e05ef7754ac2cf4cc78c2e2ac601a06271d48d706891d0c06f5e2969e39d2902
MD5 f831e95120a0f3aef1d6452b14efc4bf
BLAKE2b-256 8c0ab5a2216da7c618497a8dee2981c5e14a4bd67dee73332322ca594a607abb

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page