Update app.py
Browse files
app.py
CHANGED
|
@@ -82,9 +82,15 @@ class Me:
|
|
| 82 |
# print(f"Checking Keys: Open router API Key exists and begins {open_router_api_key[:8]}")
|
| 83 |
# else:
|
| 84 |
# print("Checking Keys: Open router API Key not set - please head to the troubleshooting guide in the setup folder")
|
| 85 |
-
self.openrouter = OpenAI(
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
self.name = "Chaoran Zhou"
|
| 90 |
reader = PdfReader("me/linkedin.pdf")
|
|
@@ -128,7 +134,14 @@ If the user is engaging in discussion, try to steer them towards getting in touc
|
|
| 128 |
|
| 129 |
# Generate initial response with tool handling
|
| 130 |
while not done:
|
| 131 |
-
response = self.openrouter.chat.completions.create(model="meta-llama/llama-3.3-8b-instruct:free", messages=messages, tools=tools)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
if response.choices[0].finish_reason=="tool_calls":
|
| 133 |
message = response.choices[0].message
|
| 134 |
tool_calls = message.tool_calls
|
|
|
|
| 82 |
# print(f"Checking Keys: Open router API Key exists and begins {open_router_api_key[:8]}")
|
| 83 |
# else:
|
| 84 |
# print("Checking Keys: Open router API Key not set - please head to the troubleshooting guide in the setup folder")
|
| 85 |
+
# self.openrouter = OpenAI(
|
| 86 |
+
# base_url="https://openrouter.ai/api/v1",
|
| 87 |
+
# api_key= os.getenv('OPEN_ROUTER_API_KEY') ) # open_router_api_key
|
| 88 |
+
|
| 89 |
+
# Initialize Gemini client using OpenAI format
|
| 90 |
+
self.gemini = OpenAI(
|
| 91 |
+
api_key=os.getenv("GOOGLE_API_KEY"),
|
| 92 |
+
base_url="https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 93 |
+
)
|
| 94 |
|
| 95 |
self.name = "Chaoran Zhou"
|
| 96 |
reader = PdfReader("me/linkedin.pdf")
|
|
|
|
| 134 |
|
| 135 |
# Generate initial response with tool handling
|
| 136 |
while not done:
|
| 137 |
+
# response = self.openrouter.chat.completions.create(model="meta-llama/llama-3.3-8b-instruct:free", messages=messages, tools=tools)
|
| 138 |
+
|
| 139 |
+
response = self.gemini.chat.completions.create(
|
| 140 |
+
model="gemini-2.5-flash-preview-05-20",
|
| 141 |
+
messages=messages,
|
| 142 |
+
tools=tools
|
| 143 |
+
)
|
| 144 |
+
|
| 145 |
if response.choices[0].finish_reason=="tool_calls":
|
| 146 |
message = response.choices[0].message
|
| 147 |
tool_calls = message.tool_calls
|