Skip to content

Commit ff4e290

Browse files
feat: Strip LiteLLM prefix from model name
Keep only the model name after "/" (e.g. gemini/gemini-2.5-flash -> gemini-2.5-flash) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d57d229 commit ff4e290

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/openlayer/lib/integrations/langchain_callback.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,14 @@ def _extract_model_info(
403403
or serialized.get("name")
404404
)
405405

406-
# Override provider from LiteLLM model prefix (e.g. "gemini/gemini-2.5-flash")
407-
# when the model is accessed through a proxy that reports as "openai-chat".
406+
# Handle LiteLLM model prefix (e.g. "gemini/gemini-2.5-flash"):
407+
# extract the actual provider and strip the prefix from the model name.
408408
if model and "/" in model:
409-
prefix = model.split("/", 1)[0]
409+
prefix, model_name = model.split("/", 1)
410410
litellm_provider = LITELLM_PREFIX_TO_PROVIDER_MAP.get(prefix)
411411
if litellm_provider:
412412
provider = litellm_provider
413+
model = model_name
413414

414415
# Clean invocation params (remove internal LangChain params)
415416
clean_params = {

0 commit comments

Comments
 (0)