BotifyCloudAdmin commited on
Commit
48ddf58
·
verified ·
1 Parent(s): d6b7bed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -15
app.py CHANGED
@@ -5,21 +5,16 @@ from typing import List, Tuple
5
 
6
  # Define available models
7
  AVAILABLE_MODELS = {
8
- "DeepSeek V3": "deepseek-ai/DeepSeek-V3",
9
- "Llama3.3-70b-Instruct": "meta-llama/Llama-3.3-70B-Instruct",
10
- "Llama3.1-8b-Instruct": "meta-llama/Meta-Llama-3.1-8B-Instruct",
11
  }
12
 
13
- HYPERB_ENDPOINT_URL = "https://api.hyperbolic.xyz/v1"
14
- HF_ENDPOINT_URL = "https://huggingface.co/api/inference-proxy/together"
15
- HYPERB_API_KEY = os.getenv('HYPERBOLIC_XYZ_KEY')
16
- HF_API_KEY = os.getenv('HF_KEY')
17
  PASSWORD = os.getenv("PASSWD") # Store the password in an environment variable
18
 
19
  DEPLOY_TO_HF = ["deepseek-ai/DeepSeek-V3"]
20
 
21
- hyperb_client = OpenAI(base_url=HYPERB_ENDPOINT_URL, api_key=HYPERB_API_KEY)
22
- hf_client = OpenAI(base_url=HF_ENDPOINT_URL, api_key=HF_API_KEY)
23
 
24
  def respond(
25
  message: str,
@@ -40,12 +35,7 @@ def respond(
40
 
41
  response = ""
42
 
43
- if model_choice in DEPLOY_TO_HF:
44
- this_client = hf_client
45
- else:
46
- this_client = hyperb_client
47
-
48
- for chunk in this_client.chat.completions.create(
49
  model=AVAILABLE_MODELS[model_choice], # Use the selected model
50
  messages=messages,
51
  max_tokens=max_tokens,
 
5
 
6
  # Define available models
7
  AVAILABLE_MODELS = {
8
+ "Sonar Pro": "sonar-pro",
 
 
9
  }
10
 
11
+ PX_ENDPOINT_URL = "https://api.perplexity.ai"
12
+ PX_API_KEY = os.getenv('PX_KEY')
 
 
13
  PASSWORD = os.getenv("PASSWD") # Store the password in an environment variable
14
 
15
  DEPLOY_TO_HF = ["deepseek-ai/DeepSeek-V3"]
16
 
17
+ px_client = OpenAI(base_url=PX_ENDPOINT_URL, api_key=PX_API_KEY)
 
18
 
19
  def respond(
20
  message: str,
 
35
 
36
  response = ""
37
 
38
+ for chunk in px_client.chat.completions.create(
 
 
 
 
 
39
  model=AVAILABLE_MODELS[model_choice], # Use the selected model
40
  messages=messages,
41
  max_tokens=max_tokens,