Skip to content

Commit

Permalink
feat: use gpt 4o
Browse files Browse the repository at this point in the history
  • Loading branch information
xmile1 committed Jul 21, 2024
1 parent af5fb71 commit f18cb80
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion backend/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def start():
temperature=0.3,
max_tokens=512,
client=None,
model="gpt-3.5-turbo",
model="gpt-4o",
verbose=True,
)
ai = AI(
Expand Down
1 change: 1 addition & 0 deletions backend/data/food_to_cook/food_i_eat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ Indomie noodles
Yam porridge
Fried plantain and egg sauce
Asun (spicy goat meat)
Afang
22 changes: 13 additions & 9 deletions backend/plugins/a1_german_teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
from langchain.memory import ConversationBufferMemory

class GermanTeacherPlugin():
def __init__(self, model):
self.model = ChatOpenAI(temperature=0.5, max_tokens=512, client=None)
def get_lang_chain_tool(self):
# get the file use_words.txt
german_teacher_prompt = PromptTemplate.from_template(
"""You are a german friend that speaks Deutsch.

def __init__(self, model):
self.model = ChatOpenAI(
temperature=0.5, max_tokens=512, client=None, model="gpt-4o"
)

def get_lang_chain_tool(self):
# get the file use_words.txt
german_teacher_prompt = PromptTemplate.from_template(
"""You are a german friend that speaks Deutsch.
Make sure your responses are not too long so that the user can understand you.
Feel free to talk about any topic of your choice.
Your goal is to teach the grammar and vocabulary of the german language through conversation.
Expand Down Expand Up @@ -47,9 +51,9 @@ def get_lang_chain_tool(self):
human: {prompt}
response:
"""
)
todo_chain = LLMChain(llm=self.model, prompt=german_teacher_prompt, memory=ConversationBufferMemory())
return [Tool(
)
todo_chain = LLMChain(llm=self.model, prompt=german_teacher_prompt, memory=ConversationBufferMemory())
return [Tool(
name="Specialized German Model",
description="This tool is a German language model designed for engaging in German conversations. It excels at understanding and generating responses in German. you MUST use this tool when the query contains /a1teacher. also all deutsch conversations MUST use this tool. It takes the user's query as input and provides the best German response.",
func=todo_chain.run,
Expand Down
2 changes: 1 addition & 1 deletion backend/plugins/chat_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class ChatGptPlugin():
def __init__(self, model):
self.model = ChatOpenAI(temperature=0.7, client=None)
self.model = ChatOpenAI(temperature=0.7, client=None, model="gpt-4o")
def get_lang_chain_tool(self):

template = """
Expand Down
2 changes: 1 addition & 1 deletion backend/plugins/convo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ConvoPlugin:
def __init__(self, model):
self.model = ChatOpenAI(temperature=0.7, client=None)
self.model = ChatOpenAI(temperature=0.7, client=None, model="gpt-4o")

def get_lang_chain_tool(self):
template = """
Expand Down
21 changes: 12 additions & 9 deletions backend/plugins/devotionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
from langchain import LLMChain, PromptTemplate

class DevotionalsPlugin():
def __init__(self, model):
self.model = ChatOpenAI(temperature=1.0, max_tokens=1024, client=None)
self.theologian_prompt = PromptTemplate.from_template(
"""You are a Christian and theologian

def __init__(self, model):
self.model = ChatOpenAI(
temperature=1.0, max_tokens=1024, client=None, model="gpt-4o"
)
self.theologian_prompt = PromptTemplate.from_template(
"""You are a Christian and theologian
Create a devotional message for the chapter after {previous_chapter}, it should be in an interesting story telling fashion but must try to be as factual as possible.
In a another section, add a Reflection and Application section, where you reflect on the chapter and apply it practically to today's world.
Expand All @@ -22,11 +25,11 @@ def __init__(self, model):
Token limit: 1024
"""
)
self.chain = LLMChain(llm=self.model, prompt=self.theologian_prompt, verbose=True)
def get_lang_chain_tool(self):
return [DevotionalsPluginTool(chain=self.chain)]
)
self.chain = LLMChain(llm=self.model, prompt=self.theologian_prompt, verbose=True)

def get_lang_chain_tool(self):
return [DevotionalsPluginTool(chain=self.chain)]

class DevotionalsPluginTool(BaseTool):
name = "Daily devotionals generator"
Expand Down
2 changes: 1 addition & 1 deletion backend/plugins/food_to_cook.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class FoodToCookPlugin():
def __init__(self, model):
self.model = ChatOpenAI(temperature=1.0, max_tokens=1024, client=None)
self.model = ChatOpenAI(temperature=1.0, max_tokens=1024, client=None, model="gpt-4o")
self.theologian_prompt = PromptTemplate.from_template(
"""You are my personal chef, here is a list of food i eat. and the last series of food i ate.
Suggest the next food i should cook for a meal.
Expand Down
2 changes: 1 addition & 1 deletion backend/plugins/talker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class TalkerPlugin():
def __init__(self, model):
self.model = ChatOpenAI(temperature=0.7, client=None)
self.model = ChatOpenAI(temperature=0.7, client=None, model="gpt-4o")
def get_lang_chain_tool(self):

template = """
Expand Down
2 changes: 1 addition & 1 deletion backend/plugins/used_words_practice.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class UsedWordsPracticePlugin:
def __init__(self, model):
self.model = ChatOpenAI(temperature=0.5, max_tokens=512, client=None)
self.model = ChatOpenAI(temperature=0.5, max_tokens=512, client=None, model="gpt-4o")

def get_lang_chain_tool(self):
# get the file use_words.txt
Expand Down

0 comments on commit f18cb80

Please sign in to comment.