Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,30 +31,12 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
31 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
32 |
|
33 |
###
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
# To handle catch `NaT` values
|
41 |
-
for record in records:
|
42 |
-
for key, value in record.items():
|
43 |
-
# Check if the value is list-like; if so, process each element.
|
44 |
-
if isinstance(value, list):
|
45 |
-
processed_list = [None if pd.isnull(v) else v for v in value]
|
46 |
-
record[key] = processed_list
|
47 |
-
# For scalar values, continue as before.
|
48 |
-
else:
|
49 |
-
if pd.isnull(value):
|
50 |
-
record[key] = None
|
51 |
-
try:
|
52 |
-
# Convert each dictionary to a Movie instance
|
53 |
-
listings = [Listing(**record).dict() for record in records]
|
54 |
-
# Get an overview of a single datapoint
|
55 |
-
print(listings[0].keys())
|
56 |
-
except ValidationError as e:
|
57 |
-
print(e)
|
58 |
###
|
59 |
|
60 |
"""
|
|
|
31 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
32 |
|
33 |
###
|
34 |
+
query = """
|
35 |
+
I want to stay in a place that's warm and friendly,
|
36 |
+
and not too far from resturants, can you recommend a place?
|
37 |
+
Include a reason as to why you've chosen your selection.
|
38 |
+
"""
|
39 |
+
handle_user_query(query, db, collection)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
###
|
41 |
|
42 |
"""
|