transitive-bullshit / agentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.
https://agentic.so
MIT License
16.22k stars 2.12k forks source link

how to send last 5 message by user_id ? #591

Closed mtariqsajid closed 3 months ago

mtariqsajid commented 1 year ago

Describe the feature

I want to know is there a way to send last 5 message of the user in sendMessage method

let options: any = {
   completionParams: {
      model: openAIModelDB,
      messages: [{
            role: 'user',
            content: 'when obama was born'
         },
         {
            role: 'assistant',
            content: 'Barack Obama was born on August 4, 1961.'
         },
         {
            role: 'user',
            content: 'when obama was born'
         },
         {
            role: 'assistant',
            content: 'Barack Obama was born on August 4, 1961.'
         }
      ]
   }
};

   options.completionParams = {
      ...options.completionParams,
      stop: data?.stopSequences,
      temperature: data?.temperature,
      top_p: data?.topP,
      presence_penalty: data?.presencePenalty,
      frequency_penalty: data?.frequencyPenalty,
   };

const res = await ChatGpt.ChatGPTClient.sendMessage(message, options);

right now Messages are omit in sendMessage method

what i am trying to do is create a chat message like chatgpt and i want to get all message by user id then send last 5 message to chatgpt right now we can only send last message parent id to chatgpt. and parent message is change every time new message is return is there is a possibility to keep parent message id same but change the chat message id

mtariqsajid commented 1 year ago

anyone help me here @transitive-bullshit

chenweiyi commented 1 year ago

maybe this pr can help you.

transitive-bullshit commented 3 months ago

This project is undergoing a major revamp; closing out old issues as part of the prep process.

The chatgpt package is pretty outdated at this point. I recommend that you use the openai package or the openai-fetch package instead.