• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Emergent generative agents


Commit MetaInfo

Revisioncfbf97cd1d5d10fa0fd77ef16b2b582c5463d7c8 (tree)
Zeit2023-05-20 04:04:24
AutorCorbin <cds@corb...>
CommiterCorbin

Log Message

Well, it works. But it sucks.

Fuck it. Nobody gives a shit anyway.

Ändern Zusammenfassung

Diff

--- a/src/agent.py
+++ b/src/agent.py
@@ -132,13 +132,15 @@ class Clock(Agent):
132132 class LeftBrainInterpreter(Agent):
133133 tag = "lbi"
134134 events = 0
135- def __init__(self, mind): self.mind = mind
135+ def __init__(self, mind, idle):
136+ self.mind = mind
137+ self.idle = idle
136138 def overhear(self, tag, subtag, s):
137- # XXX should skip thoughts, maybe?
138- self.events += 1
139+ if tag != "thoughts": self.events += 1
139140 if self.events >= 20:
140141 self.events = 0
141- return self.mind.infer(self.tag, self.subtag, "")
142+ d = self.mind.infer(self.tag, self.subtag, "")
143+ d.addCallback(lambda s: s.strip() or self.idle())
142144
143145 choices = {
144146 "irc": "Chat on IRC, channel {subtag}",
@@ -146,6 +148,7 @@ choices = {
146148 }
147149 def choicify(options):
148150 return " ".join(f"({c}) {o}" for c, o in zip(ascii_uppercase, options))
151+def indexify(c): return ord(c[0].upper()) - ord('A')
149152
150153 class ChoiceMaker(Agent):
151154 tag = "choice"
@@ -165,11 +168,9 @@ class ChoiceMaker(Agent):
165168
166169 prompt = choicify([choices[tag].format(subtag=subtag)
167170 for tag, subtag in possibilities])
168- self.broadcast(prompt)
169- d = self.mind.forceChoice(self.tag, self.subtag, "My choice: ",
171+ d = self.mind.forceChoice(self.tag, self.subtag, prompt + " My choice: ",
170172 ascii_uppercase[:len(possibilities)])
171- d.addCallback(lambda s: self.dispatch(*possibilities[chr(ord(s[0]) -
172- ord('A'))]))
173+ d.addCallback(lambda s: self.dispatch(*possibilities[indexify(s)]))
173174 return d
174175
175176 class ChainOfThoughts(Agent):
@@ -269,7 +270,7 @@ class IRCFactory(ClientFactory):
269270 def go():
270271 print("~ Starting tasks…")
271272 clock = Clock()
272- LoopingCall(clock.go).start(60 * 10, now=False)
273+ LoopingCall(clock.go).start(60 * 30, now=True)
273274
274275 for logpath in sys.argv[2:]:
275276 character = load_character(logpath)
@@ -282,14 +283,14 @@ def go():
282283 with Timer("initial warmup"):
283284 mind.logits, mind.state = gen.feedForward(gen.tokenize(firstStatement), None, None)
284285
285- lbi = LeftBrainInterpreter(mind)
286- clock.listeners += lbi, mind
287-
288286 cm = ChoiceMaker(mind)
289287
288+ lbi = LeftBrainInterpreter(mind, cm.idle)
289+ clock.listeners += lbi, mind
290+
290291 thoughts = ChainOfThoughts(mind, thoughtIndex, firstStatement, cm.idle)
291292 thoughts.listeners = lbi, mind
292- LoopingCall(thoughts.go).start(60, now=False)
293+ LoopingCall(thoughts.go).start(60 * 3, now=True)
293294
294295 print("~ Thought index:", thoughtIndex.size(), "thoughts")
295296 factory = IRCFactory(mind, cm, (thoughts, lbi, cm, mind),