Skip to content

upgrade graphrag-sdk and move to litellm #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_repos() -> List[str]:
password=os.getenv('FALKORDB_PASSWORD', None))

graphs = db.list_graphs()
graphs = [g for g in graphs if not g.endswith('_git')]
graphs = [g for g in graphs if not (g.endswith('_git') or g.endswith('_schema'))]
return graphs

class Graph():
Expand Down
11 changes: 5 additions & 6 deletions api/llm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import logging

from graphrag_sdk.models.openai import OpenAiGenerativeModel
from graphrag_sdk.models.litellm import LiteModel
from graphrag_sdk import (
Ontology,
Entity,
Expand All @@ -12,7 +12,6 @@
KnowledgeGraphModelConfig
)

#from graphrag_sdk.models.gemini import GeminiGenerativeModel
from .prompts import (CYPHER_GEN_SYSTEM,
CYPHER_GEN_PROMPT,
GRAPH_QA_SYSTEM,
Expand Down Expand Up @@ -199,15 +198,15 @@ def _define_ontology() -> Ontology:
def _create_kg_agent(repo_name: str):
global ontology

openapi_model = OpenAiGenerativeModel("gpt-4o")
#gemini_model = GeminiGenerativeModel("gemini-1.5-flash-001")
#gemini_model_pro = GeminiGenerativeModel("gemini-1.5-pro")
model_name = os.getenv('MODEL_NAME', 'gemini/gemini-2.0-flash-exp')

model = LiteModel(model_name)

#ontology = _define_ontology()
code_graph_kg = KnowledgeGraph(
name=repo_name,
ontology=ontology,
model_config=KnowledgeGraphModelConfig.with_model(openapi_model),
model_config=KnowledgeGraphModelConfig.with_model(model),
host=os.getenv('FALKORDB_HOST', 'localhost'),
port=os.getenv('FALKORDB_PORT', 6379),
username=os.getenv('FALKORDB_USERNAME', None),
Expand Down
Loading
Loading