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 usernameOXYLABS_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 textOxylabsSearchResults
- A tool that returns scraped Google search results in a JSON formatOxylabsSearchAPIWrapper
- 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
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
File details
Details for the file langchain_oxylabs-0.1.0.tar.gz
.
File metadata
- Download URL: langchain_oxylabs-0.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99ab792157a82c0c72d8a333ab54ac82e6616181fc1376c65d4389eaa1073717 |
|
MD5 | 73ce00bd748276df7fcd5bb831cf7e87 |
|
BLAKE2b-256 | f77186ef3b9dd61d10840ca5d93dc71adee249b8e822d868d4d66a9f3cb6b31b |
File details
Details for the file langchain_oxylabs-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: langchain_oxylabs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96ee910c6ad7c31508f0a1cea83b076b37bd0e56615cbc9d6fbff801f34413d2 |
|
MD5 | cf619c50c8cde07873312548be6a2f67 |
|
BLAKE2b-256 | 99732d36fad19b41ca7316ec660becc4da071bbf71d632b69b3c50a7de5148e5 |