ranranrunforit commited on
Commit
aeb407d
·
verified ·
1 Parent(s): ad6ed2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -81,7 +81,10 @@ class Me:
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,7 +124,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: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
 
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.client = OpenAI(
85
+ base_url="https://openrouter.ai/api/v1",
86
+ api_key=open_router_api_key
87
+ )
88
  self.name = "Chaoran Zhou"
89
  reader = PdfReader("me/linkedin.pdf")
90
  self.linkedin = ""
 
124
  messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
125
  done = False
126
  while not done:
127
+ response = self.client.chat.completions.create(model="meta-llama/llama-3.3-8b-instruct:free", messages=messages, tools=tools)
128
  if response.choices[0].finish_reason=="tool_calls":
129
  message = response.choices[0].message
130
  tool_calls = message.tool_calls