ben on Nostr: I build something similar for a log/audit system unrelated to nostr. but you could ...
I build something similar for a log/audit system unrelated to nostr. but you could probably apply the same high level design here.
1. use an llm generate a query in the desired query language. my prompt included the query language grammar spec, about 20 common query examples, and a list of mistakes not to make, along with the natural language input
2. parse the query to assert it is valid. if so, send query to api (or relay here)
3. in my case I also wanted yo summarize the list of events in human language. so another llm request with another prompt along side the event response.
Published at
2025-03-23 14:30:01Event JSON
{
"id": "97c20f6eee95b8899e88957ff3ce8a1c0c00de63f82cfa3fce095a703161e3da",
"pubkey": "7bdef7bdebb8721f77927d0e77c66059360fa62371fdf15f3add93923a613229",
"created_at": 1742740201,
"kind": 1,
"tags": [
[
"e",
"9747e6f5c794f702632e4e8fd8d7697656b4ee64e697300f34b4d17466920194",
"wss://nostr.oxtr.dev",
"root"
],
[
"p",
"50d94fc2d8580c682b071a542f8b1e31a200b0508bab95a33bef0855df281d63",
"",
"mention"
]
],
"content": "I build something similar for a log/audit system unrelated to nostr. but you could probably apply the same high level design here. \n\n1. use an llm generate a query in the desired query language. my prompt included the query language grammar spec, about 20 common query examples, and a list of mistakes not to make, along with the natural language input\n2. parse the query to assert it is valid. if so, send query to api (or relay here)\n3. in my case I also wanted yo summarize the list of events in human language. so another llm request with another prompt along side the event response. ",
"sig": "42c8baec53b9a6967c9eaa9302525a884995fd2ee9f1dd92b10f76068154b051b8fb5710993c4bbf3f13329678d10313630a35053c428479f8cc412676a1f76e"
}