Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -73,9 +73,9 @@ PDF pages:
|
|
73 |
{
|
74 |
"role": "user",
|
75 |
"content": (
|
76 |
-
[{"type": "
|
77 |
-
[{"type": "
|
78 |
-
"image_url":
|
79 |
for im in base64_images]
|
80 |
)
|
81 |
}
|
@@ -155,12 +155,11 @@ def index_from_url(url: str) -> tuple[str, str]:
|
|
155 |
# -----------------------------
|
156 |
def search(query: str, k: int):
|
157 |
"""
|
158 |
-
Search
|
159 |
-
generate an answer grounded ONLY in those pages.
|
160 |
|
161 |
MCP tool description:
|
162 |
-
- name:
|
163 |
-
- description:
|
164 |
- input_schema:
|
165 |
type: object
|
166 |
properties:
|
@@ -173,7 +172,7 @@ def search(query: str, k: int):
|
|
173 |
k (int): Number of top results to return (1–10).
|
174 |
|
175 |
Returns:
|
176 |
-
ai_response (str):
|
177 |
"""
|
178 |
global ds, images
|
179 |
|
|
|
73 |
{
|
74 |
"role": "user",
|
75 |
"content": (
|
76 |
+
[{"type": "input_text", "text": PROMPT.format(query=query)}] +
|
77 |
+
[{"type": "input_image",
|
78 |
+
"image_url": f"data:image/jpeg;base64,{im}"}
|
79 |
for im in base64_images]
|
80 |
)
|
81 |
}
|
|
|
155 |
# -----------------------------
|
156 |
def search(query: str, k: int):
|
157 |
"""
|
158 |
+
Search within a PDF document for the most relevant pages to answer a query and synthetizes a short grounded answer using only those pages.
|
|
|
159 |
|
160 |
MCP tool description:
|
161 |
+
- name: mcp_test_search
|
162 |
+
- description: Search within a PDF document for the most relevant pages to answer a query and synthetizes a short grounded answer using only those pages.
|
163 |
- input_schema:
|
164 |
type: object
|
165 |
properties:
|
|
|
172 |
k (int): Number of top results to return (1–10).
|
173 |
|
174 |
Returns:
|
175 |
+
ai_response (str): Text answer to the query grounded in content from the PDF, with citations (page numbers).
|
176 |
"""
|
177 |
global ds, images
|
178 |
|