Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ apis = [
|
|
12 |
]
|
13 |
|
14 |
|
15 |
-
def make_call():
|
16 |
|
17 |
data = None
|
18 |
while True:
|
@@ -20,8 +20,8 @@ def make_call():
|
|
20 |
client = Groq(
|
21 |
api_key=api,
|
22 |
) # Configure the model with the API key
|
23 |
-
query = st.text_input("Enter your query")
|
24 |
-
prmptquery= f"Act as bhagwan Krishna and answer this query in context to bhagwat geeta, you may also provide reference to shloks from chapters of bhagwat geeta which is relevant to the query. Query= {
|
25 |
try:
|
26 |
response = client.chat.completions.create(
|
27 |
messages=[
|
@@ -32,14 +32,14 @@ def make_call():
|
|
32 |
],
|
33 |
model="mixtral-8x7b-32768",
|
34 |
)
|
35 |
-
|
36 |
except Exception as e:
|
37 |
print(f"API call failed for: {e}")
|
38 |
-
if
|
39 |
break
|
40 |
-
if
|
41 |
break
|
42 |
-
return
|
43 |
|
44 |
|
45 |
|
|
|
12 |
]
|
13 |
|
14 |
|
15 |
+
def make_call(data):
|
16 |
|
17 |
data = None
|
18 |
while True:
|
|
|
20 |
client = Groq(
|
21 |
api_key=api,
|
22 |
) # Configure the model with the API key
|
23 |
+
# query = st.text_input("Enter your query")
|
24 |
+
prmptquery= f"Act as bhagwan Krishna and answer this query in context to bhagwat geeta, you may also provide reference to shloks from chapters of bhagwat geeta which is relevant to the query. Query= {data}"
|
25 |
try:
|
26 |
response = client.chat.completions.create(
|
27 |
messages=[
|
|
|
32 |
],
|
33 |
model="mixtral-8x7b-32768",
|
34 |
)
|
35 |
+
answer = response.choices[0].message.content
|
36 |
except Exception as e:
|
37 |
print(f"API call failed for: {e}")
|
38 |
+
if answer:
|
39 |
break
|
40 |
+
if answer:
|
41 |
break
|
42 |
+
return answer
|
43 |
|
44 |
|
45 |
|