Giter Club home page Giter Club logo

Comments (5)

terry3041 avatar terry3041 commented on July 30, 2024

Hi. I cannot reproduce the same issue.
This is most likely due to passing an incorrect/malformatted conversation_id or parent_id to the ChatGPT class.
Can you please check if you are inputting a correct value?

from pychatgpt.

JingxinLee avatar JingxinLee commented on July 30, 2024

I don't use conversation_id and parent_id, every conversation is independent.
BTW, should I use below code every time I send_message? or I will do it once among the 1000 sentences generation?

api.refresh_auth()  # refresh the authorization token & cf cookies
api.reset_conversation()  # reset the conversation

from pychatgpt.

terry3041 avatar terry3041 commented on July 30, 2024

What do you mean by to generate 1000 sentences. May I have the code snippet or the prompt that you are using?
Also, you don't need to use refresh_auth() as it is done every time when you use send_message().
Normally, the library will keep conversation just like the normal ChatGPT website.
If you want to reset the conversation, you can use reset_conversation().

from pychatgpt.

JingxinLee avatar JingxinLee commented on July 30, 2024

I have 1000 sentences in a csv file and I want to use chatGPT to generate 1000 specific paraphrases.

session_token = 'ey...w'   # `__Secure-next-auth.session-token` cookie from https://chat.openai.com/chat
api = ChatGPT(session_token)  # auth with session token
api2 = ChatGPT(email='[email protected]', password='zzz')  # auth with email and password
api3 = ChatGPT(email='[email protected]', password='zzz')  # auth with email and password

data = pd.read_csv('sentences1000.csv', header=0, names=['sentences'])
prompt = 'paraprase this sentence:'

def chatgpt_response(message, myapi):
    resp = myapi.send_message(message)
    return resp['message']

def get_results(data, prompt):
    results = []
    prompt_data = prompt + data
    for i,v in prompt_data['sentences'].items():            
        try:
            result = chatgpt_response(v, api)
            # api.refresh_auth()  # refresh the authorization token
            api.reset_conversation()  # reset the conversation
        except Exception as e:
            print(e)
            try:
                result = chatgpt_response(v, api2)
                # api2.refresh_auth()  # refresh the authorization token
                api2.reset_conversation()  # reset the conversation
            except Exception as e:
                print(e)
                result = chatgpt_response(v, api3)
                # api3.refresh_auth()  # refresh the authorization token
                api3.reset_conversation()  # reset the conversation
        print(result)
        results.append(result)
    results_pd = pd.DataFrame(results, columns=['outputs'])
    results_pd.to_csv('chatgpt_results.csv', index=False)
    return results

from pychatgpt.

terry3041 avatar terry3041 commented on July 30, 2024

I have 1000 sentences in a csv file and I want to use chatGPT to generate 1000 specific paraphrases.

This probably triggered the rate limit of ChatGPT.
AFAIK, ChatGPT has a limit of 45 requests/minute and this library does not have rate limit handling yet.
You can try to slow it down by adding time.sleep.

from pychatgpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.