oxagast / Franklin

Franklin is a LLM powered AI IRC chat bot
https://franklin.oxasploits.com
Other
10 stars 5 forks source link

Continually rerolling cache user summeries into contextual prelude #8

Closed oxagast closed 6 months ago

oxagast commented 1 year ago

Notes:

The way Franklin works, it would very easily exceed the maximum tokens, and the maximum input data size of the API, and assuming i jailbroke it and made it work, it would be slow as dogshit, i have no way of training the logs ontop of the mode at this point since thats not how it works, it is possible, but im not sure exactly how its done, i would need to look into it, i don't think it is very feasible franklin works by using the last 6 - 9 lines of chat data for context, but beyond tha tit confuses it, because it doesn't really have a way of discerning what is relative to the current chat, thats why its history is so short and ti has no "real" long term memory aside from waht is /already/ hard coded into the model there is the possibilty of Franklin collecting information about each user mentioend in the last x lines of the chat, analyzing a short chat history of each user mentioned or talking, summarizing, then rolling that ontop of the contextual prelude -- but that is an extensive change, and im not sure, that may even exceed the text input limit whithout cache, that would /significantly/ slow down Franklin if i were to do it, i would cache, then while franklin is waiting for a new response, reanalyze with new text form the chat, and if it is asked before reanalyzation is complete and rolled into the contextual prelude, it would pull from cache lots of threading involved otherwise background rebuilding cache as users talk

oxagast commented 9 months ago

Some points that should be included in the per user summary database:

This should be called when a user asks a question of Franklin that includes this user's nickname in chat, and it will be rolled into the DCP, independently of the question asked, for more complete context. Essentially this creates a minimal profile of each user so the bot can call on real information, instead of simply guessing.

oxagast commented 6 months ago

The file format may look similar to the below for each chatter that has chatted in the channel Franklin is in.

[format version                                                          ]{4   }
[franklin ver that wrote it                                              ]{8   }
[nick (max 9 chars)                                                      ]{9   }
[null padding                                                            ]{8   }
[user summary init date (date)                                           ]{4   }
[last message date(date)                                                 ]{4   }
[num msgs since dbase init (unsigned int)                                ]{4   }
[num times queried franklin (unsigned int)                               ]{4   }
[total times this user is mentioned by other chatters(unsigned int)      }{4   }
[avg messages to all chats per hour(unsigned int)                        ]{4   }
[avg line len (short int)                                                ]{2   }
[operator status from user/voice/hop/op (byte)                           ]{1   }
[3 512 byte messages user sent as a char arr null padded(str)            ]{1536}
[null (null padding)                                                     ]{8   }
[3 random 512 byte messages sent to chat since init null padded  (str)   ]{1536}
[null padding                                                            ]{8   }
[checksum                                                                ]{4   }
oxagast commented 6 months ago

Or...

{
  "versions": {
    "userfile": "1.0.0",
    "franklin": "4.0.0"
  },
  "nick": "oxagast",
  "create_date": "04182024",
  "last_messsage_date": "04192024",
  "total_messages": 55,
  "queried_bot": 12,
  "other_mentions": 3,
  "messages_per_hour": 2,
  "average_message_length": 77,
  "operator": true,
  "messages": {
    "last_messages": [
      "hello how are you",
      "oh yeah im fine",
      "yeah my name is oxagast, whats yours"
    ],
    "random_messages": [
      "blah",
      "no i like girls toes",
      "Franklin: tell me about nyc"
    ]
  },
  "checksum": "B2CCA97A"
}
oxagast commented 6 months ago

Implementation ends up looking similar to:

  %summdb = ((versions => { selfver => $userfile, frankver => $franklinver }),
            ($nick => {create_date => "$create_date", change_date => "$change_date",
            total_messages => $totmsgs, queries_per_day => 0, mentions_per_day => 0,
            messages_per_day => 0, average_message_length => 0, operator => false,
            (messages => {last => [ $lastm[0], $lastm[1], $lastm[2] ],
            random => [ $rndm[0], $rndm[1], $rndm[2] ]})}));
  $json_nick = create_json (\%summdb);
oxagast commented 6 months ago

Thus the .json in the database, written by franklin_profiler.pl, ends up being something similar to:

{
  "oxagast": {
    "total_messages": "222",
    "messages": {
      "last": [
        "sorry for all the pings man",
        "my ad",
        "jeez 50 percent?",
        "thats insane",
        "fuck",
        "Franklin: how long is aestetix's average text on irc",
        "Franklin: how many queries have i made to you today Franklin ",
        "not yet"
      ],
      "random": []
    },
    "operator": "false",
    "queries_per_day": "66",
    "change_date": "05-14-2024",
    "messages_per_day": "221",
    "average_message_length": "26.3021819591497",
    "create_date": "05132024"
  },
  "versions": {
    "selfver": "1.2.0",
    "frankver": "4.5.0"
  }
}

This is then parsed in franklin.pl, and stuck on the end of the DCP for both the user calling Franklin, as well as any users that they mention in the query.

Currently the things recorded and updated in the user dbase are:

The result? franklin-in-action