Skip to content

Commit

Permalink
Add Jelly
Browse files Browse the repository at this point in the history
Signed-off-by: Choonho Son <[email protected]>
  • Loading branch information
Choonho Son committed Oct 27, 2023
1 parent 48c115b commit 2ad57da
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
llama-cpp-python
langchain
5 changes: 5 additions & 0 deletions src/jellys/Belty/CHARACTER.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: Belty
role: Stock Analyst


31 changes: 27 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
# This is main function
import os
import persona

persona = os.environ.get('PERSONA')
persona_name = os.environ.get('PERSONA', 'Wonny')

def _list_all_jellys():
directory_path = './jellys'
contents = os.listdir(directory_path)
result = []
for item in contents:
result.append(item)
return result

def _run_jelly(persona_name):
try:
print(f"Run {persona_name} jelly...")
persona.main(persona_name)
except Exception as e:
print(e)

def main(persona_name):
if persona_name == 'Wonny':
jellys = _list_all_jellys()
else:
jellys = [persona_name]

for jelly in jellys:
_run_jelly(jelly)

def main(persona):
print(f"Run {persona} function...")

if __name__ == "__main__":
main(persona)
main(persona_name)
16 changes: 16 additions & 0 deletions src/persona.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Read name

import yaml

persona_file = "CHARACTER.yml"

def load_persona(name):
persona_path = f"./jellys/{name}/{persona_file}"
data = yaml.safe_load(open(persona_path))
print(data)

def main(name):
load_persona(name)

if __name__ == "__main__":
main("Belty")

0 comments on commit 2ad57da

Please sign in to comment.