Skip to content

Commit 4bec84a

Browse files
code changes done to get model name from llm to condition ignore tool usage behaviour (#1286)
1 parent cfa8195 commit 4bec84a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

backend/src/llm.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ def get_llm(model: str):
127127
logging.info(f"Model created - Model Version: {model}")
128128
return llm, model_name
129129

130+
def get_llm_model_name(llm):
131+
"""Extract name of llm model from llm object"""
132+
for attr in ["model_name", "model", "model_id"]:
133+
model_name = getattr(llm, attr, None)
134+
if model_name:
135+
return model_name.lower()
136+
print("Could not determine model name; defaulting to empty string")
137+
return ""
130138

131139
def get_combined_chunks(chunkId_chunkDoc_list, chunks_to_combine):
132140
combined_chunk_document_list = []
@@ -181,8 +189,9 @@ async def get_graph_document_list(
181189
node_properties = ["description"]
182190
relationship_properties = ["description"]
183191
TOOL_SUPPORTED_MODELS = {"qwen3", "deepseek"}
184-
model_name = llm.model_name.lower()
192+
model_name = get_llm_model_name(llm)
185193
ignore_tool_usage = not any(pattern in model_name for pattern in TOOL_SUPPORTED_MODELS)
194+
logging.info(f"Keeping ignore tool usage parameter as {ignore_tool_usage}")
186195
llm_transformer = LLMGraphTransformer(
187196
llm=llm,
188197
node_properties=node_properties,

0 commit comments

Comments
 (0)