manu commited on
Commit
f24b36e
·
verified ·
1 Parent(s): 4fd529e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -73,9 +73,9 @@ PDF pages:
73
  {
74
  "role": "user",
75
  "content": (
76
- [{"type": "text", "text": PROMPT.format(query=query)}] +
77
- [{"type": "image_url",
78
- "image_url": {"url": f"data:image/jpeg;base64,{im}"}}
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 the current database of PDF document pages for the most relevant content and
159
- generate an answer grounded ONLY in those pages.
160
 
161
  MCP tool description:
162
- - name: search
163
- - description: Retrieve top-k PDF pages relevant to a query and answer using only those pages.
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): Answer grounded only in retrieved pages, with citations (page numbers).
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