Tags: hungrymonkey/go-light-rag
Tags
kuzu
kuzu based on neo
Fix compile error
go build main.go
./main.go:190:56: cannot use store (variable of struct type storageWrapper) as golightrag.Storage value in argument to processDocumentDirectory: storageWrapper does not implement golightrag.Storage (method GraphEntities has pointer receiver)
./main.go:196:35: cannot use st
Fixed compile error
Keep the coding style the same
Remove pointer reciever
SIGSEGV: segmentation violation
PC=0x106ef5894 m=8 sigcode=2 addr=0x0
signal arrived during cgo execution
goroutine 156 gp=0x14000524fc0 m=8 mp=0x14000496008 [syscall]:
runtime.cgocall(0x102d926dc, 0x140014cd488)
/opt/homebrew/Cellar/go/1.24.0/libexec/src/runtime/cgocall.go:167 +0x44 fp=0x140014cd450 sp=0x140014cd410 pc=0x1024894c4
github.com/kuzudb/go-kuzu._Cfunc_kuzu_connection_prepare(0x140003eeae0, 0x600000acf570, 0x140004a20e0)
_cgo_gotypes.go:442 +0x34 fp=0x140014cd480 sp=0x140014cd450 pc=0x102818bd4
github.com/kuzudb/go-kuzu.(*Connection).Prepare.func3(...)
/Users/ted/go/pkg/mod/github.com/kuzudb/go-kuzu@v0.11.0/connection.go:140
github.com/kuzudb/go-kuzu.(*Connection).Prepare(0x140003eeae0, {0x102f42d80?, 0x102e49ed0?})
/Users/ted/go/pkg/mod/github.com/kuzudb/go-kuzu@v0.11.0/connection.go:140 +0x124 fp=0x140014cd520 sp=0x140014cd480 pc=0x10281ce74
github.com/MegaGrindStone/go-light-rag/storage.Kuzu.GraphEntity({0x1400059c730?, 0x140003eeae0?}, {0x140001c2408, 0x13})
/Users/ted/go/pkg/mod/github.com/hungrymonkey/go-light-rag@v0.0.0-20250719235027-95fd0b072974/storage/kuzu.go:136 +0x120 fp=0x140014cd7a0 sp=0x140014cd520 pc=0x102d3b3b0
main.(*storageWrapper).GraphEntity(0x0?, {0x140001c2408?, 0x0?})
<autogenerated>:1 +0x60 fp=0x140014cd880 sp=0x140014cd7a0 pc=0x102d43830
github.com/MegaGrindStone/go-light-rag.mergeGraphEntities({0x140001c2408, 0x13}, {0x1400041f0c0, 0x3e}, {0x102e1a26b, 0x7}, {0x14000118480, 0x1, 0x4?}, 0x4b0, ...)
/Users/ted/go/pkg/mod/github.com/hungrymonkey/go-light-rag@v0.0.0-20250719235027-95fd0b072974/insert.go:381 +0x6c fp=0x140014cdc80 sp=0x140014cd880 pc=0x1025d37cc
github.com/MegaGrindStone/go-light-rag.extractEntities.func2()
/Users/ted/go/pkg/mod/github.com/hungrymonkey/go-light-rag@v0.0.0-20250719235027-95fd0b072974/insert.go:152 +0x3c4 fp=0x140014cdf60 sp=0x140014cdc80 pc=0x1025d1b54
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/ted/go/pkg/mod/golang.org/x/sync@v0.16.0/errgroup/errgroup.go:93 +0x54 fp=0x140014cdfd0 sp=0x140014cdf60 pc=0x1025d0cd4
runtime.goexit({})
/opt/homebrew/Cellar/go/1.24.0/libexec/src/runtime/asm_arm64.s:1223 +0x4 fp=0x140014cdfd0 sp=0x140014cdfd0 pc=0x102494984
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 151
/Users/ted/go/pkg/mod/golang.org/x/sync@v0.16.0/errgroup/errgroup.go:78 +0x94
/opt/homebrew/Cellar/go/1.24.0/libexec/src/net/http/transport.go:1945 +0x120c
r0 0x0
r1 0x60000348df20
r2 0x2e
r3 0x197111930
r4 0xc10
r5 0x14001e26000
r6 0x1
r7 0x0
r8 0x173ef2e98
r9 0x14001e29478
r10 0x98
r11 0x99
r12 0xfc
r13 0x173ef2f00
r14 0x1ff800
r15 0x7fb
r16 0x1971119e0
r17 0x14001e29410
r18 0x0
r19 0x2e
r20 0x60000348df20
r21 0x600003a95ee0
r22 0x173ef2e98
r23 0x0
r24 0x0
r25 0x1400005dcb8
r26 0x0
r27 0x828
r28 0x14000103500
r29 0x173ef2e20
lr 0x1073e4620
sp 0x173ef2de0
pc 0x1070b1894
fault 0x0
Workaround hack to resolve this issue
\{
"high_level_keywords": ["pregnancy", "pregnancy-related"],
"low_level_keywords": ["pregnancy cycle", "pregnancy symptoms", "pregnancy birth"]
\}
Error querying: failed to unmarshal keyword extraction output: invalid character '\\' after object key:value pair
Fixes this issue ted@Teds-MacBook-Pro llm % git add -u ted@Teds-MacBook-Pro llm % git commit [main cba5c8a] lightrag % ./main time=2025-07-16T15:25:00.885-04:00 level=INFO msg="Found files" count=0 Select handler (type the number): 1. Default Handler - General purpose queries 2. Go Handler - Go programming language specific queries (type 'exit' to exit) 1 Using Default Handler time=2025-07-16T15:25:01.854-04:00 level=INFO msg="Selected handler" type=handler.Default Insert query: (type 'exit' to exit) why is the sky blue? time=2025-07-16T15:25:05.118-04:00 level=INFO msg="User query" query="why is the sky blue?" time=2025-07-16T15:25:05.120-04:00 level=INFO msg="Extracted query" package=golightrag function=Query query="why is the sky blue?" histories=[] time=2025-07-16T15:25:05.120-04:00 level=DEBUG msg="Use LLM to extract keywords from query" package=golightrag function=Query keywordPrompt="---Role---\n\nYou are a helpful assistant tasked with identifying both high-level and low-level keywords in the user's query and conversation history.\n\n---Goal---\n\n\nGiven the query and conversation history, list both high-level and low-level keywords. High-level keywords focus on overarching concepts or themes, while low-level keywords focus on specific entities, details, or concrete terms.\n\n---Instructions---\n\n- Consider both the current query and relevant conversation history when extracting keywords\n- Output the keywords in JSON format, it will be parsed by a JSON parser, do not add any extra content in output\n- The JSON should have two keys:\n - \"high_level_keywords\" for overarching concepts or themes\n - \"low_level_keywords\" for specific entities or details\n\n######################\n---Examples---\n######################\nExample 1:\n\nQuery: How does international trade influence global economic stability?\n################\nOutput:\n\\{\n \"high_level_keywords\": [\"International trade\", \"Global economic stability\", \"Economic impact\"],\n \"low_level_keywords\": [\"Trade agreements\", \"Tariffs\", \"Currency exchange\", \"Imports\", \"Exports\"]\n\\}\n#############################\nExample 2:\n\nQuery: What are the environmental consequences of deforestation on biodiversity?\n################\nOutput:\n\\{\n \"high_level_keywords\": [\"Environmental consequences\", \"Deforestation\", \"Biodiversity loss\"],\n \"low_level_keywords\": [\"Species extinction\", \"Habitat destruction\", \"Carbon emissions\", \"Rainforest\", \"Ecosystem\"]\n\\}\n#############################\nExample 3:\n\nQuery: What is the role of education in reducing poverty?\n################\nOutput:\n\\{\n \"high_level_keywords\": [\"Education\", \"Poverty reduction\", \"Socioeconomic development\"],\n \"low_level_keywords\": [\"School access\", \"Literacy rates\", \"Job training\", \"Income inequality\"]\n\\}\n#############################\n-Real Data-\n######################\nConversation History:\n\n\nCurrent Query: why is the sky blue?\n######################\nThe \"Output\" should be human text, not unicode characters. Keep the same language as \"Query\".\nOutput:\n\n" time=2025-07-16T15:25:18.431-04:00 level=DEBUG msg="Extracted keywords from LLM" package=golightrag function=Query keywords="" Error querying: failed to unmarshal keyword extraction output: unexpected end of JSON input time=2025-07-17T08:05:35.827-04:00 level=INFO msg="Query keywords" package=golightrag function=Query highLevelKeywords="[Sky color Atmospheric scattering]" lowLevelKeywords="[Light Blue color Rayleigh scattering]" Error querying: failed to get local context: failed to query entities: failed to query entities: couldn't create embedding of query: error response from the embedding API: 404 Not Found