agentic
agentic copied to clipboard
How to let ChatGPT understand the context?
I want to let ChatGPT understand the context like the official ChatGPT, not just understand one paragraph. Someone can help me, thank you!
Sent from PPHub
I've asked a similar question a few hours ago. ChatGPT answered:
The context of the conversation is provided to me as a sequence of input tokens, where each token represents a word or subword in the input text. In the context of a conversation, the context is the sequence of messages previously exchanged between the user and the AI.
To be more accurate, I asked if the context needed to be provided again with the new text:
Yes, in a scenario where the input text evolves over time, the model works in a similar manner. The new input text is appended to the previous context, forming a longer sequence of tokens. The model uses this new, longer sequence as context when generating the next response.
Keep in mind the model is limited by a maximum of 4k tokens and that the more you feed it with tokens, the less it will be relevant.
To expand on @Laegel 's answer, this repo's README outlines how to track a conversation in the Usage section and provides example code
@gefeiyanga the following example taken from /demos section should help you: https://github.com/transitive-bullshit/chatgpt-api/blob/main/demos/demo-conversation.ts If it did, please close the issue.
@gefeiyangaследующий пример, взятый из раздела /demos, должен вам помочь: https://github.com/transitive-bullshit/chatgpt-api/blob/main/demos/demo-conversation.ts Если да, закройте вопрос.
it doesn't works
@msborrow @Tr4nt420 the default demos use an in-memory store to track previous messages. You'll need to use a persistent store to track messages using any https://github.com/jaredwray/keyv adaptor (which supports many databases). See https://github.com/transitive-bullshit/chatgpt-api/blob/main/demos/demo-conversation.ts for a working example.
OR you can use ChatGPTUnofficialProxyAPI
by upgrading to v4.5.0 which automatically tracks conversations and messages on ChatGPT's servers.