chainlite icon indicating copy to clipboard operation
chainlite copied to clipboard

Assumes llm_config.yaml is present at the root of the project

Open duskybomb opened this issue 6 months ago • 0 comments

I have code that looks like this:

import os
from chainlite import llm_generation_chain, load_config_from_file

current_dir = os.path.dirname(os.path.realpath(__file__))
load_config_from_file(os.path.join(current_dir, "llm_config.yaml"))

When I run it I get the following error:

  File "/home/usr/worksheets/worksheets/environment.py", line 14, in <module>
    from chainlite import llm_generation_chain, load_config_from_file
  File "/home/usr/.conda/envs/worksheets-chainlite/lib/python3.11/site-packages/chainlite/__init__.py", line 3, in <module>
    from .llm_config import (
  File "/home/usr/.conda/envs/worksheets-chainlite/lib/python3.11/site-packages/chainlite/llm_config.py", line 148, in <module>
    load_config_from_file("./llm_config.yaml")
  File "/home/usr/.conda/envs/worksheets-chainlite/lib/python3.11/site-packages/chainlite/llm_config.py", line 81, in load_config_from_file
    with open(config_file, "r") as config_file:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './llm_config.yaml'

The library assumes that the project's root directory contains a ./llm_config.yaml file and tries to load it even if load_config_from_file() is used.

I believe the issue is L148 in llm_config.py, which hardcodes the config file path.

duskybomb avatar Aug 01 '24 22:08 duskybomb