You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seems the responses can be chunked. I had chatgpt help me with code to deal with chunked responses. Not sure if that is exactly what's happening with you but it helped me with incomplete or duplicate looking results. Note that I'm using 'answer' and not 'snippet' though:
`answer = perplexity.search(text)
full_answer = ""
last_chunk = ""
for item in answer:
if 'answer' in item and item['answer']:
current_chunk = item['answer']
if current_chunk.startswith(last_chunk):
new_content = current_chunk[len(last_chunk):]
full_answer += new_content
else:
full_answer += current_chunk
last_chunk = current_chunk
if 'final' in item and item['final']:
break
if full_answer:
print(textwrap.fill(full_answer, width=90))
else:
logging.error("No valid results found")`
I execute the following code:
The
answer
seems to have 75 yields but they are all the exact same sentence (as far of the snippet for the web result) -- it never gets completed.Same happens without login
The text was updated successfully, but these errors were encountered: