Spaces:
Sleeping
Sleeping
Commit
·
94b6bc9
1
Parent(s):
fff9411
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def search(query, similarity=False):
|
|
12 |
|
13 |
# Set the API endpoint and query parameters
|
14 |
url = "https://www.googleapis.com/books/v1/volumes"
|
15 |
-
params = {"q": str(query), "printType": "books", "maxResults":
|
16 |
|
17 |
# Send a GET request to the API with the specified parameters
|
18 |
response = requests.get(url, params=params)
|
@@ -64,7 +64,7 @@ def search(query, similarity=False):
|
|
64 |
pyalex.config.email = "[email protected]"
|
65 |
|
66 |
# Define a pager object with the same query
|
67 |
-
pager = Works().search(str(query)).paginate(per_page=
|
68 |
|
69 |
# Generate a list of the results
|
70 |
openalex_results = list(pager)
|
@@ -111,7 +111,7 @@ def search(query, similarity=False):
|
|
111 |
},
|
112 |
{
|
113 |
"role": "user",
|
114 |
-
"content": f"Recommend me
|
115 |
},
|
116 |
],
|
117 |
)
|
|
|
12 |
|
13 |
# Set the API endpoint and query parameters
|
14 |
url = "https://www.googleapis.com/books/v1/volumes"
|
15 |
+
params = {"q": str(query), "printType": "books", "maxResults": 1}
|
16 |
|
17 |
# Send a GET request to the API with the specified parameters
|
18 |
response = requests.get(url, params=params)
|
|
|
64 |
pyalex.config.email = "[email protected]"
|
65 |
|
66 |
# Define a pager object with the same query
|
67 |
+
pager = Works().search(str(query)).paginate(per_page=1, n_max=1)
|
68 |
|
69 |
# Generate a list of the results
|
70 |
openalex_results = list(pager)
|
|
|
111 |
},
|
112 |
{
|
113 |
"role": "user",
|
114 |
+
"content": f"Recommend me 1 books about {query}. Your response should be like: 'title: <title>, author: <author>, publisher: <publisher>, summary: <summary>'",
|
115 |
},
|
116 |
],
|
117 |
)
|