Skip to main content

Oxylabs integration package for LangChain

Project description

langchain-oxylabs

This package contains the LangChain integration with Oxylabs, providing tools to scrape Google search results with Oxylabs Web Scraper API using LangChain's framework.

Installation

pip install -U langchain-oxylabs

Credentials

Create your API user credentials: Sign up for a free trial or purchase the product in the Oxylabs dashboard to create your API user credentials.

Configure your Oxylabs credentials by setting the following environment variables:

  • OXYLABS_USERNAME - Your Oxylabs API username
  • OXYLABS_PASSWORD - Your Oxylabs API password

Usage

langchain_oxylabs package provides the following classes:

  • OxylabsSearchRun - A tool that returns scraped Google search results in a formatted text
  • OxylabsSearchResults - A tool that returns scraped Google search results in a JSON format
  • OxylabsSearchAPIWrapper - An API wrapper for initializing Oxylabs API

Here is an example usage of these classes:

import json
from langchain_oxylabs import OxylabsSearchRun, OxylabsSearchResults, OxylabsSearchAPIWrapper

# Initialize the API wrapper
oxylabs_wrapper = OxylabsSearchAPIWrapper()

# Initialize the search run tool
run_tool = OxylabsSearchRun(wrapper=oxylabs_wrapper)

# Invoke the tool and print results
results_text = run_tool.invoke({"query": "Visit restaurants in Vilnius."})
print(results_text)

# Initialize the search results tool
results_tool = OxylabsSearchResults(wrapper=oxylabs_wrapper)

# Invoke the tool and print results
response_results = results_tool.invoke({"query": "Visit restaurants in Paris."})
response_results = json.loads(response_results)
for result in response_results:
    for key, value in result.items():
        print(f"{key}: {value}")

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

langchain_oxylabs-0.2.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_oxylabs-0.2.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file langchain_oxylabs-0.2.0.tar.gz.

File metadata

  • Download URL: langchain_oxylabs-0.2.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/24.3.0

File hashes

Hashes for langchain_oxylabs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f8a9ac9c092fbe73943c435dad5222510b8b8aea0b4c584fac55c4b3f69b0329
MD5 d6664644269155fe4630f5aa7057f8fb
BLAKE2b-256 6c434e52d5bc50a6154e288cd93eac08c799f440fbd5b5e6601497c279751457

See more details on using hashes here.

File details

Details for the file langchain_oxylabs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_oxylabs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/24.3.0

File hashes

Hashes for langchain_oxylabs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 471f6e1195de083de64b7a5e8d55e2aa3d5787370ae35c7f1954145bd2e50461
MD5 44c0ace2970ceb7924584f200d3c33cb
BLAKE2b-256 475876bf8c7a67a29660b54d35da0ef054934fc9d2ee6a6b8bb473f3fbf91f59

See more details on using hashes here.

Supported by

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