deep-diver / LLM-As-Chatbot

LLM as a Chatbot Service
Apache License 2.0
3.28k stars 382 forks source link

Can Ping Pong principle be applied to let 2 LLM Chatbots talk to each other fully automatically? #81

Open jbdatascience opened 1 year ago

jbdatascience commented 1 year ago

I wonder: Can Ping Pong principle be applied to let 2 LLM Chatbots talk to each other fully automatically?

deep-diver commented 1 year ago

Yes

Just create single pinpongs (list) Then share it with two different prompt objects

jbdatascience commented 1 year ago

Yes

Just create single pinpongs (list) Then share it with two different prompt objects

Interesting! Could you show a piece of Python could to do just that ?

deep-diver commented 1 year ago

for example, lets say you want to switch between different prompting styles of from Alapca and StableLM while underlying chats are shared

from pingpong.gradio import GradioAlpacaChatPPManager
from pingpong.gradio import GradioStableLMChatPPManager

pingpongs = []

alpaca = GradioAlpacaChatPPManager()
stablelm = GradioStableLMChatPPManager()

alpaca.ctx = "this is a context"
alpaca.pingpongs = pingpongs
stablelm.ctx = "this is a context"
stablelm.pingpongs = pingpongs

alpaca.add_ping("hello") # starting prompt

prompt_for_stablelm = stablelm.build_prompts()
stablelm.add_pong(generate(prompt_for_stablelm)) # generate is a function to generate text based on given prompt

prompt_for_alpaca = alpaca.build_prompts()
alpaca.add_pong(generate(prompt_for_alpaca))

...
jbdatascience commented 1 year ago

Thank you. I will try this out and see where it takes me!