pnadel commited on
Commit
5111244
·
verified ·
1 Parent(s): 9392ded

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -1,18 +1,20 @@
1
  import gradio as gr
2
  from litellm import completion
3
  import os
4
- import yaml
5
 
6
  # Load configuration from YAML file
7
- config_path = "config.yaml"
8
- if not os.path.exists(config_path):
9
- raise FileNotFoundError(f"Configuration file {config_path} not found.")
10
- with open(config_path, 'r') as file:
11
- config = yaml.safe_load(file)
12
 
13
- os.environ["OPENAI_API_KEY"] = config.get("model_list", "")[0].get("litellm_params", "").get("api_key", "")
14
  # os.environ["GEMINI_API_KEY"] = config.get("model_list", "")[1].get("litellm_params", "").get("api_key", "")
15
 
 
 
16
  def route_llm_request(model, messages, api_key):
17
  # Verify the class API key
18
  if api_key != "your-class-key":
 
1
  import gradio as gr
2
  from litellm import completion
3
  import os
4
+ # import yaml
5
 
6
  # Load configuration from YAML file
7
+ # config_path = "config.yaml"
8
+ # if not os.path.exists(config_path):
9
+ # raise FileNotFoundError(f"Configuration file {config_path} not found.")
10
+ # with open(config_path, 'r') as file:
11
+ # config = yaml.safe_load(file)
12
 
13
+ # os.environ["OPENAI_API_KEY"] = config.get("model_list", "")[0].get("litellm_params", "").get("api_key", "")
14
  # os.environ["GEMINI_API_KEY"] = config.get("model_list", "")[1].get("litellm_params", "").get("api_key", "")
15
 
16
+ os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
17
+
18
  def route_llm_request(model, messages, api_key):
19
  # Verify the class API key
20
  if api_key != "your-class-key":