Skip to content

Settings

Settings

Settings for Elysia. This class handles the configuration of various settings within Elysia. This includes: - The base and complex models to use. - The providers for the base and complex models. - The Weaviate cloud URL and API key. - The API keys for the providers. - The logger and logging level.

The Settings object is set as at a default settings object if running Elysia as a package. You can import this via elysia.config.settings. This is initialised to default values from the environment variables.

Or, you can create your own Settings object, and configure it as you wish. The Settings object can be passed to different Elysia classes and functions, such as Tree and preprocess. These will not use the global settings object, but instead use the Settings object you passed to them.

Source code in elysia/config.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
class Settings:
    """
    Settings for Elysia.
    This class handles the configuration of various settings within Elysia.
    This includes:
    - The base and complex models to use.
    - The providers for the base and complex models.
    - The Weaviate cloud URL and API key.
    - The API keys for the providers.
    - The logger and logging level.

    The Settings object is set as at a default `settings` object if running Elysia as a package.
    You can import this via `elysia.config.settings`.
    This is initialised to default values from the environment variables.

    Or, you can create your own Settings object, and configure it as you wish.
    The Settings object can be passed to different Elysia classes and functions, such as `Tree` and `preprocess`.
    These will not use the global `settings` object, but instead use the Settings object you passed to them.
    """

    def __init__(self):
        """
        Initialize the settings for Elysia.
        These are all settings initialised to None, and should be set using the `configure` method.
        """
        # Default settings
        self.SETTINGS_ID = str(random.randint(100000000000000, 999999999999999))

        self.base_init()

    def base_init(self):
        self.BASE_MODEL: str | None = None
        self.BASE_PROVIDER: str | None = None
        self.COMPLEX_MODEL: str | None = None
        self.COMPLEX_PROVIDER: str | None = None

        self.WCD_URL: str = ""
        self.WCD_API_KEY: str = ""

        self.MODEL_API_BASE: str | None = None

        self.API_KEYS: dict[str, str] = {}

        self.logger = logging.getLogger("rich")
        self.logger.setLevel(logging.INFO)

        # Remove any existing handlers before adding a new one
        for handler in self.logger.handlers[:]:
            self.logger.removeHandler(handler)
        self.logger.addHandler(RichHandler(rich_tracebacks=True, markup=True))

        self.logger.propagate = False
        self.LOGGING_LEVEL = "INFO"
        self.LOGGING_LEVEL_INT = 20

        # Experimental features
        self.USE_FEEDBACK = False
        self.BASE_USE_REASONING = True
        self.COMPLEX_USE_REASONING = True

    def setup_app_logger(self, logger: logging.Logger):
        """
        Override existing logger with the app-level logger.

        Args:
            logger (Logger): The logger to use.
        """
        self.logger = logger
        self.LOGGING_LEVEL_INT = logger.level
        inverted_logging_mapping = {
            v: k for k, v in logging.getLevelNamesMapping().items()
        }
        self.LOGGING_LEVEL = inverted_logging_mapping[self.LOGGING_LEVEL_INT]

    def configure_logger(
        self,
        level: Literal[
            "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NOTSET"
        ] = "NOTSET",
    ):
        """
        Configure the logger with a RichHandler.

        Args:
            level (Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NOTSET"]): The logging level to use.
        """
        self.logger.setLevel(level)
        self.LOGGING_LEVEL = level
        self.LOGGING_LEVEL_INT = logging.getLevelNamesMapping()[level]

    def set_api_key(self, api_key: str, api_key_name: str) -> None:
        self.API_KEYS[api_key_name] = api_key

    def get_api_key(self, api_key_name: str) -> str:
        return self.API_KEYS[api_key_name]

    def load_settings(self, settings: dict):
        for item in settings:
            setattr(self, item, settings[item])

        # self.logger = logging.getLogger("rich")
        # self.logger.setLevel(self.LOGGING_LEVEL)
        # for handler in self.logger.handlers[:]:
        #     self.logger.removeHandler(handler)
        # self.logger.addHandler(RichHandler(rich_tracebacks=True, markup=True))

    @classmethod
    def from_smart_setup(cls):
        settings = cls()
        settings.set_from_env()
        settings.smart_setup()
        return settings

    @classmethod
    def from_env_vars(cls):
        settings = cls()
        settings.set_from_env()
        return settings

    def set_from_env(self):
        self.BASE_MODEL = os.getenv("BASE_MODEL", None)
        self.COMPLEX_MODEL = os.getenv("COMPLEX_MODEL", None)
        self.BASE_PROVIDER = os.getenv("BASE_PROVIDER", None)
        self.COMPLEX_PROVIDER = os.getenv("COMPLEX_PROVIDER", None)
        self.MODEL_API_BASE = os.getenv("MODEL_API_BASE", None)
        self.LOGGING_LEVEL = os.getenv("LOGGING_LEVEL", "NOTSET")
        self.set_api_keys_from_env()

    def set_api_keys_from_env(self):

        self.WCD_URL = os.getenv(
            "WEAVIATE_URL",
            os.getenv("WCD_URL", ""),
        )
        self.WCD_API_KEY = os.getenv(
            "WEAVIATE_API_KEY",
            os.getenv("WCD_API_KEY", ""),
        )

        self.API_KEYS = {
            env_var.lower(): os.getenv(env_var, "")
            for env_var in os.environ
            if is_api_key(env_var) and env_var.lower() != "wcd_api_key"
        }
        for api_key in self.API_KEYS:
            self.set_api_key(self.API_KEYS[api_key], api_key)

    def smart_setup(self):

        # Check if the user has set the base model etc from the environment variables
        if os.getenv("BASE_MODEL", None):
            self.BASE_MODEL = os.getenv("BASE_MODEL")
        if os.getenv("COMPLEX_MODEL", None):
            self.COMPLEX_MODEL = os.getenv("COMPLEX_MODEL")
        if os.getenv("BASE_PROVIDER", None):
            self.BASE_PROVIDER = os.getenv("BASE_PROVIDER")
        if os.getenv("COMPLEX_PROVIDER", None):
            self.COMPLEX_PROVIDER = os.getenv("COMPLEX_PROVIDER")

        self.MODEL_API_BASE = os.getenv("MODEL_API_BASE", None)
        self.LOGGING_LEVEL = os.getenv("LOGGING_LEVEL", "NOTSET")

        self.set_api_keys_from_env()

        # check what API keys are available
        if (
            self.BASE_MODEL is None
            or self.COMPLEX_MODEL is None
            or self.BASE_PROVIDER is None
            or self.COMPLEX_PROVIDER is None
        ):
            if os.getenv("OPENROUTER_API_KEY", None):
                # use gemini 2.0 flash
                self.BASE_PROVIDER = "openrouter/google"
                self.COMPLEX_PROVIDER = "openrouter/google"
                self.BASE_MODEL = "gemini-2.0-flash-001"
                self.COMPLEX_MODEL = "gemini-2.5-flash"
            elif os.getenv("GEMINI_API_KEY", None):
                # use gemini 2.0 flash
                self.BASE_PROVIDER = "gemini"
                self.COMPLEX_PROVIDER = "gemini"
                self.BASE_MODEL = "gemini-2.0-flash-001"
                self.COMPLEX_MODEL = "gemini-2.5-flash"
            elif os.getenv("OPENAI_API_KEY", None):
                # use gpt family
                self.BASE_PROVIDER = "openai"
                self.COMPLEX_PROVIDER = "openai"
                self.BASE_MODEL = "gpt-4.1-mini"
                self.COMPLEX_MODEL = "gpt-4.1"
            elif os.getenv("ANTHROPIC_API_KEY", None):
                # use claude family
                self.BASE_PROVIDER = "anthropic"
                self.COMPLEX_PROVIDER = "anthropic"
                self.BASE_MODEL = "claude-3-5-haiku-latest"
                self.COMPLEX_MODEL = "claude-sonnet-4-0"

    def configure(
        self,
        replace: bool = False,
        **kwargs,
    ):
        """
        Configure the settings for Elysia for the current Settings object.

        Args:
            replace (bool): Whether to override the current settings with the new settings.
                When this is True, all existing settings are removed, and only the new settings are used.
                Defaults to False.
            **kwargs (str): One or more of the following:
                - base_model (str): The base model to use. e.g. "gpt-4o-mini"
                - complex_model (str): The complex model to use. e.g. "gpt-4o"
                - base_provider (str): The provider to use for base_model. E.g. "openai" or "openrouter/openai"
                - complex_provider (str): The provider to use for complex_model. E.g. "openai" or "openrouter/openai"
                - model_api_base (str): The API base to use.
                - wcd_url (str): The Weaviate cloud URL to use.
                - wcd_api_key (str): The Weaviate cloud API key to use.
                - logging_level (str): The logging level to use. e.g. "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
                - use_feedback (bool): EXPERIMENTAL. Whether to use feedback from previous runs of the tree.
                    If True, the tree will use TrainingUpdate objects that have been saved in previous runs of the decision tree.
                    These are implemented via few-shot examples for the decision node.
                    They are collected in the 'feedback' collection (ELYSIA_FEEDBACK__).
                    Relevant examples are retrieved from the collection based on searching the collection via the user's prompt.
                - base_use_reasoning (bool): Whether to use reasoning output for the base model.
                    If True, the model will generate reasoning before coming to its solution.
                - complex_use_reasoning (bool): Whether to use reasoning output for the complex model.
                    If True, the model will generate reasoning before coming to its solution.
                - Additional API keys to set. E.g. `openai_apikey="..."`, if this argument ends with `apikey` or `api_key`,
                    it will be added to the `API_KEYS` dictionary.

        """
        if replace:
            self.base_init()

        # convert all kwargs to lowercase for consistency
        kwargs = {kwarg.lower(): kwargs[kwarg] for kwarg in kwargs}

        if "base_model" in kwargs:
            if "base_provider" not in kwargs:
                raise ValueError(
                    "Provider must be specified if base_model is set. "
                    "E.g. `elysia.config.configure(base_model='gpt-4o-mini', base_provider='openai')`"
                )

            if kwargs["base_provider"] == "ollama" and (
                not kwargs["model_api_base"] or "MODEL_API_BASE" not in dir(self)
            ):
                raise ValueError(
                    "Using local models via ollama requires MODEL_API_BASE to be set. "
                    "This is likely to be http://localhost:11434. "
                    "e.g. `elysia.config.configure(model_api_base='http://localhost:11434')`"
                )

            self.BASE_MODEL = kwargs["base_model"]
            self.BASE_PROVIDER = kwargs["base_provider"]

            kwargs.pop("base_model")
            kwargs.pop("base_provider")

            # self.load_base_dspy_model()

        if "complex_model" in kwargs:
            if "complex_provider" not in kwargs:
                raise ValueError(
                    "Provider must be specified if complex_model is set. "
                    "E.g. `elysia.config.configure(complex_model='gpt-4o', complex_provider='openai')`"
                )

            if kwargs["complex_provider"] == "ollama" and (
                not kwargs["model_api_base"] or "MODEL_API_BASE" not in dir(self)
            ):
                raise ValueError(
                    "Using local models via ollama requires MODEL_API_BASE to be set. "
                    "This is likely to be http://localhost:11434. "
                    "e.g. `elysia.config.configure(model_api_base='http://localhost:11434')`"
                )

            self.COMPLEX_MODEL = kwargs["complex_model"]
            self.COMPLEX_PROVIDER = kwargs["complex_provider"]

            kwargs.pop("complex_model")
            kwargs.pop("complex_provider")

            # self.load_complex_dspy_model()

        if "model_api_base" in kwargs:
            self.MODEL_API_BASE = kwargs["model_api_base"]
            kwargs.pop("model_api_base")

        if "wcd_url" in kwargs:
            self.WCD_URL = kwargs["wcd_url"]
            kwargs.pop("wcd_url")

        if "wcd_api_key" in kwargs:
            self.WCD_API_KEY = kwargs["wcd_api_key"]
            kwargs.pop("wcd_api_key")

        if "weaviate_url" in kwargs:
            self.WCD_URL = kwargs["weaviate_url"]
            kwargs.pop("weaviate_url")

        if "weaviate_api_key" in kwargs:
            self.WCD_API_KEY = kwargs["weaviate_api_key"]
            kwargs.pop("weaviate_api_key")

        if "logging_level" in kwargs or "logger_level" in kwargs:

            self.LOGGING_LEVEL = (
                kwargs["logging_level"]
                if "logging_level" in kwargs
                else kwargs["logger_level"]
            )
            self.LOGGING_LEVEL_INT = logging.getLevelNamesMapping()[self.LOGGING_LEVEL]
            self.logger.setLevel(self.LOGGING_LEVEL)
            if "logging_level" in kwargs:
                kwargs.pop("logging_level")
            if "logger_level" in kwargs:
                kwargs.pop("logger_level")
            if "logging_level_int" in kwargs:
                kwargs.pop("logging_level_int")
            if "logger_level_int" in kwargs:
                kwargs.pop("logger_level_int")

        if "logging_level_int" in kwargs or "logger_level_int" in kwargs:

            self.LOGGING_LEVEL_INT = (
                kwargs["logging_level_int"]
                if "logging_level_int" in kwargs
                else kwargs["logger_level_int"]
            )
            self.LOGGING_LEVEL = {
                v: k for k, v in logging.getLevelNamesMapping().items()
            }[self.LOGGING_LEVEL_INT]
            self.logger.setLevel(self.LOGGING_LEVEL)

        if "settings_id" in kwargs:
            self.SETTINGS_ID = kwargs["settings_id"]
            kwargs.pop("settings_id")

        if "use_feedback" in kwargs:
            self.USE_FEEDBACK = kwargs["use_feedback"]
            kwargs.pop("use_feedback")

        if "base_use_reasoning" in kwargs:
            self.BASE_USE_REASONING = kwargs["base_use_reasoning"]
            kwargs.pop("base_use_reasoning")

        if "complex_use_reasoning" in kwargs:
            self.COMPLEX_USE_REASONING = kwargs["complex_use_reasoning"]
            kwargs.pop("complex_use_reasoning")

        if "api_keys" in kwargs and isinstance(kwargs["api_keys"], dict):
            for key, value in kwargs["api_keys"].items():
                self.set_api_key(value, key)
            kwargs.pop("api_keys")

        # remainder of kwargs are API keys or saved there
        removed_kwargs = []
        for key, value in kwargs.items():
            if is_api_key(key):
                self.set_api_key(value, key)
                removed_kwargs.append(key)

        for key in removed_kwargs:
            kwargs.pop(key)

        # remaining kwargs are not API keys
        if len(kwargs) > 0:
            self.logger.warning(
                "Unknown arguments to configure: " + ", ".join(kwargs.keys())
            )

    def __repr__(self) -> str:
        out = ""
        if "BASE_MODEL" in dir(self) and self.BASE_MODEL is not None:
            out += f"Base model: {self.BASE_MODEL}\n"
        else:
            out += "Base model: not set\n"
        if "COMPLEX_MODEL" in dir(self) and self.COMPLEX_MODEL is not None:
            out += f"Complex model: {self.COMPLEX_MODEL}\n"
        else:
            out += "Complex model: not set\n"
        if "BASE_PROVIDER" in dir(self) and self.BASE_PROVIDER is not None:
            out += f"Base provider: {self.BASE_PROVIDER}\n"
        else:
            out += "Base provider: not set\n"
        if "COMPLEX_PROVIDER" in dir(self) and self.COMPLEX_PROVIDER is not None:
            out += f"Complex provider: {self.COMPLEX_PROVIDER}\n"
        else:
            out += "Complex provider: not set\n"
        if "MODEL_API_BASE" in dir(self):
            out += f"Model API base: {self.MODEL_API_BASE}\n"
        else:
            out += "Model API base: not set\n"
        return out

    def to_json(self):
        return {
            item: getattr(self, item)
            for item in dir(self)
            if not item.startswith("_")
            and not isinstance(getattr(self, item), Callable)
            and item not in ["BASE_MODEL_LM", "COMPLEX_MODEL_LM", "logger"]
        }

    @classmethod
    def from_json(cls, json_data: dict):
        settings = cls()
        for item in json_data:
            if item not in ["logger"]:
                setattr(settings, item, json_data[item])

        settings.logger.setLevel(settings.LOGGING_LEVEL)

        return settings

    def check(self):
        return {
            "base_model": self.BASE_MODEL is not None and self.BASE_MODEL != "",
            "base_provider": self.BASE_PROVIDER is not None
            and self.BASE_PROVIDER != "",
            "complex_model": self.COMPLEX_MODEL is not None
            and self.COMPLEX_MODEL != "",
            "complex_provider": self.COMPLEX_PROVIDER is not None
            and self.COMPLEX_PROVIDER != "",
            "wcd_url": self.WCD_URL != "",
            "wcd_api_key": self.WCD_API_KEY != "",
        }

__init__()

Initialize the settings for Elysia. These are all settings initialised to None, and should be set using the configure method.

Source code in elysia/config.py
def __init__(self):
    """
    Initialize the settings for Elysia.
    These are all settings initialised to None, and should be set using the `configure` method.
    """
    # Default settings
    self.SETTINGS_ID = str(random.randint(100000000000000, 999999999999999))

    self.base_init()

configure(replace=False, **kwargs)

Configure the settings for Elysia for the current Settings object.

Parameters:

Name Type Description Default
replace bool

Whether to override the current settings with the new settings. When this is True, all existing settings are removed, and only the new settings are used. Defaults to False.

False
**kwargs str

One or more of the following: - base_model (str): The base model to use. e.g. "gpt-4o-mini" - complex_model (str): The complex model to use. e.g. "gpt-4o" - base_provider (str): The provider to use for base_model. E.g. "openai" or "openrouter/openai" - complex_provider (str): The provider to use for complex_model. E.g. "openai" or "openrouter/openai" - model_api_base (str): The API base to use. - wcd_url (str): The Weaviate cloud URL to use. - wcd_api_key (str): The Weaviate cloud API key to use. - logging_level (str): The logging level to use. e.g. "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" - use_feedback (bool): EXPERIMENTAL. Whether to use feedback from previous runs of the tree. If True, the tree will use TrainingUpdate objects that have been saved in previous runs of the decision tree. These are implemented via few-shot examples for the decision node. They are collected in the 'feedback' collection (ELYSIA_FEEDBACK__). Relevant examples are retrieved from the collection based on searching the collection via the user's prompt. - base_use_reasoning (bool): Whether to use reasoning output for the base model. If True, the model will generate reasoning before coming to its solution. - complex_use_reasoning (bool): Whether to use reasoning output for the complex model. If True, the model will generate reasoning before coming to its solution. - Additional API keys to set. E.g. openai_apikey="...", if this argument ends with apikey or api_key, it will be added to the API_KEYS dictionary.

{}
Source code in elysia/config.py
def configure(
    self,
    replace: bool = False,
    **kwargs,
):
    """
    Configure the settings for Elysia for the current Settings object.

    Args:
        replace (bool): Whether to override the current settings with the new settings.
            When this is True, all existing settings are removed, and only the new settings are used.
            Defaults to False.
        **kwargs (str): One or more of the following:
            - base_model (str): The base model to use. e.g. "gpt-4o-mini"
            - complex_model (str): The complex model to use. e.g. "gpt-4o"
            - base_provider (str): The provider to use for base_model. E.g. "openai" or "openrouter/openai"
            - complex_provider (str): The provider to use for complex_model. E.g. "openai" or "openrouter/openai"
            - model_api_base (str): The API base to use.
            - wcd_url (str): The Weaviate cloud URL to use.
            - wcd_api_key (str): The Weaviate cloud API key to use.
            - logging_level (str): The logging level to use. e.g. "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
            - use_feedback (bool): EXPERIMENTAL. Whether to use feedback from previous runs of the tree.
                If True, the tree will use TrainingUpdate objects that have been saved in previous runs of the decision tree.
                These are implemented via few-shot examples for the decision node.
                They are collected in the 'feedback' collection (ELYSIA_FEEDBACK__).
                Relevant examples are retrieved from the collection based on searching the collection via the user's prompt.
            - base_use_reasoning (bool): Whether to use reasoning output for the base model.
                If True, the model will generate reasoning before coming to its solution.
            - complex_use_reasoning (bool): Whether to use reasoning output for the complex model.
                If True, the model will generate reasoning before coming to its solution.
            - Additional API keys to set. E.g. `openai_apikey="..."`, if this argument ends with `apikey` or `api_key`,
                it will be added to the `API_KEYS` dictionary.

    """
    if replace:
        self.base_init()

    # convert all kwargs to lowercase for consistency
    kwargs = {kwarg.lower(): kwargs[kwarg] for kwarg in kwargs}

    if "base_model" in kwargs:
        if "base_provider" not in kwargs:
            raise ValueError(
                "Provider must be specified if base_model is set. "
                "E.g. `elysia.config.configure(base_model='gpt-4o-mini', base_provider='openai')`"
            )

        if kwargs["base_provider"] == "ollama" and (
            not kwargs["model_api_base"] or "MODEL_API_BASE" not in dir(self)
        ):
            raise ValueError(
                "Using local models via ollama requires MODEL_API_BASE to be set. "
                "This is likely to be http://localhost:11434. "
                "e.g. `elysia.config.configure(model_api_base='http://localhost:11434')`"
            )

        self.BASE_MODEL = kwargs["base_model"]
        self.BASE_PROVIDER = kwargs["base_provider"]

        kwargs.pop("base_model")
        kwargs.pop("base_provider")

        # self.load_base_dspy_model()

    if "complex_model" in kwargs:
        if "complex_provider" not in kwargs:
            raise ValueError(
                "Provider must be specified if complex_model is set. "
                "E.g. `elysia.config.configure(complex_model='gpt-4o', complex_provider='openai')`"
            )

        if kwargs["complex_provider"] == "ollama" and (
            not kwargs["model_api_base"] or "MODEL_API_BASE" not in dir(self)
        ):
            raise ValueError(
                "Using local models via ollama requires MODEL_API_BASE to be set. "
                "This is likely to be http://localhost:11434. "
                "e.g. `elysia.config.configure(model_api_base='http://localhost:11434')`"
            )

        self.COMPLEX_MODEL = kwargs["complex_model"]
        self.COMPLEX_PROVIDER = kwargs["complex_provider"]

        kwargs.pop("complex_model")
        kwargs.pop("complex_provider")

        # self.load_complex_dspy_model()

    if "model_api_base" in kwargs:
        self.MODEL_API_BASE = kwargs["model_api_base"]
        kwargs.pop("model_api_base")

    if "wcd_url" in kwargs:
        self.WCD_URL = kwargs["wcd_url"]
        kwargs.pop("wcd_url")

    if "wcd_api_key" in kwargs:
        self.WCD_API_KEY = kwargs["wcd_api_key"]
        kwargs.pop("wcd_api_key")

    if "weaviate_url" in kwargs:
        self.WCD_URL = kwargs["weaviate_url"]
        kwargs.pop("weaviate_url")

    if "weaviate_api_key" in kwargs:
        self.WCD_API_KEY = kwargs["weaviate_api_key"]
        kwargs.pop("weaviate_api_key")

    if "logging_level" in kwargs or "logger_level" in kwargs:

        self.LOGGING_LEVEL = (
            kwargs["logging_level"]
            if "logging_level" in kwargs
            else kwargs["logger_level"]
        )
        self.LOGGING_LEVEL_INT = logging.getLevelNamesMapping()[self.LOGGING_LEVEL]
        self.logger.setLevel(self.LOGGING_LEVEL)
        if "logging_level" in kwargs:
            kwargs.pop("logging_level")
        if "logger_level" in kwargs:
            kwargs.pop("logger_level")
        if "logging_level_int" in kwargs:
            kwargs.pop("logging_level_int")
        if "logger_level_int" in kwargs:
            kwargs.pop("logger_level_int")

    if "logging_level_int" in kwargs or "logger_level_int" in kwargs:

        self.LOGGING_LEVEL_INT = (
            kwargs["logging_level_int"]
            if "logging_level_int" in kwargs
            else kwargs["logger_level_int"]
        )
        self.LOGGING_LEVEL = {
            v: k for k, v in logging.getLevelNamesMapping().items()
        }[self.LOGGING_LEVEL_INT]
        self.logger.setLevel(self.LOGGING_LEVEL)

    if "settings_id" in kwargs:
        self.SETTINGS_ID = kwargs["settings_id"]
        kwargs.pop("settings_id")

    if "use_feedback" in kwargs:
        self.USE_FEEDBACK = kwargs["use_feedback"]
        kwargs.pop("use_feedback")

    if "base_use_reasoning" in kwargs:
        self.BASE_USE_REASONING = kwargs["base_use_reasoning"]
        kwargs.pop("base_use_reasoning")

    if "complex_use_reasoning" in kwargs:
        self.COMPLEX_USE_REASONING = kwargs["complex_use_reasoning"]
        kwargs.pop("complex_use_reasoning")

    if "api_keys" in kwargs and isinstance(kwargs["api_keys"], dict):
        for key, value in kwargs["api_keys"].items():
            self.set_api_key(value, key)
        kwargs.pop("api_keys")

    # remainder of kwargs are API keys or saved there
    removed_kwargs = []
    for key, value in kwargs.items():
        if is_api_key(key):
            self.set_api_key(value, key)
            removed_kwargs.append(key)

    for key in removed_kwargs:
        kwargs.pop(key)

    # remaining kwargs are not API keys
    if len(kwargs) > 0:
        self.logger.warning(
            "Unknown arguments to configure: " + ", ".join(kwargs.keys())
        )

configure_logger(level='NOTSET')

Configure the logger with a RichHandler.

Parameters:

Name Type Description Default
level Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'NOTSET']

The logging level to use.

'NOTSET'
Source code in elysia/config.py
def configure_logger(
    self,
    level: Literal[
        "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NOTSET"
    ] = "NOTSET",
):
    """
    Configure the logger with a RichHandler.

    Args:
        level (Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NOTSET"]): The logging level to use.
    """
    self.logger.setLevel(level)
    self.LOGGING_LEVEL = level
    self.LOGGING_LEVEL_INT = logging.getLevelNamesMapping()[level]

setup_app_logger(logger)

Override existing logger with the app-level logger.

Parameters:

Name Type Description Default
logger Logger

The logger to use.

required
Source code in elysia/config.py
def setup_app_logger(self, logger: logging.Logger):
    """
    Override existing logger with the app-level logger.

    Args:
        logger (Logger): The logger to use.
    """
    self.logger = logger
    self.LOGGING_LEVEL_INT = logger.level
    inverted_logging_mapping = {
        v: k for k, v in logging.getLevelNamesMapping().items()
    }
    self.LOGGING_LEVEL = inverted_logging_mapping[self.LOGGING_LEVEL_INT]

configure(**kwargs)

Configure the settings for Elysia for the global settings object.

Parameters:

Name Type Description Default
**kwargs str

One or more of the following: - base_model (str): The base model to use. e.g. "gpt-4o-mini" - complex_model (str): The complex model to use. e.g. "gpt-4o" - base_provider (str): The provider to use for base_model. E.g. "openai" or "openrouter/openai" - complex_provider (str): The provider to use for complex_model. E.g. "openai" or "openrouter/openai" - model_api_base (str): The API base to use. - wcd_url (str): The Weaviate cloud URL to use. - wcd_api_key (str): The Weaviate cloud API key to use. - logging_level (str): The logging level to use. e.g. "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" - use_feedback (bool): EXPERIMENTAL. Whether to use feedback from previous runs of the tree. If True, the tree will use TrainingUpdate objects that have been saved in previous runs of the decision tree. These are implemented via few-shot examples for the decision node. They are collected in the 'feedback' collection (ELYSIA_FEEDBACK__). Relevant examples are retrieved from the collection based on searching the collection via the user's prompt. - Additional API keys to set. E.g. openai_apikey="...", if this argument ends with apikey or api_key, it will be added to the API_KEYS dictionary.

{}
Source code in elysia/config.py
def configure(**kwargs) -> None:
    """
    Configure the settings for Elysia for the global settings object.

    Args:
        **kwargs (str): One or more of the following:
            - base_model (str): The base model to use. e.g. "gpt-4o-mini"
            - complex_model (str): The complex model to use. e.g. "gpt-4o"
            - base_provider (str): The provider to use for base_model. E.g. "openai" or "openrouter/openai"
            - complex_provider (str): The provider to use for complex_model. E.g. "openai" or "openrouter/openai"
            - model_api_base (str): The API base to use.
            - wcd_url (str): The Weaviate cloud URL to use.
            - wcd_api_key (str): The Weaviate cloud API key to use.
            - logging_level (str): The logging level to use. e.g. "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
            - use_feedback (bool): EXPERIMENTAL. Whether to use feedback from previous runs of the tree.
                If True, the tree will use TrainingUpdate objects that have been saved in previous runs of the decision tree.
                These are implemented via few-shot examples for the decision node.
                They are collected in the 'feedback' collection (ELYSIA_FEEDBACK__).
                Relevant examples are retrieved from the collection based on searching the collection via the user's prompt.
            - Additional API keys to set. E.g. `openai_apikey="..."`, if this argument ends with `apikey` or `api_key`,
                it will be added to the `API_KEYS` dictionary.

    """
    settings.configure(**kwargs)