Skip to content
Open
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
26 changes: 26 additions & 0 deletions mellea/stdlib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def start_session(
session.cleanup()
```
"""
logger = FancyLogger.get_logger()

backend_class = backend_name_to_class(backend_name)
if backend_class is None:
raise Exception(
Expand All @@ -143,6 +145,30 @@ def start_session(

if ctx is None:
ctx = SimpleContext()

# Log session configuration
if isinstance(model_id, ModelIdentifier):
# Get the backend-specific model name
backend_to_attr = {
"ollama": "ollama_name",
"hf": "hf_model_name",
"huggingface": "hf_model_name",
"openai": "openai_name",
"watsonx": "watsonx_name",
"litellm": "hf_model_name",
}
attr = backend_to_attr.get(backend_name, "hf_model_name")
model_id_str = (
getattr(model_id, attr, None) or model_id.hf_model_name or str(model_id)
)
else:
model_id_str = model_id
logger.info(
f"Starting Mellea session: backend={backend_name}, model={model_id_str}, "
f"context={ctx.__class__.__name__}"
+ (f", model_options={model_options}" if model_options else "")
)

return MelleaSession(backend, ctx)


Expand Down