Skip to content

fetching model name from llm object #1286

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 1 commit into from
May 14, 2025
Merged
Changes from all 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
11 changes: 10 additions & 1 deletion backend/src/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ def get_llm(model: str):
logging.info(f"Model created - Model Version: {model}")
return llm, model_name

def get_llm_model_name(llm):
"""Extract name of llm model from llm object"""
for attr in ["model_name", "model", "model_id"]:
model_name = getattr(llm, attr, None)
if model_name:
return model_name.lower()
print("Could not determine model name; defaulting to empty string")
return ""

def get_combined_chunks(chunkId_chunkDoc_list, chunks_to_combine):
combined_chunk_document_list = []
Expand Down Expand Up @@ -181,8 +189,9 @@ async def get_graph_document_list(
node_properties = ["description"]
relationship_properties = ["description"]
TOOL_SUPPORTED_MODELS = {"qwen3", "deepseek"}
model_name = llm.model_name.lower()
model_name = get_llm_model_name(llm)
ignore_tool_usage = not any(pattern in model_name for pattern in TOOL_SUPPORTED_MODELS)
logging.info(f"Keeping ignore tool usage parameter as {ignore_tool_usage}")
llm_transformer = LLMGraphTransformer(
llm=llm,
node_properties=node_properties,
Expand Down