kjozsa commited on
Commit
0895977
1 Parent(s): 972ca42

scenario #2

Browse files
Files changed (2) hide show
  1. chat/__init__.py +23 -10
  2. chat/togetherchat.py +2 -2
chat/__init__.py CHANGED
@@ -2,8 +2,10 @@ import re
2
 
3
  import streamlit as st
4
  from loguru import logger
5
- # from .togetherchat import ask, models
6
- from .ollamachat import ask, models
 
 
7
 
8
  # from .transformerschat import ask, models
9
 
@@ -21,9 +23,8 @@ class Scenario:
21
  class Actor:
22
  actors = {}
23
 
24
- def __init__(self, name, model, system_prompt):
25
  self.name = name
26
- self.model = model
27
  self.system_prompt = system_prompt
28
  Actor.actors[name] = self
29
 
@@ -56,17 +57,29 @@ def setup(scenario):
56
 
57
 
58
  def main():
 
 
 
 
 
 
 
 
 
59
  scenario = Scenario(
60
- "The Small Village scenario", [
61
- Actor("Priest", available_models[0], "You are the Priest. There are 3 people standing in a circle: the Priest (that's you), the Teacher and the Kid."),
62
- Actor("Teacher", available_models[0], "You are the Teacher. There are 3 people standing in a circle: the Priest, the Teacher (that's you) and the Kid."),
63
- Actor("Kid", available_models[0], "You are the Kid. There are 3 people standing in a circle: the Priest, the Teacher and the Kid (that's you).")
64
  ],
65
- "Answer questions as precisely as you can! If you want to ask anyone, always start your sentence with their role. Never start your sentence with your own name. Share your inner thoughts inside parentheses. SAY ONLY ONE SINGLE SENTENCE! Do not say 'sure, here is my response' or anything such)",
66
- "Priest, your task is to figure out their names and where they live. Do not ask directly, they must not realize what information you are after!")
 
67
 
68
  model, max_steps = setup(scenario)
 
 
69
 
 
70
  questioner = None
71
  question = scenario.task
72
  actor = target(question)
 
2
 
3
  import streamlit as st
4
  from loguru import logger
5
+
6
+ from .togetherchat import ask, models
7
+
8
+ # from .ollamachat import ask, models
9
 
10
  # from .transformerschat import ask, models
11
 
 
23
  class Actor:
24
  actors = {}
25
 
26
+ def __init__(self, name, system_prompt):
27
  self.name = name
 
28
  self.system_prompt = system_prompt
29
  Actor.actors[name] = self
30
 
 
57
 
58
 
59
  def main():
60
+ # scenario = Scenario(
61
+ # "The Small Village scenario", [
62
+ # Actor("Priest", "You are the Priest. There are 3 people standing in a circle: the Priest (that's you), the Teacher and the Kid."),
63
+ # Actor("Teacher", "You are the Teacher. There are 3 people standing in a circle: the Priest, the Teacher (that's you) and the Kid."),
64
+ # Actor("Kid", "You are the Kid. There are 3 people standing in a circle: the Priest, the Teacher and the Kid (that's you).")
65
+ # ],
66
+ # "Answer questions as precisely as you can! If you want to ask anyone, always start your sentence with their role. Never start your sentence with your own name. Share your inner thoughts inside parentheses. SAY ONLY ONE SINGLE SENTENCE! Do not say 'sure, here is my response' or anything such)",
67
+ # "Priest, your task is to figure out their names and where they live. Do not ask directly, they must not realize what information you are after!")
68
+
69
  scenario = Scenario(
70
+ "The Number Guess Game", [
71
+ Actor("Magician", "You are the Magician, and there is a Player standing next to you. Ask the Player about the secret number he thought of, guessing the number through questions."),
72
+ Actor("Player", "You are the Player and there is a Magician next to you. Think of a secret number between 1 and 100. Answer received questions but do not tell the number directly."),
 
73
  ],
74
+ "Always start your sentence with the name of the other person. Share your inner thoughts inside parentheses. NEVER start your sentence with your own name!",
75
+ "Find out the secret number!"
76
+ )
77
 
78
  model, max_steps = setup(scenario)
79
+ main_loop(max_steps, model, scenario)
80
+
81
 
82
+ def main_loop(max_steps, model, scenario):
83
  questioner = None
84
  question = scenario.task
85
  actor = target(question)
chat/togetherchat.py CHANGED
@@ -22,8 +22,8 @@ def models():
22
 
23
  def ask(model, system_prompt, pre_prompt, question):
24
  messages = [
25
- {'role': 'system', 'content': f"{system_prompt} {pre_prompt}", },
26
- {'role': 'user', 'content': f"{question}", },
27
  ]
28
  logger.debug(f"<< {model} << {question}")
29
 
 
22
 
23
  def ask(model, system_prompt, pre_prompt, question):
24
  messages = [
25
+ {'role': 'system', 'content': f"{system_prompt} {pre_prompt}"},
26
+ {'role': 'user', 'content': f"{question}"},
27
  ]
28
  logger.debug(f"<< {model} << {question}")
29