Skip to content

Instantly share code, notes, and snippets.

@bmorphism
Created April 22, 2024 18:41
Show Gist options
  • Save bmorphism/28cce5f6ba8fc1d5cf0ced15991567f2 to your computer and use it in GitHub Desktop.
Save bmorphism/28cce5f6ba8fc1d5cf0ced15991567f2 to your computer and use it in GitHub Desktop.
poe.hy
(import os)
(import typing [AsyncIterable])
(import fastapi_poe [PoeBot PartialResponse run])
(import so [grow cogenerate])
(print (grow "oy" "vey"))
(setv POE_BOT_KEY (os.getenv "POE_BOT_KEY"))
(defclass ReflectBot [PoeBot]
(defn __init__ [self world]
(.__init__ (super))
(setv self.world world)
)
(defn/a get_response [self query]
(setv tabernacle (get query.query -1))
(setv last_message tabernacle.content)
(setv self.world (grow self.world last_message))
(yield (PartialResponse :text self.world))
)
)
(run (ReflectBot "welt"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment