Remove all references to SearchType.INSIGHTS across the codebase, meaningfully replacing it with SearchType.GRAPH_COMPLETION where applicable.
This commit is contained in:
parent
63a1463073
commit
97f90c95ed
12 changed files with 3 additions and 53 deletions
|
|
@ -89,15 +89,6 @@ export default function useChat(dataset: Dataset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface Node {
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Relationship {
|
|
||||||
relationship_name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type InsightMessage = [Node, Relationship, Node];
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function convertToSearchTypeOutput(systemMessage: any[] | any, searchType: string): string {
|
function convertToSearchTypeOutput(systemMessage: any[] | any, searchType: string): string {
|
||||||
|
|
@ -106,14 +97,6 @@ function convertToSearchTypeOutput(systemMessage: any[] | any, searchType: strin
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (searchType) {
|
switch (searchType) {
|
||||||
case "INSIGHTS":
|
|
||||||
return systemMessage.map((message: InsightMessage) => {
|
|
||||||
const [node1, relationship, node2] = message;
|
|
||||||
if (node1.name && node2.name) {
|
|
||||||
return `${node1.name} ${relationship.relationship_name} ${node2.name}.`;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}).join("\n");
|
|
||||||
case "SUMMARIES":
|
case "SUMMARIES":
|
||||||
return systemMessage.map((message: { text: string }) => message.text).join("\n");
|
return systemMessage.map((message: { text: string }) => message.text).join("\n");
|
||||||
case "CHUNKS":
|
case "CHUNKS":
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ The MCP server exposes its functionality through tools. Call them from any MCP c
|
||||||
|
|
||||||
- **codify**: Analyse a code repository, build a code graph, stores it in memory
|
- **codify**: Analyse a code repository, build a code graph, stores it in memory
|
||||||
|
|
||||||
- **search**: Query memory – supports GRAPH_COMPLETION, RAG_COMPLETION, CODE, CHUNKS, INSIGHTS
|
- **search**: Query memory – supports GRAPH_COMPLETION, RAG_COMPLETION, CODE, CHUNKS
|
||||||
|
|
||||||
- **list_data**: List all datasets and their data items with IDs for deletion operations
|
- **list_data**: List all datasets and their data items with IDs for deletion operations
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -478,11 +478,6 @@ async def search(search_query: str, search_type: str) -> list:
|
||||||
Best for: Direct document retrieval, specific fact-finding.
|
Best for: Direct document retrieval, specific fact-finding.
|
||||||
Returns: LLM responses based on relevant text chunks.
|
Returns: LLM responses based on relevant text chunks.
|
||||||
|
|
||||||
**INSIGHTS**:
|
|
||||||
Structured entity relationships and semantic connections.
|
|
||||||
Best for: Understanding concept relationships, knowledge mapping.
|
|
||||||
Returns: Formatted relationship data and entity connections.
|
|
||||||
|
|
||||||
**CHUNKS**:
|
**CHUNKS**:
|
||||||
Raw text segments that match the query semantically.
|
Raw text segments that match the query semantically.
|
||||||
Best for: Finding specific passages, citations, exact content.
|
Best for: Finding specific passages, citations, exact content.
|
||||||
|
|
@ -524,7 +519,6 @@ async def search(search_query: str, search_type: str) -> list:
|
||||||
- "RAG_COMPLETION": Returns an LLM response based on the search query and standard RAG data
|
- "RAG_COMPLETION": Returns an LLM response based on the search query and standard RAG data
|
||||||
- "CODE": Returns code-related knowledge in JSON format
|
- "CODE": Returns code-related knowledge in JSON format
|
||||||
- "CHUNKS": Returns raw text chunks from the knowledge graph
|
- "CHUNKS": Returns raw text chunks from the knowledge graph
|
||||||
- "INSIGHTS": Returns relationships between nodes in readable format
|
|
||||||
- "SUMMARIES": Returns pre-generated hierarchical summaries
|
- "SUMMARIES": Returns pre-generated hierarchical summaries
|
||||||
- "CYPHER": Direct graph database queries
|
- "CYPHER": Direct graph database queries
|
||||||
- "FEELING_LUCKY": Automatically selects best search type
|
- "FEELING_LUCKY": Automatically selects best search type
|
||||||
|
|
@ -537,7 +531,6 @@ async def search(search_query: str, search_type: str) -> list:
|
||||||
A list containing a single TextContent object with the search results.
|
A list containing a single TextContent object with the search results.
|
||||||
The format of the result depends on the search_type:
|
The format of the result depends on the search_type:
|
||||||
- **GRAPH_COMPLETION/RAG_COMPLETION**: Conversational AI response strings
|
- **GRAPH_COMPLETION/RAG_COMPLETION**: Conversational AI response strings
|
||||||
- **INSIGHTS**: Formatted relationship descriptions and entity connections
|
|
||||||
- **CHUNKS**: Relevant text passages with source metadata
|
- **CHUNKS**: Relevant text passages with source metadata
|
||||||
- **SUMMARIES**: Hierarchical summaries from general to specific
|
- **SUMMARIES**: Hierarchical summaries from general to specific
|
||||||
- **CODE**: Structured code information with context
|
- **CODE**: Structured code information with context
|
||||||
|
|
@ -547,7 +540,6 @@ async def search(search_query: str, search_type: str) -> list:
|
||||||
Performance & Optimization:
|
Performance & Optimization:
|
||||||
- **GRAPH_COMPLETION**: Slower but most intelligent, uses LLM + graph context
|
- **GRAPH_COMPLETION**: Slower but most intelligent, uses LLM + graph context
|
||||||
- **RAG_COMPLETION**: Medium speed, uses LLM + document chunks (no graph traversal)
|
- **RAG_COMPLETION**: Medium speed, uses LLM + document chunks (no graph traversal)
|
||||||
- **INSIGHTS**: Fast, returns structured relationships without LLM processing
|
|
||||||
- **CHUNKS**: Fastest, pure vector similarity search without LLM
|
- **CHUNKS**: Fastest, pure vector similarity search without LLM
|
||||||
- **SUMMARIES**: Fast, returns pre-computed summaries
|
- **SUMMARIES**: Fast, returns pre-computed summaries
|
||||||
- **CODE**: Medium speed, specialized for code understanding
|
- **CODE**: Medium speed, specialized for code understanding
|
||||||
|
|
@ -586,9 +578,6 @@ async def search(search_query: str, search_type: str) -> list:
|
||||||
return str(search_results[0])
|
return str(search_results[0])
|
||||||
elif search_type.upper() == "CHUNKS":
|
elif search_type.upper() == "CHUNKS":
|
||||||
return str(search_results)
|
return str(search_results)
|
||||||
elif search_type.upper() == "INSIGHTS":
|
|
||||||
results = retrieved_edges_to_string(search_results)
|
|
||||||
return results
|
|
||||||
else:
|
else:
|
||||||
return str(search_results)
|
return str(search_results)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ DEFAULT_TOOLS = [
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Type of search to perform",
|
"description": "Type of search to perform",
|
||||||
"enum": [
|
"enum": [
|
||||||
"INSIGHTS",
|
|
||||||
"CODE",
|
"CODE",
|
||||||
"GRAPH_COMPLETION",
|
"GRAPH_COMPLETION",
|
||||||
"NATURAL_LANGUAGE",
|
"NATURAL_LANGUAGE",
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ async def handle_search(arguments: Dict[str, Any], user) -> list:
|
||||||
valid_search_types = (
|
valid_search_types = (
|
||||||
search_tool["parameters"]["properties"]["search_type"]["enum"]
|
search_tool["parameters"]["properties"]["search_type"]["enum"]
|
||||||
if search_tool
|
if search_tool
|
||||||
else ["INSIGHTS", "CODE", "GRAPH_COMPLETION", "NATURAL_LANGUAGE"]
|
else ["CODE", "GRAPH_COMPLETION", "NATURAL_LANGUAGE"]
|
||||||
)
|
)
|
||||||
|
|
||||||
if search_type_str not in valid_search_types:
|
if search_type_str not in valid_search_types:
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ DEFAULT_TOOLS = [
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Type of search to perform",
|
"description": "Type of search to perform",
|
||||||
"enum": [
|
"enum": [
|
||||||
"INSIGHTS",
|
|
||||||
"CODE",
|
"CODE",
|
||||||
"GRAPH_COMPLETION",
|
"GRAPH_COMPLETION",
|
||||||
"NATURAL_LANGUAGE",
|
"NATURAL_LANGUAGE",
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,6 @@ async def search(
|
||||||
Best for: Direct document retrieval, specific fact-finding.
|
Best for: Direct document retrieval, specific fact-finding.
|
||||||
Returns: LLM responses based on relevant text chunks.
|
Returns: LLM responses based on relevant text chunks.
|
||||||
|
|
||||||
**INSIGHTS**:
|
|
||||||
Structured entity relationships and semantic connections.
|
|
||||||
Best for: Understanding concept relationships, knowledge mapping.
|
|
||||||
Returns: Formatted relationship data and entity connections.
|
|
||||||
|
|
||||||
**CHUNKS**:
|
**CHUNKS**:
|
||||||
Raw text segments that match the query semantically.
|
Raw text segments that match the query semantically.
|
||||||
Best for: Finding specific passages, citations, exact content.
|
Best for: Finding specific passages, citations, exact content.
|
||||||
|
|
@ -124,9 +119,6 @@ async def search(
|
||||||
**GRAPH_COMPLETION/RAG_COMPLETION**:
|
**GRAPH_COMPLETION/RAG_COMPLETION**:
|
||||||
[List of conversational AI response strings]
|
[List of conversational AI response strings]
|
||||||
|
|
||||||
**INSIGHTS**:
|
|
||||||
[List of formatted relationship descriptions and entity connections]
|
|
||||||
|
|
||||||
**CHUNKS**:
|
**CHUNKS**:
|
||||||
[List of relevant text passages with source metadata]
|
[List of relevant text passages with source metadata]
|
||||||
|
|
||||||
|
|
@ -146,7 +138,6 @@ async def search(
|
||||||
Performance & Optimization:
|
Performance & Optimization:
|
||||||
- **GRAPH_COMPLETION**: Slower but most intelligent, uses LLM + graph context
|
- **GRAPH_COMPLETION**: Slower but most intelligent, uses LLM + graph context
|
||||||
- **RAG_COMPLETION**: Medium speed, uses LLM + document chunks (no graph traversal)
|
- **RAG_COMPLETION**: Medium speed, uses LLM + document chunks (no graph traversal)
|
||||||
- **INSIGHTS**: Fast, returns structured relationships without LLM processing
|
|
||||||
- **CHUNKS**: Fastest, pure vector similarity search without LLM
|
- **CHUNKS**: Fastest, pure vector similarity search without LLM
|
||||||
- **SUMMARIES**: Fast, returns pre-computed summaries
|
- **SUMMARIES**: Fast, returns pre-computed summaries
|
||||||
- **CODE**: Medium speed, specialized for code understanding
|
- **CODE**: Medium speed, specialized for code understanding
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,6 @@ Search Types & Use Cases:
|
||||||
Traditional RAG using document chunks without graph structure.
|
Traditional RAG using document chunks without graph structure.
|
||||||
Best for: Direct document retrieval, specific fact-finding.
|
Best for: Direct document retrieval, specific fact-finding.
|
||||||
|
|
||||||
**INSIGHTS**:
|
|
||||||
Structured entity relationships and semantic connections.
|
|
||||||
Best for: Understanding concept relationships, knowledge mapping.
|
|
||||||
|
|
||||||
**CHUNKS**:
|
**CHUNKS**:
|
||||||
Raw text segments that match the query semantically.
|
Raw text segments that match the query semantically.
|
||||||
Best for: Finding specific passages, citations, exact content.
|
Best for: Finding specific passages, citations, exact content.
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ COMMAND_DESCRIPTIONS = {
|
||||||
SEARCH_TYPE_CHOICES = [
|
SEARCH_TYPE_CHOICES = [
|
||||||
"GRAPH_COMPLETION",
|
"GRAPH_COMPLETION",
|
||||||
"RAG_COMPLETION",
|
"RAG_COMPLETION",
|
||||||
"INSIGHTS",
|
|
||||||
"CHUNKS",
|
"CHUNKS",
|
||||||
"SUMMARIES",
|
"SUMMARIES",
|
||||||
"CODE",
|
"CODE",
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ Here are the available `SearchType` tools and their specific functions:
|
||||||
- Summarizing large amounts of information
|
- Summarizing large amounts of information
|
||||||
- Quick understanding of complex subjects
|
- Quick understanding of complex subjects
|
||||||
|
|
||||||
* **`INSIGHTS`**: The `INSIGHTS` search type discovers connections and relationships between entities in the knowledge graph.
|
|
||||||
|
|
||||||
**Best for:**
|
**Best for:**
|
||||||
|
|
||||||
- Discovering how entities are connected
|
- Discovering how entities are connected
|
||||||
|
|
@ -95,9 +93,6 @@ Here are the available `SearchType` tools and their specific functions:
|
||||||
Query: "Summarize the key findings from these research papers"
|
Query: "Summarize the key findings from these research papers"
|
||||||
Response: `SUMMARIES`
|
Response: `SUMMARIES`
|
||||||
|
|
||||||
Query: "What is the relationship between the methodologies used in these papers?"
|
|
||||||
Response: `INSIGHTS`
|
|
||||||
|
|
||||||
Query: "When was Einstein born?"
|
Query: "When was Einstein born?"
|
||||||
Response: `CHUNKS`
|
Response: `CHUNKS`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ async def code_description_to_code_part(
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if include_docs:
|
if include_docs:
|
||||||
search_results = await search(query_text=query, query_type="INSIGHTS")
|
search_results = await search(query_text=query, query_type="GRAPH_COMPLETION")
|
||||||
|
|
||||||
concatenated_descriptions = " ".join(
|
concatenated_descriptions = " ".join(
|
||||||
obj["description"]
|
obj["description"]
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ class TestCliConfig:
|
||||||
expected_types = [
|
expected_types = [
|
||||||
"GRAPH_COMPLETION",
|
"GRAPH_COMPLETION",
|
||||||
"RAG_COMPLETION",
|
"RAG_COMPLETION",
|
||||||
"INSIGHTS",
|
|
||||||
"CHUNKS",
|
"CHUNKS",
|
||||||
"SUMMARIES",
|
"SUMMARIES",
|
||||||
"CODE",
|
"CODE",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue