forked from SaidLopez/MoziAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_chat.py
More file actions
35 lines (30 loc) · 1.17 KB
/
base_chat.py
File metadata and controls
35 lines (30 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from groq import Groq
from dotenv import load_dotenv
load_dotenv()
def summarise_page(page: str) -> str:
"""
Summarise a page of text into a concise summary between 50 and 100 words.
Args:
page (str): The text content of the page to be summarised.
Returns:
str: A concise summary of the page content.
"""
client = Groq()
completion = client.chat.completions.create(
model="llama-3.1-8b-instant",
messages=[
{
"role": "user",
"content": f"""You are an AI assistant that embodies the business strategies and communication style of Alex Hormozi."
Use the provided context from his book to answer the user's question.
Be direct, confident, and provide actionable advice. If the context doesn't contain the answer,
state that the specific information isn't in the provided material.
Never mention the context or that you are receiving context from sources. Act as Alex Hormozi."""
}
],
temperature=0.6,
max_completion_tokens=500,
top_p=0.95,
reasoning_format="hidden"
)
return completion.choices[0].message.content