Update app.py
Browse files
app.py
CHANGED
@@ -76,12 +76,12 @@ tools = [{"type": "function", "function": record_user_details_json},
|
|
76 |
class Me:
|
77 |
|
78 |
def __init__(self):
|
79 |
-
|
80 |
-
if
|
81 |
-
print(f"Open router API Key exists and begins {
|
82 |
else:
|
83 |
print("Open router API Key not set - please head to the troubleshooting guide in the setup folder")
|
84 |
-
self.openai = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=
|
85 |
self.name = "Chaoran Zhou"
|
86 |
reader = PdfReader("me/linkedin.pdf")
|
87 |
self.linkedin = ""
|
@@ -121,7 +121,7 @@ If the user is engaging in discussion, try to steer them towards getting in touc
|
|
121 |
messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
|
122 |
done = False
|
123 |
while not done:
|
124 |
-
response = self.openai.chat.completions.create(model="meta-llama/llama-3.3-8b-instruct", messages=messages, tools=tools)
|
125 |
if response.choices[0].finish_reason=="tool_calls":
|
126 |
message = response.choices[0].message
|
127 |
tool_calls = message.tool_calls
|
|
|
76 |
class Me:
|
77 |
|
78 |
def __init__(self):
|
79 |
+
open_router_api_key = os.getenv('OPEN_ROUTER_API_KEY')
|
80 |
+
if open_router_api_key:
|
81 |
+
print(f"Open router API Key exists and begins {open_router_api_key[:8]}")
|
82 |
else:
|
83 |
print("Open router API Key not set - please head to the troubleshooting guide in the setup folder")
|
84 |
+
self.openai = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=open_router_api_key)
|
85 |
self.name = "Chaoran Zhou"
|
86 |
reader = PdfReader("me/linkedin.pdf")
|
87 |
self.linkedin = ""
|
|
|
121 |
messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
|
122 |
done = False
|
123 |
while not done:
|
124 |
+
response = self.openai.chat.completions.create(model="meta-llama/llama-3.3-8b-instruct:free", messages=messages, tools=tools)
|
125 |
if response.choices[0].finish_reason=="tool_calls":
|
126 |
message = response.choices[0].message
|
127 |
tool_calls = message.tool_calls
|