{"id":23587678,"url":"https://github.com/tom-doerr/perplexity_search","last_synced_at":"2025-06-19T12:05:33.337Z","repository":{"id":265912143,"uuid":"896366048","full_name":"tom-doerr/perplexity_search","owner":"tom-doerr","description":"A powerful Python tool for performing technical searches using the Perplexity API, optimized for retrieving precise facts, code examples, and numerical data.","archived":false,"fork":false,"pushed_at":"2025-01-16T01:35:38.000Z","size":870,"stargazers_count":206,"open_issues_count":3,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-19T10:15:40.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tom-doerr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-30T06:56:00.000Z","updated_at":"2025-06-05T19:42:49.000Z","dependencies_parsed_at":"2024-12-02T08:02:49.367Z","dependency_job_id":"155675b1-ff05-4bf5-803d-992e207b6aff","html_url":"https://github.com/tom-doerr/perplexity_search","commit_stats":null,"previous_names":["tom-doerr/perplexity_search"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tom-doerr/perplexity_search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fperplexity_search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fperplexity_search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fperplexity_search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fperplexity_search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tom-doerr","download_url":"https://codeload.github.com/tom-doerr/perplexity_search/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fperplexity_search/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260748145,"owners_count":23056518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-27T05:01:37.375Z","updated_at":"2025-06-19T12:05:28.330Z","avatar_url":"https://github.com/tom-doerr.png","language":"Python","funding_links":[],"categories":["A01_文本生成_文本对话"],"sub_categories":["大语言对话模型及数据"],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🔍 Perplexity Search\n\n[![Python 3.x](https://img.shields.io/badge/python-3.x-blue?style=for-the-badge\u0026logo=python\u0026logoColor=white)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green?style=for-the-badge\u0026logo=opensourceinitiative\u0026logoColor=white)](https://opensource.org/licenses/MIT)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=for-the-badge\u0026logo=github\u0026logoColor=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\u0026logo=github\u0026logoColor=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\u0026logo=github\u0026logoColor=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\u003cimg src=\"assets/images/screenshot_2.png\" alt=\"Perplexity Search Demo\" width=\"600\"/\u003e\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n## 📋 Table of Contents\n\n[Overview](#overview) •\n[Features](#features) •\n[Installation](#installation) •\n[Usage](#usage) •\n[Configuration](#configuration) •\n[Requirements](#requirements) •\n[Error Handling](#error-handling) •\n[Contributing](#contributing) •\n[FAQ](#faq) •\n[License](#license)\n\n\u003c/div\u003e\n\n## 🌟 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. It also includes an interactive mode for multi-turn conversations.\n\n## ✨ Features\n\n- **Interactive Mode:** Engage in a conversational interface where you can ask multiple queries in sequence.\n- **Conversation Context:** Maintain context across multiple turns in interactive mode.\n- **Markdown Output:** Save conversation history to a markdown file.\n- **Perform searches using different LLaMA models (small, large, huge)**\n- **Configurable API key support via environment variable or direct input**\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- **Debug logging**\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` or press `Ctrl-D` 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' \u003e\u003e ~/.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### Conversation Logging\n\nYou can log your conversation to a file using the `--log-file` parameter.\n\n### Markdown Output\n\nYou can save your conversation to a markdown file using the `--markdown-file` parameter.\n\n## Requirements\n\n- **Python 3.x**\n- **requests library**\n- **rich library**\n- **feedparser 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom-doerr%2Fperplexity_search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftom-doerr%2Fperplexity_search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom-doerr%2Fperplexity_search/lists"}