fix: cast BaseMessage content to str to resolve mypy union-attr errors and update agents rule
Browse files- AGENTS.md +1 -1
- pyproject.toml +1 -0
- src/graphBuilder/neo4j/finGraph.py +3 -3
AGENTS.md
CHANGED
|
@@ -80,7 +80,7 @@ def test_portfolio_showcase_aggregation_query():
|
|
| 80 |
```
|
| 81 |
|
| 82 |
## ์๋ ๊ฒ์ฌ
|
| 83 |
-
- ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์์ ์ปค๋ฐํ๊ธฐ ์ , ๋ฐ๋์ ํฐ๋ฏธ๋์ `ruff check .` ๋ฐ `
|
| 84 |
- ์ปค๋ฐ ์ `pre-commit` ์๋ ์คํ
|
| 85 |
- `ruff`, `mypy` ๊ฒ์ฌ ํต๊ณผ ํ์
|
| 86 |
- ๊ฒ์ฌ ์คํจ ์ ์ปค๋ฐ ๋ถ๊ฐ
|
|
|
|
| 80 |
```
|
| 81 |
|
| 82 |
## ์๋ ๊ฒ์ฌ
|
| 83 |
+
- ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์์ ์ปค๋ฐํ๊ธฐ ์ , ๋ฐ๋์ ํฐ๋ฏธ๋์ `ruff check .` ๋ฐ `mypy src tests --ignore-missing-imports` ๋ช
๋ น์ด๋ฅผ ์ง์ ์คํํ์ฌ ๋ฆฐํธ ๋ฐ ์๊ฒฉํ ํ์
์ค๋ฅ๋ฅผ ํ์คํ๊ฒ ํ์ธํ๊ณ ๋ชจ๋ ๊ณ ์น ๊ฒ (์ค๋ฅ๊ฐ ๋จ์์๋ ์ํ๋ก ์ปค๋ฐ ๊ธ์ง).
|
| 84 |
- ์ปค๋ฐ ์ `pre-commit` ์๋ ์คํ
|
| 85 |
- `ruff`, `mypy` ๊ฒ์ฌ ํต๊ณผ ํ์
|
| 86 |
- ๊ฒ์ฌ ์คํจ ์ ์ปค๋ฐ ๋ถ๊ฐ
|
pyproject.toml
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
[tool.ruff]
|
| 4 |
line-length = 120
|
| 5 |
target-version = "py310"
|
|
|
|
| 6 |
|
| 7 |
[tool.ruff.lint]
|
| 8 |
select = [
|
|
|
|
| 3 |
[tool.ruff]
|
| 4 |
line-length = 120
|
| 5 |
target-version = "py310"
|
| 6 |
+
preview = true
|
| 7 |
|
| 8 |
[tool.ruff.lint]
|
| 9 |
select = [
|
src/graphBuilder/neo4j/finGraph.py
CHANGED
|
@@ -61,7 +61,7 @@ def check_ai_relevance(state: ArticleState) -> ArticleState:
|
|
| 61 |
res = chat_llm.invoke(prompt)
|
| 62 |
return {
|
| 63 |
**state,
|
| 64 |
-
"is_ai_related": res.content.strip().lower().startswith("yes"),
|
| 65 |
}
|
| 66 |
|
| 67 |
|
|
@@ -80,7 +80,7 @@ def extract_entities(state: ArticleState) -> ArticleState:
|
|
| 80 |
JSON์ผ๋ก๋ง ์๋ต:{{"entities":[{{"name":"...","type":"AICompany|AITechnology|AIService|AIField","description":"..."}}]}}"""
|
| 81 |
res = chat_llm.invoke(prompt)
|
| 82 |
try:
|
| 83 |
-
raw = res.content.strip()
|
| 84 |
if "```" in raw:
|
| 85 |
raw = raw.split("```")[1].lstrip("json")
|
| 86 |
entities = json.loads(raw).get("entities", [])
|
|
@@ -102,7 +102,7 @@ def extract_relations(state: ArticleState) -> ArticleState:
|
|
| 102 |
)
|
| 103 |
res = chat_llm.invoke(prompt)
|
| 104 |
try:
|
| 105 |
-
raw = res.content.strip()
|
| 106 |
if "```" in raw:
|
| 107 |
raw = raw.split("```")[1].lstrip("json")
|
| 108 |
relations = json.loads(raw).get("relations", [])
|
|
|
|
| 61 |
res = chat_llm.invoke(prompt)
|
| 62 |
return {
|
| 63 |
**state,
|
| 64 |
+
"is_ai_related": str(res.content).strip().lower().startswith("yes"),
|
| 65 |
}
|
| 66 |
|
| 67 |
|
|
|
|
| 80 |
JSON์ผ๋ก๋ง ์๋ต:{{"entities":[{{"name":"...","type":"AICompany|AITechnology|AIService|AIField","description":"..."}}]}}"""
|
| 81 |
res = chat_llm.invoke(prompt)
|
| 82 |
try:
|
| 83 |
+
raw = str(res.content).strip()
|
| 84 |
if "```" in raw:
|
| 85 |
raw = raw.split("```")[1].lstrip("json")
|
| 86 |
entities = json.loads(raw).get("entities", [])
|
|
|
|
| 102 |
)
|
| 103 |
res = chat_llm.invoke(prompt)
|
| 104 |
try:
|
| 105 |
+
raw = str(res.content).strip()
|
| 106 |
if "```" in raw:
|
| 107 |
raw = raw.split("```")[1].lstrip("json")
|
| 108 |
relations = json.loads(raw).get("relations", [])
|