Skip to content

fix: harden LLM and Cypher execution#40

Open
pntech20 wants to merge 1 commit into
Solvro:mainfrom
pntech20:codex/llm-cypher-hardening
Open

fix: harden LLM and Cypher execution#40
pntech20 wants to merge 1 commit into
Solvro:mainfrom
pntech20:codex/llm-cypher-hardening

Conversation

@pntech20

Copy link
Copy Markdown

Summary

  • add read-only Cypher validation before generated queries reach Neo4j
  • apply a configurable LLM timeout to OpenAI/CLARIN/Gemini clients and wrap async LLM calls with asyncio.wait_for
  • retry guardrail and Cypher generation chains with exponential backoff
  • document LLM_TIMEOUT_SECONDS and add focused guardrail tests

Verification

  • uv lock
  • uv run ruff format src\llm_hardening.py src\mcp_client\client.py src\mcp_server\server.py src\mcp_server\tools\knowledge_graph\rag.py src\topwr_api\server.py tests\test_cypher_guardrails.py
  • uv run ruff check src\llm_hardening.py src\mcp_client\client.py src\mcp_server\server.py src\mcp_server\tools\knowledge_graph\rag.py src\topwr_api\server.py tests\test_cypher_guardrails.py
  • uv run --with pytest python -m pytest tests\test_cypher_guardrails.py -q
  • git diff --check

Fixes #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LLM & Cypher Hardening

1 participant