BrowserLite 🌐
BrowserLite is a powerful Python library for browser-based AI chat model interactions, supporting ChatGPT and HuggingChat. It provides a seamless interface for automated browser interactions with popular AI chat services.
🚀 Features
- 🤖 Easy integration with ChatGPT and HuggingChat
- 🌐 Support for multiple browsers (Chrome, Edge, Firefox)
- 📝 Stream responses in real-time
- 🛠️ Batch processing capabilities
- 🔄 OpenAI-like API interface
- 🔍 Optional web search integration
📦 Installation
pip install browserlite
🏃♂️ Quick Start
Simple Chat Completion
from browserlite import completion
# Basic usage
response = completion(
prompt="What is the capital of France?",
model="chatgpt" # or "huggingchat"
)
print(response)
# Using with system prompt
response = completion(
prompt="Explain quantum computing",
system_prompt="You are a quantum physics expert",
model="chatgpt"
)
Direct Browser Interface
from browserlite import chatgpt, huggingchat
# Using ChatGPT
response = chatgpt("Write a poem about coding")
# Using HuggingChat
response = huggingchat("Explain machine learning in simple terms")
Streaming Responses
from browserlite import pp_completion
# Print response in real-time
pp_completion(
prompt="Write a story about AI",
model="chatgpt",
stream=True
)
Advanced Usage with Messages
from browserlite import genai
messages = [
{"role": "system", "content": "You are a helpful coding assistant"},
{"role": "user", "content": "Write a Python function to sort a list"},
{"role": "assistant", "content": "Here's a simple sorting function:..."},
{"role": "user", "content": "Can you add error handling?"}
]
response = genai(
messages=messages,
model="chatgpt")
Custom Browser Configuration
from browserlite import AIBrowserClient
client = AIBrowserClient(
browser='microsoft-edge-stable', # or 'google-chrome', 'firefox'
default_sleep=30,
default_batch_settings={
"each_chat_start_wait_time": 0,
"batch_wait_size": 4,
"batch_wait_time": 10
}
)
response = client.chat.create(
messages=[{"role": "user", "content": "Hello!"}],
model="chatgpt"
)
🔧 Configuration Options
Available Models
chatgpt: OpenAI's ChatGPThuggingchat: HuggingFace's Chat Interface
Supported Browsers
microsoft-edge-stablegoogle-chromefirefox
Batch Processing Settings
batch_settings = {
"each_chat_start_wait_time": 0, # Wait time before each chat
"batch_wait_size": 4, # Number of requests before batch wait
"batch_wait_time": 10 # Wait time between batches
}
🌟 Advanced Features
Web Search Integration
response = completion(
prompt="What's the latest news about AI?",
web_search=True
)
Streaming with Custom Processing
client = AIBrowserClient()
stream = client.chat.create(
messages=[{"role": "user", "content": "Tell me a story"}],
model="chatgpt",
stream=True
)
for chunk in stream:
# Process each chunk as it arrives
content = chunk.choices[0].delta.content
if content:
process_chunk(content)
Multiple Formats Support
# String input
response = completion("Hello, how are you?")
# Dictionary format
response = completion({
"role": "user",
"content": "Hello!"
})
# List of messages
response = completion([
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hi!"}
])
📝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Thanks to the Python community
- Special thanks to all contributors
🔗 Links
- GitHub: browserlite
- Documentation: docs
- PyPI: browserlite
Metadata
Release files for browserlite 0.0.43
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| browserlite-0.0.43.tar.gz | 20.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| browserlite-0.0.43-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 kB
Release files / browserlite-0.0.43.tar.gz
| Download URL | browserlite-0.0.43.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
303f665e9be987d732f6768cf0b980df1388e2512e3a5b2d4d316f1da725fe12
|
|
BLAKE2b-256 checksum How to use checksums |
2a469382ea09e8e959ad18415900681c6a3e3e930fe203038656e1bca108f076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.0rc1 Linux/6.8.0-49-generic
|
Release files / browserlite-0.0.43-py3-none-any.whl
| Download URL | browserlite-0.0.43-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bebb1b9186d821b053fec178c633498cb090afa35475a210736ef74b916e392
|
|
BLAKE2b-256 checksum How to use checksums |
49005eeaa80247dc048c65549daa2974d41c902519c6acc33bd4502a0f307b11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.0rc1 Linux/6.8.0-49-generic
|
Security for browserlite 0.0.43
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.