Skip to content

Commit

Permalink
Merge pull request #279 from tigergraph/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
parkererickson-tg authored Dec 19, 2024
2 parents d80acfa + acc4a1b commit 09f1525
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ python-dotenv==1.0.1
python-iso639==2024.4.27
python-magic==0.4.27
pyTigerDriver==1.0.15
pyTigerGraph==1.6.5
pyTigerGraph==1.8.3
pytz==2024.1
PyYAML==6.0.2
rapidfuzz==3.9.6
Expand Down
2 changes: 1 addition & 1 deletion copilot-ui/src/components/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Bot = ({ layout, getConversationId }: { layout?: string | undefined, getCo
<DropdownMenuLabel>Select a RAG Pattern</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
{["HNSW", "HNSW_Overlap", "Sibling"].map((f, i) => (
{["HNSW", "HNSW_Overlap", "Sibling", "GraphRAG"].map((f, i) => (
<DropdownMenuItem key={i} onSelect={() => handleSelectRag(f)}>
{/* <User className="mr-2 h-4 w-4" /> */}
<span>{f}</span>
Expand Down
30 changes: 29 additions & 1 deletion copilot/app/agent/agent_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from langgraph.graph import END, StateGraph
from pyTigerGraph.pyTigerGraphException import TigerGraphException
from supportai.retrievers import (HNSWOverlapRetriever, HNSWRetriever,
HNSWSiblingRetriever)
HNSWSiblingRetriever, GraphRAG)
from tools import MapQuestionToSchemaException
from typing_extensions import TypedDict

Expand Down Expand Up @@ -272,6 +272,32 @@ def sibling_search(self, state):
state["lookup_source"] = "supportai"
return state

def graphrag_search(self, state):
"""
Run the agent graphrag search.
"""
self.emit_progress("Searching the knowledge graph")
retriever = GraphRAG(
self.embedding_model,
self.embedding_store,
self.llm_provider.model,
self.db_connection,
)
step = retriever.search(
state["question"],
community_level=3
)

state["context"] = {
"function_call": "GraphRAG",
"result": {"@@final_retrieval": step[0]},
"query_output_format": self.db_connection.getQueryMetadata(
"GraphRAG_Community_Retriever"
)["output"],
}
state["lookup_source"] = "supportai"
return state

def supportai_search(self, state):
"""
Run the agent supportai search.
Expand All @@ -283,6 +309,8 @@ def supportai_search(self, state):
return self.hnsw_search(state)
elif self.supportai_retriever == "sibling":
return self.sibling_search(state)
elif self.supportai_retriever == "graphrag":
return self.graphrag_search(state)
else:
raise ValueError(f"Invalid supportai retriever: {self.supportai_retriever}")

Expand Down
2 changes: 1 addition & 1 deletion eventual-consistency-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.8
FROM python:3.11.8-bullseye
WORKDIR /code

COPY common/requirements.txt requirements.txt
Expand Down

0 comments on commit 09f1525

Please sign in to comment.