Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

search_domain_filter issues #117

Answered by AidanShipperley
mjsteffey asked this question in Q&A
Discussion options

You must be logged in to vote

The OpenAI API doesn't know anything about Perplexity's parameters. If you are ever using the OpenAI API for another API, and the other API has unique parameters, you have to pass them in extra_body.

response = client.chat.completions.create(
    model="sonar-pro",
    messages=[
        {
            "role": "user",
            "content": "What is the most recent version of Python?"
        }
    ],
    extra_body={"search_domain_filter": ["-python.org"]},
)

We know this works as well because you can use their search recency filter this way and the citations are correctly filtered (extra_body={"search_recency_filter": "hour"} will work).

But I wouldn't bother with search domain filters, …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@mjsteffey
Comment options

@IKDH
Comment options

@AidanShipperley
Comment options

@stijntratsaertit
Comment options

Answer selected by mjsteffey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants