AnyLlmSearchXsoarEntries
Search war room entries for text results. Results are placed in the search results buffer where they can be added to the LLM's conversation context.
python · Anything LLM
Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 def FilterEntries(entry, maxsize: int) -> str: if entry["Metadata"]["category"] == "procedural": return "" if entry.get("Contents", "") == "Metrics reported successfully.": return "" if entry["Metadata"].get("contentsSize", 0) > maxsize: return "" return entry def main(): try: args = demisto.args() ids = args.get("ids", "").split(",") filters = {"tags": args.get("tags", ""), "categories": args.get("categories", "")} maxsize = int(args.get("maxcontentsize", "64")) text = "" for incid in ids: filters["id"] = incid results = execute_command("GetEntries", filters) results = results if isinstance(results, list) else [results] for entry in results: if FilterEntries(entry, maxsize) == "": continue text += f"{entry['Metadata']['category']} {entry['Metadata'].get('dbotCreatedBy', '')}" text += f" {entry['Metadata']['created']}" text += f" {entry.get('Contents', '')} {entry.get('HumanReadable', '')}" text += f" {entry['Metadata'].get('tags', '')} \n" execute_command("setIncident", {"customFields": {"anythingllmsearchresults": text}}) except Exception as ex: demisto.error(traceback.format_exc()) return_error(f"AnyLlmSearchXsoarEntries: error is - {ex}") if __name__ in ("__main__", "__builtin__", "builtins"): main()
README
Search war room entries for text results. Results are placed in the search results buffer where they can be added to the LLM’s conversation context
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
Inputs
| Argument Name | Description |
|---|---|
| ids | CSV list of incident IDs to fetch war room entries |
| tags | war room entry tags to include |
| categories | war room entry categories to include |
| maxcontensize | filter out large entries when the content size exceeds this value. This minimizes data added to the LLM’s conversation context where they may be a size limit depending on the LLM model being used |
Outputs
There are no outputs for this script.