Skip to content

Commit db61e44

Browse files
authored
Merge pull request #1 from farhoud/llmcore
Llmcore
2 parents d5ddaa1 + 0957831 commit db61e44

26 files changed

Lines changed: 590 additions & 44 deletions

README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Rapid assessment and retrieval from knowledge graph using Neo4j GraphRAG.
44

55
## Overview
66

7-
Scouter is a knowledge graph-based document retrieval system that:
7+
Scouter is a knowledge graph-based document retrieval system focused on MCP (Model Context Protocol) for agentic search:
88

99
- Ingests PDFs and text documents using Neo4j GraphRAG's SimpleKGPipeline
10-
- Provides fast semantic search with relevance scoring
11-
- Supports both API and MCP (Model Context Protocol) interfaces
10+
- Provides agentic semantic search via MCP for LLM integration
11+
- Includes REST API for document ingestion
1212
- Includes evaluation framework for retrieval quality assessment
1313

1414
## Quick Start
@@ -62,31 +62,25 @@ curl -X POST "http://localhost:8000/v1/ingest" \
6262
-d '{"text": "Your document content", "metadata": {"source": "api"}}'
6363
```
6464

65-
### Search
66-
67-
```bash
68-
# Search documents
69-
curl "http://localhost:8000/v1/search?query=your%20search%20term&limit=5"
70-
```
71-
7265
### Interactive API
7366

7467
Visit <http://localhost:8000/docs> for interactive API documentation.
7568

69+
**Note:** Search functionality is provided via MCP (Model Context Protocol) for agentic retrieval. Direct REST search API is not available.
70+
7671
## Architecture
7772

7873
### Components
7974

8075
- **Ingestion Service**: Processes PDFs/text into knowledge graph using SimpleKGPipeline
81-
- **Search Service**: Performs semantic search with relevance scoring
82-
- **MCP Server**: Provides Model Context Protocol interface for LLM integration
76+
- **MCP Server**: Core component providing agentic search via Model Context Protocol for LLM integration
8377
- **Celery Workers**: Handle async document processing
8478
- **Redis**: Task queue and caching
8579

8680
### Data Flow
8781

8882
1. Documents → Ingestion API → Celery Queue → Neo4j GraphRAG
89-
2. Search Query → Search API → Neo4j → Ranked Results
83+
2. Search Query → MCP Server → Agentic Search → Neo4j → Ranked Results
9084

9185
## Development
9286

@@ -143,24 +137,26 @@ The project uses Neo4j with APOC plugin for enhanced graph procedures. Docker se
143137

144138
## Examples
145139

146-
### RAG Chatbot
140+
### MCP Integration (Primary Use Case)
147141

148142
```bash
149-
cd examples/chatbot
150-
python chatbot.py
143+
# Start MCP server
144+
python -m scouter_app.agent.mcp
145+
146+
# Use with Claude Desktop or other MCP-compatible tools
151147
```
152148

153-
Interactive chatbot that uses Scouter for retrieval and OpenRouter for generation.
149+
Scouter's MCP server enables agentic search for LLMs, providing semantic retrieval from the knowledge graph.
154150

155-
### MCP Integration
151+
### RAG Chatbot
156152

157153
```bash
158-
# Start MCP server
159-
python -m scouter_app.agent.mcp
160-
161-
# Use with Claude Desktop or other MCP-compatible tools
154+
cd examples/chatbot
155+
python chatbot.py
162156
```
163157

158+
Interactive chatbot that uses Scouter for retrieval and OpenRouter for generation.
159+
164160
## Project Structure
165161

166162
```

app_main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from fastapi import FastAPI
66

7-
from src.scouter_app.agent.mcp import app as mcp_app
8-
from src.scouter_app.config.llm import get_client_config
9-
from src.scouter_app.ingestion.api import router as ingestion_router
7+
from src.scouter.agent.mcp import app as mcp_app
8+
from src.scouter.config.llm import get_client_config
9+
from src.scouter.ingestion.api import router as ingestion_router
1010

1111
logger = logging.getLogger(__name__)
1212

evals/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import pytest
1212

13-
from scouter_app.ingestion.service import IngestionService
13+
from scouter.ingestion.service import IngestionService
1414

1515
from .utils import create_light_subset
1616

evals/test_retrieval_relevancy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from deepeval.test_case import LLMTestCase
44

55
from examples.chatbot.chatbot import chat_with_rag
6+
67
from .utils import OpenRouterLLM
78

89
THRESHOLD = 0.5

examples/chatbot/chatbot.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from mcp import ClientSession
77
from mcp.client.stdio import StdioServerParameters, stdio_client
88

9-
from scouter_app.config.llm import (
9+
from scouter.config.llm import (
1010
DEFAULT_MODEL,
1111
call_with_rate_limit,
1212
get_chatbot_client,
@@ -32,8 +32,6 @@ async def chat_with_rag(query: str) -> str:
3232

3333
mcp_tools = await session.list_tools()
3434

35-
print(mcp_tools)
36-
3735
# Convert MCP tools to OpenAI format
3836
openai_tools = [
3937
{
@@ -72,15 +70,15 @@ async def chat_with_rag(query: str) -> str:
7270
tool_args = json.loads(tool_call.function.arguments)
7371
result = await session.call_tool(tool_name, tool_args)
7472
# Add to messages
75-
messages.append( # type: ignore
76-
{"role": "assistant", "content": "", "tool_calls": [tool_call]} # type: ignore
73+
messages.append( # type: ignore[PGH003]
74+
{"role": "assistant", "content": "", "tool_calls": [tool_call]} # type: ignore[PGH003]
7775
)
78-
messages.append( # type: ignore
76+
messages.append( # type: ignore[PGH003]
7977
{
8078
"role": "tool",
8179
"content": str(result),
8280
"tool_call_id": tool_call.id,
83-
} # type: ignore
81+
} # type: ignore[PGH003]
8482
)
8583

8684
# Call LLM again with updated messages

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ asyncio_mode = "auto"
3838
[tool.ruff]
3939
extend = "ruff.toml"
4040

41+
[tool.hatch.build.targets.wheel]
42+
packages = ["src/scouter"]
43+
4144
[dependency-groups]
4245
dev = [
4346
"pre-commit>=4.5.0",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22

3-
from scouter_app.agent.tools import get_tools
4-
from scouter_app.config.llm import (
3+
from scouter.agent.tools import get_tools
4+
from scouter.config.llm import (
55
DEFAULT_MODEL,
66
call_with_rate_limit,
77
get_scouter_client,

0 commit comments

Comments
 (0)