resolver="llm" merges on a non-bool reply and raises AttributeError on a dict
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 77/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
src/selfgraph/resolution.py の LLMResolver.resolve から始め、issue によると dict 形式の応答を受け付ける _checked_output と、応答の処理を比較してください。resolver の動作と無効な LLM 出力に関する既存のテストを確認し、same が非 boolean 値の場合と、dict 形式または欠落した応答の場合のテストを追加してください。無効な応答でコード invalid_llm_output の ExtractionError が発生し、有効な応答は引き続き正しく解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 173
- フォーク
- 58
- 平均マージ
- 6時間
- マージ済み PR(30日)
- 120
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hydra-db/selfgraph のほかの issue
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
hydra-db/selfgraph#401 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: errors area: store bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
hydra-db/selfgraph#398 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: errors area: write bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
hydra-db/selfgraph#392 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: parity area: write bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hydra-db/selfgraph#391 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
hydra-db/selfgraph の issue をすべて見る
似ている issue
-
Bug Tests
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JSPrismarine/JSPrismarine#3384 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
zingolabs/zingo-mobile#1951 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Automattic/data-liberation-agent#2175 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
xdelmo/Portfolio-minimal#613 ·
メンテナーはふだん 1 日以内に返信
-
backend documentation low-priority Stellar Wave
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Savitura/Savitools#611 · コメント 1 件 ·
メンテナーはふだん 6 日以内に返信