update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from sentence_transformers import SentenceTransformer
|
|
| 3 |
from wikipediaapi import Wikipedia
|
| 4 |
import textwrap
|
| 5 |
import numpy as np
|
| 6 |
-
import
|
| 7 |
|
| 8 |
# Function to process the input and generate the output
|
| 9 |
def process_query(wiki_page, model_name, embed_dim, query, api_key):
|
|
@@ -43,8 +43,8 @@ def process_query(wiki_page, model_name, embed_dim, query, api_key):
|
|
| 43 |
QUESTION: {query}
|
| 44 |
"""
|
| 45 |
|
| 46 |
-
client =
|
| 47 |
-
response = client.
|
| 48 |
model="gpt-4o",
|
| 49 |
messages=[
|
| 50 |
{"role": "user", "content": prompt},
|
|
|
|
| 3 |
from wikipediaapi import Wikipedia
|
| 4 |
import textwrap
|
| 5 |
import numpy as np
|
| 6 |
+
from openai import OpenAI
|
| 7 |
|
| 8 |
# Function to process the input and generate the output
|
| 9 |
def process_query(wiki_page, model_name, embed_dim, query, api_key):
|
|
|
|
| 43 |
QUESTION: {query}
|
| 44 |
"""
|
| 45 |
|
| 46 |
+
client = OpenAI(api_key=api_key)
|
| 47 |
+
response = client.chat.completions.create(
|
| 48 |
model="gpt-4o",
|
| 49 |
messages=[
|
| 50 |
{"role": "user", "content": prompt},
|