You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"- You *must* use `get_action_info` on any action you want to run to understand the action and its arguments. After ur instrcuted to run the action immediately to try it.\n"
259
247
"- For update or patch actions, always present the proposed changes to the user and ask for explicit confirmation before proceeding.\n"
260
248
"- When turning off SSL verification in resource downloads (by setting `ssl_verify=False`), notify the user and request confirmation before proceeding.\n"
261
-
"- For general dataset searches and overviews, prioritize using action nameed `package_search`. Run the package_search action with an parameter q="", to fetch all datasets.\n"
262
-
"- For more detailed document searches, try `rag_search` first; if it indicates that the milvus client is not set up, switch to `package_search`.\n"
249
+
"- For general dataset searches and overviews, prioritize using action nameed `package_search`. Run the package_search action with an parameter q="
250
+
", to fetch all datasets.\n"
251
+
"- For more detailed document searches, try `literature_search` first; if it indicates that the milvus client is not set up, switch to `package_search`.\n"
263
252
"- Ensure you select the appropriate tool based on the user's request and the available capabilities.\n\n"
264
253
"Your Toolset:\n\n"
265
254
"1. **List CKAN Actions:**\n"
@@ -283,11 +272,11 @@ def init_dynamic_models():
283
272
"- **Purpose:** Retrieves file content from CKAN or external sources, with options for partial content retrieval using token parameters.\n"
284
273
"- **When to Use:** To fetch the contents of a file resource. If SSL verification is to be disabled (i.e., `ssl_verify=False`), notify the user and ask for confirmation before proceeding.\n\n"
from_attributes=True, # allows .model_dump to work with ORM-style objects
302
+
json_encoders={
303
+
UUID: str,
304
+
HttpUrl: str,
305
+
datetime: lambdadt: dt.isoformat(), # or str(dt)
306
+
},
307
+
)
308
+
309
+
310
+
classVectorMeta(MyBaseModel):
311
+
id: int
312
+
chunk_id: Optional[int] =None
313
+
chunks: Optional[HttpUrl] =None
314
+
dataset_id: Optional[str] =None
315
+
dataset_url: Optional[HttpUrl] =None
316
+
groups: Optional[list[str]] =None
317
+
private: Optional[str] =None
318
+
resource_id: Optional[str] =None
319
+
source: Optional[HttpUrl] =None
320
+
view_url: Optional[list[HttpUrl]] =None
321
+
322
+
323
+
classRagHit(BaseModel):
324
+
id: int
325
+
distance: Optional[float] =None
326
+
title: Optional[str] =None
327
+
summary: Optional[str] =None
328
+
entity: VectorMeta
329
+
330
+
331
+
classLitSearchResult(BaseModel):
332
+
search_str: Optional[list[str]] =None
333
+
results: Optional[list] =None
334
+
error: Optional[list[str]] =None
335
+
336
+
337
+
rag_prompt= (
338
+
"Role:\n\n"
339
+
"You are an assistant doing literature search be rephrasig questions and looking up a vector store to a CKAN software instance that must execute tool commands and assess their success or failure. Do not provide endless examples; instead focus on running tools and reasoning based on their outputs and execute steps in your chain of tought right away. Reduce Thinking output to a minimum.\n"
340
+
"Key Guidelines:\n\n"
341
+
"- when rephasing questions make sure to stay close to the context of the original input as much as possible. Search strings musst consist of 3 words minimum.\n"
342
+
"- use the `rag_search` tool find hits for chunks of literature by passing a list of search strings.\n"
343
+
"- beside the results also return the phrases you used for the search in the search_str field as list of strings.\n\n"
344
+
"- for all hits try to access the text and create a joint result object per distinct source. it should include the title of the source, a summary why its relevant and the rest of the vector metadata."
345
+
# "- to any hit you retrieve try to access the text and add the title of the document to a title field of the hit, by either retrieving it from the VectorMeta or the text and create markdown link in the form [title](url to document).\n\n"
346
+
# "- to any hit you retrieve add a summary of its relevants to the summary field of the hit in less then 500 string length. If the hit does not provide the desired context, discard the hit!\n\n"
347
+
"- make sure that u get at least 5 good results for the context that is in question by running the search again if no number of results is requested.\n\n"
348
+
"- any error occuring return to the error field as strings.\n\n"
List[RagHit]: List of RagHit instances as a reult of rag search. the object provided a distance attribute with the metrics of similarity and an entity attribute containing the meta data of the vector entity in store.
0 commit comments