Palbha Kulkarni (Nazwale) commited on
Commit
785d301
·
unverified ·
1 Parent(s): d1621f9

Update baseline_code.py

Browse files
Files changed (1) hide show
  1. baseline_code.py +24 -4
baseline_code.py CHANGED
@@ -5,6 +5,24 @@ print(df)
5
 
6
  from openai import OpenAI
7
  #Feel free to use chatgpt or other models - Google offere free gemini api hence I have used this
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
 
10
  import pandas as pd
@@ -94,10 +112,12 @@ def generate_answer(message,model_choice,api_key):
94
  "content": f"Context:\n{context_text}\n\nQuestion: {message}\nAnswer:"
95
  }
96
  ]
97
- openai = OpenAI(
98
- base_url="https://generativelanguage.googleapis.com/v1beta/",
99
- api_key=api_key,
100
- )
 
 
101
 
102
  response = openai.chat.completions.create(
103
  model="gemini-1.5-flash",
 
5
 
6
  from openai import OpenAI
7
  #Feel free to use chatgpt or other models - Google offere free gemini api hence I have used this
8
+ model_name = {
9
+ "OpenAI GPT-4": {
10
+ "name": "gpt-4",
11
+ "url": "https://api.openai.com/v1/" # Replace with correct OpenAI base URL
12
+ },
13
+ "Gemini 1.5Flash": {
14
+ "name": "gemini-1.5-flash",
15
+ "url": "https://generativelanguage.googleapis.com/v1beta/"
16
+ },
17
+ "Gemini 2.0Flash": {
18
+ "name": "gemini-2.0-flash",
19
+ "url": "https://generativelanguage.googleapis.com/v1beta/"
20
+ },
21
+ "Together AI": {
22
+ "name": "mistralai/Mixtral-8x7B-Instruct-v0.1",
23
+ "url": "https://api.together.xyz/v1/" # Replace with correct Together base URL
24
+ }
25
+ }
26
 
27
 
28
  import pandas as pd
 
112
  "content": f"Context:\n{context_text}\n\nQuestion: {message}\nAnswer:"
113
  }
114
  ]
115
+ config = model_name[model_choice]
116
+ openai=OpenAI(
117
+ base_url=config["url"],
118
+ api_key=api_key,
119
+ ), config["name"]
120
+
121
 
122
  response = openai.chat.completions.create(
123
  model="gemini-1.5-flash",