Ask HN: LLM agents for structured data from databases?

2 points by john-titor a month ago

Hi HN,

I am a complete LLM beginner but would like to get into the practical application of the technology by interfacing a GPT instance with an internal database at work.

I understand creating LLM agents that handle unstructured data is a quite common use-case. Ironically, more experienced peers also told me that going through the same exercise to make agents work with structured data can be more challenging.

Are there any resources that you could point me to wrt best practices and tools to use when tackling such a project? In my mind, I would 'magically feed' the DB schema to the LLM, have it write valid SQL prompts and translate the results into text. Does this make sense? Are there better ways to do this?

gkorland a month ago

We've done a very similar procedure just with FalkorDB as a Graph Database. Notice if you already have a schema/ontology it might be easier might you might miss some entities in the text you did realize exist.

So in our in GraphRAG-SDK we are running two phases, the first is sampling the data to suggest a schema and the second is using this schema to ground the LLM to this schema (as you suggested)

Check https://github.com/FalkorDB/GraphRAG-SDK

bosch_mind a month ago

I’ve been experimenting with this on the side for fun.

Langchain is not my favorite, so I just wrote my own abstractions.

I hosted a neo4j graph database and extracted entities from the input data. You can do this with spaCy or LLM. I then generated nodes and edges between these entities, the chunked text and the embeddings for semantic search.

This combines the power of search with higher relevance due to crawling the graph with more intention

meiraleal a month ago

Langchain. You use it, find how bad it is to use a framework and do it yourself. There isnt much mystery