dev-yuje commited on
Commit
78a2a73
ยท
1 Parent(s): 8c5b45c

fix: cast BaseMessage content to str to resolve mypy union-attr errors and update agents rule

Browse files
AGENTS.md CHANGED
@@ -80,7 +80,7 @@ def test_portfolio_showcase_aggregation_query():
80
  ```
81
 
82
  ## ์ž๋™ ๊ฒ€์‚ฌ
83
- - ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ปค๋ฐ‹ํ•˜๊ธฐ ์ „, ๋ฐ˜๋“œ์‹œ ํ„ฐ๋ฏธ๋„์— `ruff check .` ๋ฐ `pre-commit run mypy --all-files` (๋˜๋Š” `mypy .`) ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๋ฆฐํŠธ/ํƒ€์ž… ์˜ค๋ฅ˜๋ฅผ ํ™•์ธํ•˜๊ณ  ๋ชจ๋‘ ๊ณ ์น  ๊ฒƒ (์˜ค๋ฅ˜๊ฐ€ ๋‚จ์•„์žˆ๋Š” ์ƒํƒœ๋กœ ์ปค๋ฐ‹ ๊ธˆ์ง€).
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", [])