resolver="llm" merges on a non-bool reply and raises AttributeError on a dict
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 77/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Inizia da src/selfgraph/resolution.py, in LLMResolver.resolve, e confronta la gestione della risposta con _checked_output, che, secondo quanto indicato dall’issue, accetta risposte dict. Esamina i test esistenti sul comportamento del resolver e sugli output LLM non validi, poi aggiungi test per un valore non booleano di same e per risposte dict o mancanti. Il lavoro è completato quando le risposte non valide generano ExtractionError con il codice invalid_llm_output e quelle valide continuano a essere risolte correttamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
LLMResolver reads answer.same from the client's reply and branches on its truthiness. Nothing validates the reply:
- A reply whose
sameis a non-empty string such as"no"or"false"merges the two entities. - A dict reply (
{"same": False}),None, or an object withoutsameraises a rawAttributeErrorout ofinsert.facts/insert.text, not aSelfGraphError.
The extraction path accepts dict replies (_checked_output validates them), so a client that returns dicts works for extraction and breaks resolution.
Reproduce
On main (5a277c9), embedded Kuzu. "Globex" and "Globex Systems" score 0.886, inside the default band, so the resolver asks the LLM.
import asyncio, tempfile
from types import SimpleNamespace
from selfgraph import KuzuStore, SelfGraph
class LLM:
def __init__(self, reply):
self.reply = reply
async def generate(self, *, system, user, output):
return self.reply if output.__name__ == "_SameEntity" else output()
async def run(reply):
with tempfile.TemporaryDirectory() as tmp:
async with SelfGraph(store=KuzuStore(f"{tmp}/g.kuzu"), llm=LLM(reply), resolver="llm") as g:
await g.insert.facts({"entities": [{"type": "Person", "name": "Globex"}]})
try:
r = await g.insert.facts({"entities": [{"type": "Person", "name": "Globex Systems"}]})
print(repr(reply), "merges:", [(m.absorbed_id, m.survivor_id) for m in r.merges])
except Exception as exc:
print(repr(reply), type(exc).__name__, exc)
for reply in [SimpleNamespace(same="no"), {"same": False}, None]:
asyncio.run(run(reply))
Output:
namespace(same='no') merges: [('person:globex-systems', 'person:globex')]
{'same': False} AttributeError 'dict' object has no attribute 'same'
None AttributeError 'NoneType' object has no attribute 'same'
Cause
src/selfgraph/resolution.py, LLMResolver.resolve: answer = await self._llm.generate(...) then if answer.same:. It should validate the reply as _SameEntity (strict bool, accepting a mapping or attributes as extraction does) and raise ExtractionError with code invalid_llm_output when it cannot.
- Lingua principale
- TypeScript
- Stelle
- 173
- Fork
- 58
- Merge medio
- 6h
- PR unite (30g)
- 120
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hydra-db/selfgraph
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
hydra-db/selfgraph#401 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: errors area: store bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
hydra-db/selfgraph#398 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: errors area: write bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
hydra-db/selfgraph#392 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: parity area: write bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
hydra-db/selfgraph#391 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di hydra-db/selfgraph
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
code-yeongyu/senpi#7139 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
lingdojo/kana-dojo#34395 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mastra-ai/mastra#31093 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:web p2 product:business triage:active type:bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
cuadrao-ai/argus#2328 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
nikhilb2/simple_invoicing#907 ·