Skip to content

Commit

Permalink
Making the program OOP
Browse files Browse the repository at this point in the history
  • Loading branch information
MEgooneh committed Sep 24, 2023
1 parent c1f3f38 commit 17102fe
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 250 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# MafiaGPT

## Recorded games
There is some recorded games as sample in Sample folder as log file and in the github pages as markdown : [link](https://megooneh.github.io/MafiaGPT/Samples/1/)

## Intro

a program that moderate a [Mafia(Werewolf)](https://en.wikipedia.org/wiki/Mafia_(party_game)) game with 7 players between GPT models.

to see communication, team work and social/logical abilities of GPT model.(it is fun and educational)
Expand Down Expand Up @@ -71,12 +66,14 @@ events are :
'reason':"<complete response>"
}
```
- vote_start
- vote_end
- vote_results :

- vote_start :
```javascript
'content':"<votes_list>"
'content':{
'player':"<player_number>"
'voted_to_player':"<player_number>"
'reason':"<complete response>"
}
```

- healed :
Expand Down
28 changes: 16 additions & 12 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

import openai, os, time

# getting open ai api key from the evnironmental variables
# this is for printing messages in terminal
DEBUG = False


# getting open ai api key from the evnironmental variables
openai.api_key = os.getenv("OPENAI_API_KEY")

# make content in openai wanted format
Expand All @@ -32,16 +35,17 @@ def send_message(intro , game_report , command , token_limit=TOKEN_LIMIT , time_
temperature=TEMPERATURE
)
# just for debugging in terminal
print(f"""
#######################
{intro}
#######################
{game_report}
#######################
{command}
#######################
-----------------------------
{response.choices[0].message["content"]}
""")
if DEBUG:
print(f"""
#######################
{intro}
#######################
{game_report}
#######################
{command}
#######################
-----------------------------
{response.choices[0].message["content"]}
""")
# returning the response as a string
return response.choices[0].message["content"]
Loading

0 comments on commit 17102fe

Please sign in to comment.