browserlite


Namebrowserlite JSON
Version 0.0.43 PyPI version JSON
download
home_pagehttps://github.com/santhosh/
Summaryautomated browsing
upload_time2025-01-01 06:22:14
maintainerNone
docs_urlNone
authorKammari Santhosh
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

[![PyPI version](https://badge.fury.io/py/browserlite.svg)](https://badge.fury.io/py/browserlite)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 🚀 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

```bash
pip install browserlite
```

## 🏃‍♂️ Quick Start

### Simple Chat Completion

```python
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

```python
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

```python
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

```python
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

```python
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 ChatGPT
- `huggingchat`: HuggingFace's Chat Interface

### Supported Browsers
- `microsoft-edge-stable`
- `google-chrome`
- `firefox`

### Batch Processing Settings
```python
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

```python
response = completion(
    prompt="What's the latest news about AI?",
    web_search=True
)
```

### Streaming with Custom Processing

```python
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

```python
# 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](https://github.com/yourusername/browserlite)
- Documentation: [docs](https://browserlite.readthedocs.io)
- PyPI: [browserlite](https://pypi.org/project/browserlite/)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/santhosh/",
    "name": "browserlite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Kammari Santhosh",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/2a/46/9382ea09e8e959ad18415900681c6a3e3e930fe203038656e1bca108f076/browserlite-0.0.43.tar.gz",
    "platform": null,
    "description": "# BrowserLite \ud83c\udf10\n\nBrowserLite 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.\n\n[![PyPI version](https://badge.fury.io/py/browserlite.svg)](https://badge.fury.io/py/browserlite)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## \ud83d\ude80 Features\n\n- \ud83e\udd16 Easy integration with ChatGPT and HuggingChat\n- \ud83c\udf10 Support for multiple browsers (Chrome, Edge, Firefox)\n- \ud83d\udcdd Stream responses in real-time\n- \ud83d\udee0\ufe0f Batch processing capabilities\n- \ud83d\udd04 OpenAI-like API interface\n- \ud83d\udd0d Optional web search integration\n\n## \ud83d\udce6 Installation\n\n```bash\npip install browserlite\n```\n\n## \ud83c\udfc3\u200d\u2642\ufe0f Quick Start\n\n### Simple Chat Completion\n\n```python\nfrom browserlite import completion\n\n# Basic usage\nresponse = completion(\n    prompt=\"What is the capital of France?\",\n    model=\"chatgpt\"  # or \"huggingchat\"\n)\nprint(response)\n\n# Using with system prompt\nresponse = completion(\n    prompt=\"Explain quantum computing\",\n    system_prompt=\"You are a quantum physics expert\",\n    model=\"chatgpt\"\n)\n```\n\n### Direct Browser Interface\n\n```python\nfrom browserlite import chatgpt, huggingchat\n\n# Using ChatGPT\nresponse = chatgpt(\"Write a poem about coding\")\n\n# Using HuggingChat\nresponse = huggingchat(\"Explain machine learning in simple terms\")\n```\n\n### Streaming Responses\n\n```python\nfrom browserlite import pp_completion\n\n# Print response in real-time\npp_completion(\n    prompt=\"Write a story about AI\",\n    model=\"chatgpt\",\n    stream=True\n)\n```\n\n### Advanced Usage with Messages\n\n```python\nfrom browserlite import genai\n\nmessages = [\n    {\"role\": \"system\", \"content\": \"You are a helpful coding assistant\"},\n    {\"role\": \"user\", \"content\": \"Write a Python function to sort a list\"},\n    {\"role\": \"assistant\", \"content\": \"Here's a simple sorting function:...\"},\n    {\"role\": \"user\", \"content\": \"Can you add error handling?\"}\n]\n\nresponse = genai(\n    messages=messages,\n    model=\"chatgpt\")\n```\n\n### Custom Browser Configuration\n\n```python\nfrom browserlite import AIBrowserClient\n\nclient = AIBrowserClient(\n    browser='microsoft-edge-stable',  # or 'google-chrome', 'firefox'\n    default_sleep=30,\n    default_batch_settings={\n        \"each_chat_start_wait_time\": 0,\n        \"batch_wait_size\": 4,\n        \"batch_wait_time\": 10\n    }\n)\n\nresponse = client.chat.create(\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n    model=\"chatgpt\"\n)\n```\n\n## \ud83d\udd27 Configuration Options\n\n### Available Models\n- `chatgpt`: OpenAI's ChatGPT\n- `huggingchat`: HuggingFace's Chat Interface\n\n### Supported Browsers\n- `microsoft-edge-stable`\n- `google-chrome`\n- `firefox`\n\n### Batch Processing Settings\n```python\nbatch_settings = {\n    \"each_chat_start_wait_time\": 0,  # Wait time before each chat\n    \"batch_wait_size\": 4,            # Number of requests before batch wait\n    \"batch_wait_time\": 10            # Wait time between batches\n}\n```\n\n## \ud83c\udf1f Advanced Features\n\n### Web Search Integration\n\n```python\nresponse = completion(\n    prompt=\"What's the latest news about AI?\",\n    web_search=True\n)\n```\n\n### Streaming with Custom Processing\n\n```python\nclient = AIBrowserClient()\nstream = client.chat.create(\n    messages=[{\"role\": \"user\", \"content\": \"Tell me a story\"}],\n    model=\"chatgpt\",\n    stream=True\n)\n\nfor chunk in stream:\n    # Process each chunk as it arrives\n    content = chunk.choices[0].delta.content\n    if content:\n        process_chunk(content)\n```\n\n### Multiple Formats Support\n\n```python\n# String input\nresponse = completion(\"Hello, how are you?\")\n\n# Dictionary format\nresponse = completion({\n    \"role\": \"user\",\n    \"content\": \"Hello!\"\n})\n\n# List of messages\nresponse = completion([\n    {\"role\": \"system\", \"content\": \"You are a helpful assistant\"},\n    {\"role\": \"user\", \"content\": \"Hi!\"}\n])\n```\n\n## \ud83d\udcdd Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- Thanks to the Python community\n- Special thanks to all contributors\n\n## \ud83d\udd17 Links\n- GitHub: [browserlite](https://github.com/yourusername/browserlite)\n- Documentation: [docs](https://browserlite.readthedocs.io)\n- PyPI: [browserlite](https://pypi.org/project/browserlite/)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "automated browsing",
    "version": "0.0.43",
    "project_urls": {
        "Homepage": "https://github.com/santhosh/",
        "Repository": "https://github.com/santhosh/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49005eeaa80247dc048c65549daa2974d41c902519c6acc33bd4502a0f307b11",
                "md5": "cdd07dc4c7ef77648d36ad6d9ab0c371",
                "sha256": "5bebb1b9186d821b053fec178c633498cb090afa35475a210736ef74b916e392"
            },
            "downloads": -1,
            "filename": "browserlite-0.0.43-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cdd07dc4c7ef77648d36ad6d9ab0c371",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 13356,
            "upload_time": "2025-01-01T06:22:12",
            "upload_time_iso_8601": "2025-01-01T06:22:12.618890Z",
            "url": "https://files.pythonhosted.org/packages/49/00/5eeaa80247dc048c65549daa2974d41c902519c6acc33bd4502a0f307b11/browserlite-0.0.43-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a469382ea09e8e959ad18415900681c6a3e3e930fe203038656e1bca108f076",
                "md5": "2f5da5efe4e72f4369ae7a0e0a4af635",
                "sha256": "303f665e9be987d732f6768cf0b980df1388e2512e3a5b2d4d316f1da725fe12"
            },
            "downloads": -1,
            "filename": "browserlite-0.0.43.tar.gz",
            "has_sig": false,
            "md5_digest": "2f5da5efe4e72f4369ae7a0e0a4af635",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 20124,
            "upload_time": "2025-01-01T06:22:14",
            "upload_time_iso_8601": "2025-01-01T06:22:14.048496Z",
            "url": "https://files.pythonhosted.org/packages/2a/46/9382ea09e8e959ad18415900681c6a3e3e930fe203038656e1bca108f076/browserlite-0.0.43.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-01 06:22:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "browserlite"
}
        
Elapsed time: 7.73233s