plexsearch


Nameplexsearch JSON
Version 0.1.17 PyPI version JSON
download
home_pagehttps://github.com/tom-doerr/perplexity_search
SummaryA powerful Python tool for performing technical searches using the Perplexity API
upload_time2024-12-11 22:50:10
maintainerNone
docs_urlNone
authorTom Doerr
requires_python>=3.7
licenseMIT
keywords search perplexity ai llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

# 🔍 Perplexity Search

[![Python 3.x](https://img.shields.io/badge/python-3.x-blue?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green?style=for-the-badge&logo=opensourceinitiative&logoColor=white)](https://opensource.org/licenses/MIT)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tom-doerr/perplexity_search/pulls)
[![GitHub Issues](https://img.shields.io/github/issues/tom-doerr/perplexity_search?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tom-doerr/perplexity_search/issues)
[![GitHub Stars](https://img.shields.io/github/stars/tom-doerr/perplexity_search?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tom-doerr/perplexity_search/stargazers)

A powerful Python tool for performing technical searches using the Perplexity API, optimized for retrieving precise facts, code examples, and numerical data.

<img src="assets/images/screenshot_2.png" alt="Perplexity Search Demo" width="600"/>

</div>

<div align="center">

## 📋 Table of Contents

[Overview](#overview) •
[Features](#features) •
[Installation](#installation) •
[Usage](#usage) •
[Configuration](#configuration) •
[Requirements](#requirements) •
[Error Handling](#error-handling) •
[Contributing](#contributing) •
[FAQ](#faq) •
[License](#license)

</div>

## 🌟 Overview

Perplexity Search is a command-line tool and Python library that leverages the power of Perplexity AI to provide accurate, technical search results. It's designed for developers, researchers, and technical users who need quick access to precise information, code examples, and technical documentation.

## ✨ Features

- **Interactive Mode:** Engage in a conversational interface where you can ask multiple queries in sequence.

- **Perform searches using different LLaMA models (small, large, huge)**
- **Configurable API key support via environment variable or direct input**
- **Customizable search queries with temperature and other parameters**
- **Command-line interface for easy usage**
- **Focused on retrieving technical information with code examples**
- **Returns responses formatted in markdown**
- **Optimized for factual and numerical data**

## Installation

```bash
pip install plexsearch
```

## Usage

### As a Python Module

```python
from perplexity_search import perform_search

# Using environment variable for API key
result = perform_search("What is Python's time complexity for list operations?")

# Or passing API key directly
result = perform_search("What are the differences between Python 3.11 and 3.12?", api_key="your-api-key")

# Specify a different model
result = perform_search("Show me example code for Python async/await", model="llama-3.1-sonar-huge-128k-online")
```

### Command Line Interface

#### Interactive Mode

To enter interactive mode, simply run the command without any query arguments:

```bash
plexsearch
```

In interactive mode, you can type your queries one by one. Type `exit` to quit the interactive session.

```bash
# Basic search
plexsearch "What is Python's time complexity for list operations?"

# Specify model
plexsearch --model llama-3.1-sonar-huge-128k-online "What are the differences between Python 3.11 and 3.12?"

# Use specific API key
plexsearch --api-key your-api-key "Show me example code for Python async/await"

# Multi-word queries work naturally
plexsearch tell me about frogs

# Disable streaming output
plexsearch --no-stream "tell me about frogs"

# Show numbered citations at the bottom of the response
plexsearch --citations "tell me about Python's GIL"

Note: Streaming is automatically disabled when running inside Aider to prevent
filling up the context window.
```

## Configuration

### API Key

Set your Perplexity API key in one of these ways:
1. **Environment variable:**
   ```bash
   export PERPLEXITY_API_KEY=your-api-key
   # Or add to your ~/.bashrc or ~/.zshrc for persistence
   echo 'export PERPLEXITY_API_KEY=your-api-key' >> ~/.bashrc
   ```
2. **Pass directly in code or CLI:** `--api-key your-api-key`

### Available Models

The following models can be specified using the `--model` parameter:

- `llama-3.1-sonar-small-128k-online` (Faster, lighter model)
- `llama-3.1-sonar-large-128k-online` (Default, balanced model)
- `llama-3.1-sonar-huge-128k-online` (Most capable model)

## Requirements

- **Python 3.x**
- **requests library**
- **Perplexity API key** (obtain from [Perplexity API](https://docs.perplexity.ai/))

## Error Handling

The tool includes error handling for:
- **Missing API keys**
- **Invalid API responses**
- **Network issues**
- **Invalid model selections**

## Contributing

We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for more details on how to contribute to this project. Check our [CHANGELOG.md](CHANGELOG.md) for recent updates and changes.

## FAQ

**Q:** How do I get an API key for Perplexity?

**A:** You can obtain an API key by signing up on the [Perplexity API](https://docs.perplexity.ai/) website.

**Q:** What models are available for search?

**A:** The available models are `small`, `large`, and `huge`.

## License

MIT License - see the [LICENSE](LICENSE) file for details

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tom-doerr/perplexity_search",
    "name": "plexsearch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "search, perplexity, ai, llm",
    "author": "Tom Doerr",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/67/96/4080e024bd90522339ba21d6dcdfb4dbc19aba428853f96716a1cebe093d/plexsearch-0.1.17.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n# \ud83d\udd0d Perplexity Search\n\n[![Python 3.x](https://img.shields.io/badge/python-3.x-blue?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green?style=for-the-badge&logo=opensourceinitiative&logoColor=white)](https://opensource.org/licenses/MIT)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tom-doerr/perplexity_search/pulls)\n[![GitHub Issues](https://img.shields.io/github/issues/tom-doerr/perplexity_search?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tom-doerr/perplexity_search/issues)\n[![GitHub Stars](https://img.shields.io/github/stars/tom-doerr/perplexity_search?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tom-doerr/perplexity_search/stargazers)\n\nA powerful Python tool for performing technical searches using the Perplexity API, optimized for retrieving precise facts, code examples, and numerical data.\n\n<img src=\"assets/images/screenshot_2.png\" alt=\"Perplexity Search Demo\" width=\"600\"/>\n\n</div>\n\n<div align=\"center\">\n\n## \ud83d\udccb Table of Contents\n\n[Overview](#overview) \u2022\n[Features](#features) \u2022\n[Installation](#installation) \u2022\n[Usage](#usage) \u2022\n[Configuration](#configuration) \u2022\n[Requirements](#requirements) \u2022\n[Error Handling](#error-handling) \u2022\n[Contributing](#contributing) \u2022\n[FAQ](#faq) \u2022\n[License](#license)\n\n</div>\n\n## \ud83c\udf1f Overview\n\nPerplexity Search is a command-line tool and Python library that leverages the power of Perplexity AI to provide accurate, technical search results. It's designed for developers, researchers, and technical users who need quick access to precise information, code examples, and technical documentation.\n\n## \u2728 Features\n\n- **Interactive Mode:** Engage in a conversational interface where you can ask multiple queries in sequence.\n\n- **Perform searches using different LLaMA models (small, large, huge)**\n- **Configurable API key support via environment variable or direct input**\n- **Customizable search queries with temperature and other parameters**\n- **Command-line interface for easy usage**\n- **Focused on retrieving technical information with code examples**\n- **Returns responses formatted in markdown**\n- **Optimized for factual and numerical data**\n\n## Installation\n\n```bash\npip install plexsearch\n```\n\n## Usage\n\n### As a Python Module\n\n```python\nfrom perplexity_search import perform_search\n\n# Using environment variable for API key\nresult = perform_search(\"What is Python's time complexity for list operations?\")\n\n# Or passing API key directly\nresult = perform_search(\"What are the differences between Python 3.11 and 3.12?\", api_key=\"your-api-key\")\n\n# Specify a different model\nresult = perform_search(\"Show me example code for Python async/await\", model=\"llama-3.1-sonar-huge-128k-online\")\n```\n\n### Command Line Interface\n\n#### Interactive Mode\n\nTo enter interactive mode, simply run the command without any query arguments:\n\n```bash\nplexsearch\n```\n\nIn interactive mode, you can type your queries one by one. Type `exit` to quit the interactive session.\n\n```bash\n# Basic search\nplexsearch \"What is Python's time complexity for list operations?\"\n\n# Specify model\nplexsearch --model llama-3.1-sonar-huge-128k-online \"What are the differences between Python 3.11 and 3.12?\"\n\n# Use specific API key\nplexsearch --api-key your-api-key \"Show me example code for Python async/await\"\n\n# Multi-word queries work naturally\nplexsearch tell me about frogs\n\n# Disable streaming output\nplexsearch --no-stream \"tell me about frogs\"\n\n# Show numbered citations at the bottom of the response\nplexsearch --citations \"tell me about Python's GIL\"\n\nNote: Streaming is automatically disabled when running inside Aider to prevent\nfilling up the context window.\n```\n\n## Configuration\n\n### API Key\n\nSet your Perplexity API key in one of these ways:\n1. **Environment variable:**\n   ```bash\n   export PERPLEXITY_API_KEY=your-api-key\n   # Or add to your ~/.bashrc or ~/.zshrc for persistence\n   echo 'export PERPLEXITY_API_KEY=your-api-key' >> ~/.bashrc\n   ```\n2. **Pass directly in code or CLI:** `--api-key your-api-key`\n\n### Available Models\n\nThe following models can be specified using the `--model` parameter:\n\n- `llama-3.1-sonar-small-128k-online` (Faster, lighter model)\n- `llama-3.1-sonar-large-128k-online` (Default, balanced model)\n- `llama-3.1-sonar-huge-128k-online` (Most capable model)\n\n## Requirements\n\n- **Python 3.x**\n- **requests library**\n- **Perplexity API key** (obtain from [Perplexity API](https://docs.perplexity.ai/))\n\n## Error Handling\n\nThe tool includes error handling for:\n- **Missing API keys**\n- **Invalid API responses**\n- **Network issues**\n- **Invalid model selections**\n\n## Contributing\n\nWe welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for more details on how to contribute to this project. Check our [CHANGELOG.md](CHANGELOG.md) for recent updates and changes.\n\n## FAQ\n\n**Q:** How do I get an API key for Perplexity?\n\n**A:** You can obtain an API key by signing up on the [Perplexity API](https://docs.perplexity.ai/) website.\n\n**Q:** What models are available for search?\n\n**A:** The available models are `small`, `large`, and `huge`.\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A powerful Python tool for performing technical searches using the Perplexity API",
    "version": "0.1.17",
    "project_urls": {
        "Bug Tracker": "https://github.com/tom-doerr/perplexity_search/issues",
        "Documentation": "https://github.com/tom-doerr/perplexity_search#readme",
        "Homepage": "https://github.com/tom-doerr/perplexity_search",
        "Repository": "https://github.com/tom-doerr/perplexity_search"
    },
    "split_keywords": [
        "search",
        " perplexity",
        " ai",
        " llm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a3fb823dfe37024cfd17fbf67e63058a6969ce1177b9b09c2a9c0038e4cc4b4",
                "md5": "2bedc50c7ec2cf8674eaa876dfc68900",
                "sha256": "ef868174d0651496591378c3b0e2f9a17135fe46c82a8857b33677484c7ea049"
            },
            "downloads": -1,
            "filename": "plexsearch-0.1.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bedc50c7ec2cf8674eaa876dfc68900",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9852,
            "upload_time": "2024-12-11T22:50:07",
            "upload_time_iso_8601": "2024-12-11T22:50:07.792589Z",
            "url": "https://files.pythonhosted.org/packages/2a/3f/b823dfe37024cfd17fbf67e63058a6969ce1177b9b09c2a9c0038e4cc4b4/plexsearch-0.1.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67964080e024bd90522339ba21d6dcdfb4dbc19aba428853f96716a1cebe093d",
                "md5": "1f574ba645c3389f0a5dc9f5f05ae02c",
                "sha256": "9705a7e438e7fe7c6155d417cd5dada2b1bda0b271acd0dcfb020ae44afe2640"
            },
            "downloads": -1,
            "filename": "plexsearch-0.1.17.tar.gz",
            "has_sig": false,
            "md5_digest": "1f574ba645c3389f0a5dc9f5f05ae02c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10205,
            "upload_time": "2024-12-11T22:50:10",
            "upload_time_iso_8601": "2024-12-11T22:50:10.271797Z",
            "url": "https://files.pythonhosted.org/packages/67/96/4080e024bd90522339ba21d6dcdfb4dbc19aba428853f96716a1cebe093d/plexsearch-0.1.17.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 22:50:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tom-doerr",
    "github_project": "perplexity_search",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "plexsearch"
}
        
Elapsed time: 0.44676s