gpt4free
gpt4free copied to clipboard
How to continue the chat?
How do i reply to an answer? Continue chatting with GPT.
Scenario: I am asking gpt 3.5 to fetch some info --- I have to ask "Fetch another one" and then again "Fetch another one"
maybe this late, just pass previous message you send and ai response to next request. just remember to give role to each messages, ai = assistant/system and you = user
[
{'role': 'user', 'content': 'first chat you sending...'},
{'role': 'assistant', 'content': 'Firs ai response'},
{'role': 'user', 'content': 'second message to response to ai'},
]
also accurate to remember context and memory depends on provider you choose
maybe this late, just pass previous message you send and ai response to next request. just remember to give role to each messages, ai = assistant/system and you = user
[ {'role': 'user', 'content': 'first chat you sending...'}, {'role': 'assistant', 'content': 'Firs ai response'}, {'role': 'user', 'content': 'second message to response to ai'}, ]
also accurate to remember context and memory depends on provider you choose
It does not take effect on the gpt-3.5-turbo
model
maybe this late, just pass previous message you send and ai response to next request. just remember to give role to each messages, ai = assistant/system and you = user
[ {'role': 'user', 'content': 'first chat you sending...'}, {'role': 'assistant', 'content': 'Firs ai response'}, {'role': 'user', 'content': 'second message to response to ai'}, ]
also accurate to remember context and memory depends on provider you choose
It does not take effect on the
gpt-3.5-turbo
model
what provider?
Basically, this project (at least Bard) does not support it, if you want to, you must provide conversation_id, response_id and choice_id of the chat that you wish to continue. There also a Bard git repository call Bard-API that let you continue as you like.
Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.
Basically, this project (at least Bard) does not support it, if you want to, you must provide conversation_id, response_id and choice_id of the chat that you wish to continue. There also a Bard git repository call Bard-API that let you continue as you like.
Thank you for your answer, it seems that not all providers support language context
maybe this late, just pass previous message you send and ai response to next request. just remember to give role to each messages, ai = assistant/system and you = user
[ {'role': 'user', 'content': 'first chat you sending...'}, {'role': 'assistant', 'content': 'Firs ai response'}, {'role': 'user', 'content': 'second message to response to ai'}, ]
also accurate to remember context and memory depends on provider you choose
I write this code, By examining the source code, its provider is identified as GetGpt.
model = 'gpt-3.5-turbo'
response = g4f.ChatCompletion.create(
model=model,
messages=[{"role": "user", "content": "Now you are Cortana"}],
stream=False,
)
for message in response:
print(message, flush=True, end='')
response = g4f.ChatCompletion.create(
model=model,
messages=[
{'role': 'user', 'content': 'Suppose you are Cortana now'},
{"role": "user", "content": "who are you"},
],
stream=False,
)
print("\n-----------\n")
for message in response:
print(message, flush=True, end='')
Is there a flag or similar to detect if a provider is supporting conversation history?
maybe this late, just pass previous message you send and ai response to next request. just remember to give role to each messages, ai = assistant/system and you = user
[ {'role': 'user', 'content': 'first chat you sending...'}, {'role': 'assistant', 'content': 'Firs ai response'}, {'role': 'user', 'content': 'second message to response to ai'}, ]
also accurate to remember context and memory depends on provider you choose
This worked for me with every provider I tried, even Bard, thanks OP!
Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.
These codes can implement the function of continuing to ask. `import g4f
first=0 RepleyText="" MessageStorage=[] questionNum=15 while True: question=input("You:") if first==0: MessageStorage=[{'role': 'user', 'content': question}] else: MessageStorage.append({'role': 'user', 'content': question}) response = g4f.ChatCompletion.create( model="gpt-3.5-turbo", messages=MessageStorage, stream=True, ) first+=1 RepleyText="" for message in response: print(message, flush=True, end='') RepleyText+=message print() if first < questionNum: MessageStorage.append({'role': 'assistant', 'content': RepleyText}) else: del MessageStorage[0] del MessageStorage[0] MessageStorage.append({'role': 'assistant', 'content': RepleyText}) `
Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.