helallao / perplexity-ai

Unofficial API Wrapper for Perplexity.ai + Account Generator
https://perplexity.ai
MIT License
285 stars 50 forks source link

Followup after file upload losing context #22

Closed dallecki closed 1 year ago

dallecki commented 1 year ago

I'm running the task on perplexity webpage with the file :

  1. Question on perplexity.ai : www_question

  2. Followup has the same file as a source: www_followup

Next, I'm running the code with streamlit and asking the same question and followup on the same file:

backend_uuid = None
first_query = st.session_state.last_perplexity_response is None
if not first_query: 
    backend_uuid = st.session_state.last_perplexity_response['backend_uuid']
if first_query:
    my_file = (open('apple_cake.txt', 'rb').read(), 'txt')
    perplexity_response = st.session_state.perplexity_cli.search(prompt, mode='concise', file = my_file)
else: 
    perplexity_response = st.session_state.perplexity_cli.search(prompt, mode='concise', follow_up = backend_uuid)
bot_response = perplexity_response['text']['answer']
st.session_state.last_perplexity_response = perplexity_response
  1. Question on perplexity.ai: wrapper_question

  2. Followup on perplexity.ai is not using the file as a source: wrapper_followup

helallao commented 1 year ago

I made some changes with last update. But i'm not really sure if it is fixed indeed. By the way you can upload multiple files at once now. Please read new readme and reply me if it's fixed or not.

dallecki commented 1 year ago

It's fixed. Thanks a lot.