Code Monkey home page Code Monkey logo

Comments (12)

acheong08 avatar acheong08 commented on May 22, 2024 3

@angelfor3v3r @Pab450

from revChatGPT.revChatGPT import Chatbot
import json
# Get config
config = open("config.json", "r").read()
config = json.loads(config)
# Create a chatbot object
chatbot = Chatbot(config)

chatbot.refresh_session()

# Get a response
response = chatbot.get_chat_response("What is an egg?", output="text")

conversation = response['conversation_id']
parent_id = response['parent_id']
message = response['message']
print(message)

del chatbot

chatbot = Chatbot(config)
chatbot.conversation_id = conversation
chatbot.parent_id = parent_id
response = chatbot.get_chat_response("continue", output="text")
message = response['message']
print(message)
 $ python3 GPT.py
Logging in...
An egg is a fertilized or unfertilized reproductive cell produced by birds, reptiles, and some amphibians. In birds and reptiles, the egg contains a developing embryo, which is fed by a yolk. The egg is surrounded by a hard shell that protects the embryo and helps to regulate its temperature. In some species, the egg is also covered in a protective outer layer called the chorion. Eggs are a source of nutrition for many animals and are also used as a food by humans.
Eggs are an important food for many animals, including birds and reptiles, which use them to provide nourishment to their young. For humans, eggs are a rich source of protein, vitamins, and minerals, and are often used in cooking. They can be prepared in a variety of ways, including boiling, frying, and scrambling. Eggs are also used in many processed foods, such as baked goods and pasta. Some people also use eggs as a source of food for their pets, such as birds and reptiles.

from chatgpt.

acheong08 avatar acheong08 commented on May 22, 2024

{"detail":"Too many requests, please slow down"}

This is a sign of rate limiting. There was a limit of 48 requests per minute I think. It might have been reduced.

from chatgpt.

angelfor3v3r avatar angelfor3v3r commented on May 22, 2024

That's why I'm confused. It never seems to stop rate limiting me and my first response always goes through fine. It just gives me "too many requests" only after I start passing a "conversation_id". I've waited over 10 minutes and I still get the same error. As soon as I take out the "conversation_id" parameter, I can generate replies without issue.

from chatgpt.

acheong08 avatar acheong08 commented on May 22, 2024

Replicated. If you try to put a conversation_id manually, it fails. It might be that it compares the parent_id to the conversation_id on the server side. Try setting the correct parent_id as well as conversation_id

from chatgpt.

angelfor3v3r avatar angelfor3v3r commented on May 22, 2024

Yeah, I'm not rate limited anymore but it seems like it forgets it's previous replies for me (i.e, I ask it to write code and to modify it's last response and it doesn't understand).

I'm caching off "conversation_id" and "parent_id", then reusing both values on the next invocation of "get_chat_response".

from chatgpt.

acheong08 avatar acheong08 commented on May 22, 2024

Does it work if you run it from the command line?

 $ python3 -m revChatGPT     

    ChatGPT - A command-line interface to OpenAI's ChatGPT (https://chat.openai.com/chat)
    Repo: github.com/acheong08/ChatGPT
    
Type '!exit' to exit
Press enter twice to submit your question.

You: Hello



Chatbot: Hello! I'm Assistant, a large language model trained by OpenAI. I'm here to help you with any questions you may have. What can I help you with today?


0
You: What is an egg



Chatbot: An egg is a reproductive body produced by female birds, reptiles, insects, and other animals. It consists of a protective outer layer called the shell, a nutrient-rich white or yellowish substance called the albumen, and a central yolk that contains the egg's genetic material. Some eggs are also fertilized by a male, in which case the egg contains a developing embryo. Eggs are a common ingredient in many types of food, and they are also a good source of protein and other nutrients.


0
You: continue



Chatbot: Sure! Is there anything specific you would like me to continue talking about regarding eggs? For example, I can talk more about the different types of eggs, how they are used in cooking, or their nutritional value. Let me know if there's anything specific you're interested in.


0
You: 

from chatgpt.

angelfor3v3r avatar angelfor3v3r commented on May 22, 2024

Yes, It does. I must be doing something very wrong in my code. I'm basically doing something like so:

chatbot = Chatbot(self.chatbot_cfg, conversation_id=saved_convo_id)

if parent_id:
    chatbot.parent_id = saved_parent_id

resp = chatbot.get_chat_response("prompt")

Both my "saved_convo_id" and "saved_parent_id" are the same ones from the original reply, but the replies I get seem to forget I've been talking to it.

from chatgpt.

acheong08 avatar acheong08 commented on May 22, 2024
        self.parent_id = response["message"]["id"]
        self.conversation_id = response["conversation_id"]
        message = response["message"]["content"]["parts"][0]
        return {'message':message, 'conversation_id':self.conversation_id, 'parent_id':self.parent_id}

The get_chat_response function returns the conversation_id and parent_id. Make sure you're taking it from there.

from chatgpt.

angelfor3v3r avatar angelfor3v3r commented on May 22, 2024

I was. I'm trying a different approach now where I just cache off the entire "Chatbot" class instead. So far it seems to work better and I don't get rate limited, I need to test more though. Thanks for all the help so far!

from chatgpt.

Pab450 avatar Pab450 commented on May 22, 2024

I was. I'm trying a different approach now where I just cache off the entire "Chatbot" class instead. So far it seems to work better and I don't get rate limited, I need to test more though. Thanks for all the help so far!

Hey can you show me an example? I get the same problem and I don't quite understand how you managed to solve it?

from chatgpt.

angelfor3v3r avatar angelfor3v3r commented on May 22, 2024

My solution is pretty awful. Im just saing off the entire ChatBot class instance for each “user” in a dict. I then manually refresh tokens and such.

from chatgpt.

acheong08 avatar acheong08 commented on May 22, 2024

I will do some testing with setting the parent_id and conversation_id later today

from chatgpt.

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.