Unable to make it work with perplexity pro enterprise account #68

Open
opened 2025-09-12 06:34:16 -04:00 by Nimre · 3 comments
Nimre commented 2025-09-12 06:34:16 -04:00 (Migrated from github.com)

Hello,

I've been trying to make it work but got no luck at all. I just downloaded it today (last version). I've seen you added support to the newest models (but system logs still saying gpt4 and grok 2 for example).

{
"query": "test",
"mode": "pro",
"model": "gpt5",
"sources": ["web"]
}

Traceback (most recent call last):
File "/app.py", line 24, in search
resp = client.search(query, mode=mode, model=model, sources=sources, stream=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/perplexity/client.py", line 87, in search
assert model in {
^^^^^^^^^^
AssertionError: Models for modes -> {
'auto': [None],
'pro': [None, 'sonar', 'gpt-4.5', 'gpt-4o', 'claude 3.7 sonnet', 'gemini 2.0 flash', 'grok-2'],
'reasoning': [None, 'r1', 'o3-mini', 'claude 3.7 sonnet'],
'deep research': [None]
}
172.18.0.2 - - [12/Sep/2025 10:28:28] "POST /search HTTP/1.1" 500 -

{
"query": "test",
"mode": "pro",
"model": "sonar",
"sources": ["web"]
}
Traceback (most recent call last):
File "/app.py", line 24, in search
resp = client.search(query, mode=mode, model=model, sources=sources, stream=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/perplexity/client.py", line 206, in search
content_json['text'] = json.loads(content_json['text'])
~~~~~~~~~~~~^^^^^^^^
KeyError: 'text'
172.18.0.2 - - [12/Sep/2025 10:29:23] "POST /search HTTP/1.1" 500 -

Hello, I've been trying to make it work but got no luck at all. I just downloaded it today (last version). I've seen you added support to the newest models (but system logs still saying gpt4 and grok 2 for example). { "query": "test", "mode": "pro", "model": "gpt5", "sources": ["web"] } Traceback (most recent call last): File "/app.py", line 24, in search resp = client.search(query, mode=mode, model=model, sources=sources, stream=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/perplexity/client.py", line 87, in search assert model in { ^^^^^^^^^^ AssertionError: Models for modes -> { 'auto': [None], 'pro': [None, 'sonar', 'gpt-4.5', 'gpt-4o', 'claude 3.7 sonnet', 'gemini 2.0 flash', 'grok-2'], 'reasoning': [None, 'r1', 'o3-mini', 'claude 3.7 sonnet'], 'deep research': [None] } 172.18.0.2 - - [12/Sep/2025 10:28:28] "POST /search HTTP/1.1" 500 - { "query": "test", "mode": "pro", "model": "sonar", "sources": ["web"] } Traceback (most recent call last): File "/app.py", line 24, in search resp = client.search(query, mode=mode, model=model, sources=sources, stream=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/perplexity/client.py", line 206, in search content_json['text'] = json.loads(content_json['text']) ~~~~~~~~~~~~^^^^^^^^ KeyError: 'text' 172.18.0.2 - - [12/Sep/2025 10:29:23] "POST /search HTTP/1.1" 500 -
Nimre commented 2025-09-22 15:46:43 -04:00 (Migrated from github.com)

is this still active?

is this still active?
liaoandi commented 2025-09-28 03:01:31 -04:00 (Migrated from github.com)

Same problem here. I have to manually modify & add the model name in the client.py to solve it, like gpt5 and o3.

Same problem here. I have to manually modify & add the model name in the client.py to solve it, like gpt5 and o3.
lifanwar commented 2025-11-24 13:17:18 -05:00 (Migrated from github.com)

This issue occurs because the model endpoints have changed in the latest Perplexity update. The error shows two problems:

  1. AssertionError - The model name mapping is outdated
  2. KeyError: 'text' - The response structure has changed

Solution

I've created a pull request with fixes for the async implementation and proper error handling:

These PRs include updated async methods with proper error handling for the new response structure. You can use these branches directly while waiting for the merge, or apply the changes manually from the pull requests.

Note: The sync version may still have similar issues with the updated endpoints that need to be addressed separately.

This issue occurs because the model endpoints have changed in the latest Perplexity update. The error shows two problems: 1. **AssertionError** - The model name mapping is outdated 2. **KeyError: 'text'** - The response structure has changed ### Solution I've created a pull request with fixes for the async implementation and proper error handling: - **PR #75:** https://github.com/helallao/perplexity-ai/pull/75 (async fixes) - **PR #76:** https://github.com/helallao/perplexity-ai/pull/76 (async fixes) These PRs include updated async methods with proper error handling for the new response structure. You can use these branches directly while waiting for the merge, or apply the changes manually from the pull requests. Note: The sync version may still have similar issues with the updated endpoints that need to be addressed separately.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
helallao/perplexity-ai#68
No description provided.