perplexity pipe

function

Perplexity pipe with beautiful references

neuromechanist
@neuromechanist
·
a year ago
109
0
964
Created Aug 1, 2025
perplexity_pipe.py
Python · 229 lines
"""
title: Perplexity Function (Simplified)
author: Seyed Yahya Shirazi
author_url: neuromechanist.github.io
date: 2024-11-19
version: 2.1
license: MIT
description: A simplified function for generating text using the Perplexity API with citations.
requirements: aiohttp, pydantic
environment_variables: PERPLEXITY_API_KEY
"""

Perplexity Search Function with Citations

Purpose: Access Perplexity's web-search enhanced AI models with automatic citation formatting.

##Features:
✅ Models: Sonar Reasoning, Sonar Pro, Sonar

✅ Citations: Automatic reference formatting ([1] url, [2] url)

✅ Web Search: Built-in internet search capabilities

✅ Search Filters: Domain filtering, recency filters, image search

✅ Clean Formatting: Citations appended neatly at the response end

Best For: Research queries, current events, fact-checking - when you need web-sourced answers with proper citations.


0